Skip to content

[Feature] [Platform] Improve Registry Performance #1934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- (Documentation) ManualUpgrade Docs
- (Documentation) Add Required & Skip in Docs
- (Feature) (Platform) ECS Storage
- (Feature) (Platform) Improve Registry Performance

## [1.2.50](https://github.com/arangodb/kube-arangodb/tree/1.2.50) (2025-07-04)
- (Feature) (Platform) MetaV1 Integration Service
Expand Down
2 changes: 1 addition & 1 deletion docs/api/ArangoBackupPolicy.V1.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Parsed by https://godoc.org/github.com/robfig/cron

Type: `meta.LabelSelector` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.50/pkg/apis/backup/v1/backup_policy_spec.go#L39)</sup>

DeploymentSelector Selector definition for selecting matching ArangoBackup Custom Resources.
DeploymentSelector Selector definition for selecting matching ArangoDeployment Custom Resources.

Links:
* [Kubernetes Documentation](https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#LabelSelector)
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/backup/v1/backup_policy_spec.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,7 +33,7 @@ type ArangoBackupPolicySpec struct {
// AllowConcurrent if false, ArangoBackup will not be created when previous Backups are not finished
// +doc/default: true
AllowConcurrent *bool `json:"allowConcurrent,omitempty"`
// DeploymentSelector Selector definition for selecting matching ArangoBackup Custom Resources.
// DeploymentSelector Selector definition for selecting matching ArangoDeployment Custom Resources.
// +doc/type: meta.LabelSelector
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#LabelSelector
DeploymentSelector *meta.LabelSelector `json:"selector,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/crd/crds/backups-backuppolicy.schema.generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ v1:
Parsed by https://godoc.org/github.com/robfig/cron
type: string
selector:
description: DeploymentSelector Selector definition for selecting matching ArangoBackup Custom Resources.
description: DeploymentSelector Selector definition for selecting matching ArangoDeployment Custom Resources.
properties:
matchExpressions:
items:
Expand Down
6 changes: 6 additions & 0 deletions pkg/platform/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,10 @@ var (
Description: "List of insecure registries",
Default: nil,
}

flagRegistryList = cli.Flag[[]string]{
Name: "registry.docker.endpoint",
Description: "List of boosted registries",
Default: nil,
}
)
2 changes: 1 addition & 1 deletion pkg/platform/package_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func packageExport() (*cobra.Command, error) {
cmd.Use = "export [flags] package output"
cmd.Short = "Export the package in the ZIP Format"

if err := cli.RegisterFlags(&cmd, flagPlatformEndpoint, flagRegistryUseCredentials, flagRegistryInsecure); err != nil {
if err := cli.RegisterFlags(&cmd, flagPlatformEndpoint, flagRegistryUseCredentials, flagRegistryInsecure, flagRegistryList); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/platform/package_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func packageImport() (*cobra.Command, error) {
cmd.Use = "import [flags] registry package output"
cmd.Short = "Imports the package from the ZIP format"

if err := cli.RegisterFlags(&cmd, flagRegistryUseCredentials, flagRegistryInsecure); err != nil {
if err := cli.RegisterFlags(&cmd, flagRegistryUseCredentials, flagRegistryInsecure, flagRegistryList); err != nil {
return nil, err
}

Expand Down
22 changes: 22 additions & 0 deletions pkg/platform/regclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func getRegClient(cmd *cobra.Command) (*regclient.RegClient, error) {

slog.SetLogLoggerLevel(slog.LevelDebug)

flags = append(flags, regclient.WithConfigHostDefault(config.Host{
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The literal value ReqConcurrent: 8 appears multiple times. Extract this into a named constant (e.g., defaultReqConcurrent) to avoid magic numbers and improve maintainability.

Copilot uses AI. Check for mistakes.

ReqConcurrent: 8,
}))

flags = append(flags, regclient.WithRegOpts(reg.WithTransport(&goHttp.Transport{
MaxConnsPerHost: 64,
MaxIdleConns: 100,
Expand All @@ -55,6 +59,24 @@ func getRegClient(cmd *cobra.Command) (*regclient.RegClient, error) {
}

v.TLS = config.TLSDisabled
v.ReqConcurrent = 8

configs[el] = v
}

regs, err := flagRegistryList.Get(cmd)
if err != nil {
return nil, err
}

for _, el := range regs {
v, ok := configs[el]
if !ok {
v.Name = el
v.Hostname = el
}

v.ReqConcurrent = 8
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concurrency setting is applied twice in separate loops. Consider consolidating this logic to ensure DRY code and reduce potential for divergence in future updates.

Suggested change
v.ReqConcurrent = 8
v = setReqConcurrent(v)

Copilot uses AI. Check for mistakes.


configs[el] = v
}
Expand Down