Skip to content

Commit 05097ba

Browse files
committed
[Feature] [Platform] Installer move to OCI
1 parent 2c2c332 commit 05097ba

File tree

18 files changed

+487
-333
lines changed

18 files changed

+487
-333
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- (Bugfix) (Platform) Ensure Inventory picks active leader
1616
- (Bugfix) (Platform) Reload Config on Inventory Change
1717
- (Bugfix) (Platform) Ensure Inventory uses the serving group for license generation
18+
- (Bugfix) (Platform) Installer move to OCI
1819

1920
## [1.3.1](https://github.com/arangodb/kube-arangodb/tree/1.3.1) (2025-10-07)
2021
- (Documentation) Add ArangoPlatformStorage Docs & Examples

docs/cli/arangodb_operator_platform.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Available Commands:
4141
import Imports the package from the ZIP format
4242
install Installs the specified setup of the platform
4343
merge Merges definitions into single file
44-
registry Points all images to the new registry
4544
4645
Flags:
4746
-h, --help help for package
@@ -83,9 +82,13 @@ Usage:
8382
arangodb_operator_platform package install [flags] ... packages
8483
8584
Flags:
86-
-h, --help help for install
87-
--platform.endpoint string Platform Repository URL (default "https://arangodb-platform-prd-chart-registry.s3.amazonaws.com")
88-
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
85+
-h, --help help for install
86+
--license.client.id string LicenseManager Client ID (ENV: LICENSE_CLIENT_ID)
87+
--license.client.secret string LicenseManager Client Secret (ENV: LICENSE_CLIENT_SECRET)
88+
--license.endpoint string LicenseManager Endpoint (default "license.arango.ai")
89+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
90+
--registry.docker.credentials Use Docker Credentials
91+
--registry.docker.insecure strings List of insecure registries
8992
9093
Global Flags:
9194
--kubeconfig string Kubernetes Config File
@@ -161,9 +164,8 @@ Flags:
161164
--arango.insecure Arango Endpoint Insecure
162165
--arango.token string Arango JWT Token for Authentication
163166
-h, --help help for activate
164-
--license.client.id string LicenseManager Client ID
165-
--license.client.secret string LicenseManager Client Secret
166-
--license.client.stage strings LicenseManager Stages (default [prd])
167+
--license.client.id string LicenseManager Client ID (ENV: LICENSE_CLIENT_ID)
168+
--license.client.secret string LicenseManager Client Secret (ENV: LICENSE_CLIENT_SECRET)
167169
--license.endpoint string LicenseManager Endpoint (default "license.arango.ai")
168170
--license.interval duration Interval of the license synchronization
169171
--telemetry Enables Telemetry (default true)
@@ -187,9 +189,8 @@ Flags:
187189
--deployment.id string Deployment ID
188190
-h, --help help for generate
189191
--inventory string Path to the Inventory File
190-
--license.client.id string LicenseManager Client ID
191-
--license.client.secret string LicenseManager Client Secret
192-
--license.client.stage strings LicenseManager Stages (default [prd])
192+
--license.client.id string LicenseManager Client ID (ENV: LICENSE_CLIENT_ID)
193+
--license.client.secret string LicenseManager Client Secret (ENV: LICENSE_CLIENT_SECRET)
193194
--license.endpoint string LicenseManager Endpoint (default "license.arango.ai")
194195
195196
Global Flags:
@@ -209,9 +210,8 @@ Usage:
209210
210211
Flags:
211212
-h, --help help for secret
212-
--license.client.id string LicenseManager Client ID
213-
--license.client.secret string LicenseManager Client Secret
214-
--license.client.stage strings LicenseManager Stages (default [prd])
213+
--license.client.id string LicenseManager Client ID (ENV: LICENSE_CLIENT_ID)
214+
--license.client.secret string LicenseManager Client Secret (ENV: LICENSE_CLIENT_SECRET)
215215
--license.endpoint string LicenseManager Endpoint (default "license.arango.ai")
216216
--secret string Kubernetes Secret Name
217217

pkg/platform/chart_manager.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

pkg/platform/flags.go

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,6 @@ var (
121121
},
122122
}
123123

124-
flagPlatformEndpoint = cli.Flag[string]{
125-
Name: "platform.endpoint",
126-
Description: "Platform Repository URL",
127-
Default: "https://arangodb-platform-prd-chart-registry.s3.amazonaws.com",
128-
Persistent: true,
129-
}
130-
131124
flagUpgradeVersions = cli.Flag[bool]{
132125
Name: "upgrade",
133126
Short: "u",
@@ -176,26 +169,7 @@ var (
176169
Default: true,
177170
}
178171

179-
flagRegistryUseCredentials = cli.Flag[bool]{
180-
Name: "registry.docker.credentials",
181-
Description: "Use Docker Credentials",
182-
Default: false,
183-
Check: func(in bool) error {
184-
return nil
185-
},
186-
}
187-
188-
flagRegistryInsecure = cli.Flag[[]string]{
189-
Name: "registry.docker.insecure",
190-
Description: "List of insecure registries",
191-
Default: nil,
192-
}
193-
194-
flagRegistryList = cli.Flag[[]string]{
195-
Name: "registry.docker.endpoint",
196-
Description: "List of boosted registries",
197-
Default: nil,
198-
}
172+
flagRegistry = cli.NewRegistry()
199173

200174
flagActivateInterval = cli.Flag[time.Duration]{
201175
Name: "license.interval",

pkg/platform/pack/export.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import (
4444
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/helm"
4545
)
4646

47-
func Export(ctx context.Context, path string, m helm.ChartManager, client *regclient.RegClient, p helm.Package, images ...ProtoImage) error {
47+
func Export(ctx context.Context, endpoint, path string, client *regclient.RegClient, p helm.Package, images ...ProtoImage) error {
4848
out, err := os.Create(path)
4949
if err != nil {
5050
return err
@@ -53,9 +53,9 @@ func Export(ctx context.Context, path string, m helm.ChartManager, client *regcl
5353
tw := zip.NewWriter(out)
5454

5555
var r = exportPackageSet{
56-
m: m,
5756
images: images,
5857
client: client,
58+
endpoint: endpoint,
5959
wr: tw,
6060
existence: map[string]bool{},
6161
}
@@ -82,9 +82,10 @@ func Export(ctx context.Context, path string, m helm.ChartManager, client *regcl
8282
type exportPackageSet struct {
8383
lock sync.Mutex
8484

85+
endpoint string
86+
8587
proto Proto
8688

87-
m helm.ChartManager
8889
client *regclient.RegClient
8990

9091
images []ProtoImage
@@ -120,22 +121,17 @@ func (r *exportPackageSet) exportPackage(name string, spec helm.PackageSpec) exe
120121
var chart helm.Chart
121122

122123
if spec.Chart.IsZero() {
123-
repo, ok := r.m.Get(name)
124-
if !ok {
125-
return errors.Errorf("Chart `%s` not found", name)
126-
}
127-
128-
ver, ok := repo.Get(spec.Version)
129-
if !ok {
130-
return errors.Errorf("Chart `%s=%s` not found", name, spec.Version)
124+
ref, err := ChartReference(r.endpoint, spec.GetStage(), name, spec.Version)
125+
if err != nil {
126+
return err
131127
}
132128

133-
c, err := ver.Get(ctx)
129+
loadedChart, err := ExportChart(ctx, r.client, ref)
134130
if err != nil {
135131
return err
136132
}
137133

138-
chart = c
134+
chart = loadedChart
139135
} else {
140136
chart = helm.Chart(spec.Chart)
141137
}

pkg/platform/pack/utils.go

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2025 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package pack
22+
23+
import (
24+
"context"
25+
"fmt"
26+
"io"
27+
28+
"github.com/regclient/regclient"
29+
"github.com/regclient/regclient/types/mediatype"
30+
"github.com/regclient/regclient/types/ref"
31+
32+
"github.com/arangodb/kube-arangodb/pkg/util/errors"
33+
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/helm"
34+
)
35+
36+
func ChartReference(endpoint, stage, name, version string) (ref.Ref, error) {
37+
if stage == "prd" {
38+
endpoint = fmt.Sprintf("helm.%s", endpoint)
39+
} else {
40+
endpoint = fmt.Sprintf("%s.helm.%s", stage, endpoint)
41+
}
42+
43+
return ref.New(fmt.Sprintf("%s/%s:%s", endpoint, name, version))
44+
}
45+
46+
func ExportChart(ctx context.Context, client *regclient.RegClient, src ref.Ref) (helm.Chart, error) {
47+
m, err := client.ManifestGet(ctx, src)
48+
if err != nil {
49+
return nil, err
50+
}
51+
52+
if m.GetMediaType() != mediatype.OCI1Manifest {
53+
return nil, errors.Errorf("Manifest is not %s, got %s", mediatype.OCI1Manifest, m.GetMediaType())
54+
}
55+
56+
layers, err := m.GetLayers()
57+
if err != nil {
58+
return nil, err
59+
}
60+
61+
if len(layers) != 1 {
62+
return nil, errors.Errorf("Expected one layer in the OCI")
63+
}
64+
65+
layer := layers[0]
66+
67+
if layer.MediaType != "application/vnd.cncf.helm.chart.content.v1.tar+gzip" {
68+
return nil, errors.Errorf("Manifest is not %s, got %s", "application/vnd.cncf.helm.chart.content.v1.tar+gzip", layer.MediaType)
69+
}
70+
71+
o, err := client.BlobGet(ctx, src, layer)
72+
if err != nil {
73+
return nil, err
74+
}
75+
76+
data, err := io.ReadAll(o)
77+
if err != nil {
78+
return nil, err
79+
}
80+
81+
return data, nil
82+
}

pkg/platform/package.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ func pkg() (*cobra.Command, error) {
4242
packageExport,
4343
packageImport,
4444
packageMerge,
45-
packageRegistry,
4645
); err != nil {
4746
return nil, err
4847
}

pkg/platform/package_export.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func packageExport() (*cobra.Command, error) {
3434
cmd.Use = "export [flags] package output"
3535
cmd.Short = "Export the package in the ZIP Format"
3636

37-
if err := cli.RegisterFlags(&cmd, flagPlatformEndpoint, flagRegistryUseCredentials, flagRegistryInsecure, flagRegistryList); err != nil {
37+
if err := cli.RegisterFlags(&cmd, flagLicenseManager, flagRegistry); err != nil {
3838
return nil, err
3939
}
4040

@@ -56,15 +56,15 @@ func packageExportRun(cmd *cobra.Command, args []string) error {
5656

5757
out := args[1]
5858

59-
cm, err := getChartManager(cmd)
59+
rc, err := flagRegistry.Client(cmd, flagLicenseManager)
6060
if err != nil {
6161
return err
6262
}
6363

64-
rc, err := getRegClient(cmd)
64+
endpoint, err := flagLicenseManager.Endpoint(cmd)
6565
if err != nil {
6666
return err
6767
}
6868

69-
return pack.Export(cmd.Context(), out, cm, rc, pkg)
69+
return pack.Export(cmd.Context(), endpoint, out, rc, pkg)
7070
}

pkg/platform/package_import.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func packageImport() (*cobra.Command, error) {
3737
cmd.Use = "import [flags] registry package output"
3838
cmd.Short = "Imports the package from the ZIP format"
3939

40-
if err := cli.RegisterFlags(&cmd, flagRegistryUseCredentials, flagRegistryInsecure, flagRegistryList); err != nil {
40+
if err := cli.RegisterFlags(&cmd, flagRegistry); err != nil {
4141
return nil, err
4242
}
4343

@@ -55,7 +55,7 @@ func packageImportRun(cmd *cobra.Command, args []string) error {
5555
dest := args[1]
5656
out := args[2]
5757

58-
rc, err := getRegClient(cmd)
58+
rc, err := flagRegistry.Client(cmd, nil)
5959
if err != nil {
6060
return err
6161
}

0 commit comments

Comments
 (0)