Skip to content

Commit b7ae7e9

Browse files
authored
[Feature] [Platform] Improve CLI Values (#1891)
1 parent 175612c commit b7ae7e9

15 files changed

+52
-65
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- (Feature) (Platform) Reorganize Envoy Auth
77
- (Feature) Ensure Group Service Type
88
- (Maintenance) Fix Helm & JWT CVE's
9+
- (Feature) (Platform) Improve CLI Values
910

1011
## [1.2.48](https://github.com/arangodb/kube-arangodb/tree/1.2.48) (2025-05-08)
1112
- (Maintenance) Extend Documentation

docs/cli/arangodb_operator_platform.md

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ Available Commands:
4040
status Describes Charts Status
4141
4242
Flags:
43-
-h, --help help for registry
44-
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
45-
--platform.stage string Platform Stage Name (default "dev")
43+
-h, --help help for registry
44+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
4645
4746
Global Flags:
4847
-n, --namespace string Kubernetes Namespace (default "default")
@@ -61,12 +60,11 @@ Usage:
6160
arangodb_operator_platform registry install [flags] [...charts]
6261
6362
Flags:
64-
-a, --all Runs on all items
65-
-h, --help help for install
66-
-o, --output string Output format. Allowed table, json, yaml (default "table")
67-
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
68-
--platform.stage string Platform Stage Name (default "dev")
69-
-u, --upgrade Enable upgrade procedure
63+
-a, --all Runs on all items
64+
-h, --help help for install
65+
-o, --output string Output format. Allowed table, json, yaml (default "table")
66+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
67+
-u, --upgrade Enable upgrade procedure
7068
7169
Global Flags:
7270
-n, --namespace string Kubernetes Namespace (default "default")
@@ -83,10 +81,9 @@ Usage:
8381
arangodb_operator_platform registry status [flags]
8482
8583
Flags:
86-
-h, --help help for status
87-
-o, --output string Output format. Allowed table, json, yaml (default "table")
88-
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
89-
--platform.stage string Platform Stage Name (default "dev")
84+
-h, --help help for status
85+
-o, --output string Output format. Allowed table, json, yaml (default "table")
86+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
9087
9188
Global Flags:
9289
-n, --namespace string Kubernetes Namespace (default "default")
@@ -108,9 +105,8 @@ Available Commands:
108105
status Shows Service Status
109106
110107
Flags:
111-
-h, --help help for service
112-
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
113-
--platform.stage string Platform Stage Name (default "dev")
108+
-h, --help help for service
109+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
114110
115111
Global Flags:
116112
-n, --namespace string Kubernetes Namespace (default "default")
@@ -129,10 +125,9 @@ Usage:
129125
arangodb_operator_platform service enable [flags] deployment name chart
130126
131127
Flags:
132-
-h, --help help for enable
133-
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
134-
--platform.stage string Platform Stage Name (default "dev")
135-
-f, --values strings Chart values
128+
-h, --help help for enable
129+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
130+
-f, --values strings Chart values
136131
137132
Global Flags:
138133
-n, --namespace string Kubernetes Namespace (default "default")
@@ -149,10 +144,9 @@ Usage:
149144
arangodb_operator_platform service enable-service [flags] deployment chart
150145
151146
Flags:
152-
-h, --help help for enable-service
153-
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
154-
--platform.stage string Platform Stage Name (default "dev")
155-
-f, --values strings Chart values
147+
-h, --help help for enable-service
148+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
149+
-f, --values strings Chart values
156150
157151
Global Flags:
158152
-n, --namespace string Kubernetes Namespace (default "default")
@@ -169,10 +163,9 @@ Usage:
169163
arangodb_operator_platform service status [flags] deployment
170164
171165
Flags:
172-
-h, --help help for status
173-
-o, --output string Output format. Allowed table, json, yaml (default "table")
174-
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
175-
--platform.stage string Platform Stage Name (default "dev")
166+
-h, --help help for status
167+
-o, --output string Output format. Allowed table, json, yaml (default "table")
168+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
176169
177170
Global Flags:
178171
-n, --namespace string Kubernetes Namespace (default "default")
@@ -231,8 +224,7 @@ Usage:
231224
arangodb_operator_platform package install [flags] deployment package
232225
233226
Flags:
234-
-h, --help help for install
235-
--platform.stage string Platform Stage Name (default "dev")
227+
-h, --help help for install
236228
237229
Global Flags:
238230
-n, --namespace string Kubernetes Namespace (default "default")

pkg/platform/chart_manager.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
package platform
2222

2323
import (
24-
"fmt"
2524
goHttp "net/http"
2625

2726
"github.com/spf13/cobra"
@@ -35,10 +34,5 @@ func getChartManager(cmd *cobra.Command) (helm.ChartManager, error) {
3534
return nil, err
3635
}
3736

38-
stage, err := flagPlatformStage.Get(cmd)
39-
if err != nil {
40-
return nil, err
41-
}
42-
43-
return helm.NewChartManager(cmd.Context(), goHttp.DefaultClient, "%s/index.yaml", fmt.Sprintf(endpoint, stage))
37+
return helm.NewChartManager(cmd.Context(), goHttp.DefaultClient, "%s/index.yaml", endpoint)
4438
}

pkg/platform/flags.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,10 @@ var (
6060
},
6161
}
6262

63-
flagPlatformStage = cli.Flag[string]{
64-
Name: "platform.stage",
65-
Description: "Platform Stage Name",
66-
Default: "dev",
67-
Persistent: true,
68-
Check: func(in string) error {
69-
switch in {
70-
case "prd", "dev":
71-
return nil
72-
}
73-
74-
return errors.Errorf("Unsupported Platform Stage: %s", in)
75-
},
76-
}
77-
7863
flagPlatformEndpoint = cli.Flag[string]{
7964
Name: "platform.endpoint",
8065
Description: "Platform Repository URL",
81-
Default: "https://arangodb-platform-%s-chart-registry.s3.amazonaws.com",
66+
Default: "https://arangodb-platform-prd-chart-registry.s3.amazonaws.com",
8267
Persistent: true,
8368
Hidden: true,
8469
}

pkg/platform/package_install.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func packageInstall() (*cobra.Command, error) {
4444
cmd.Use = "install [flags] deployment package"
4545
cmd.Short = "Installs the specified setup of the platform"
4646

47-
if err := cli.RegisterFlags(&cmd, flagPlatformStage, flagPlatformEndpoint); err != nil {
47+
if err := cli.RegisterFlags(&cmd, flagPlatformEndpoint); err != nil {
4848
return nil, err
4949
}
5050

@@ -153,6 +153,12 @@ func packageInstallRun(cmd *cobra.Command, args []string) error {
153153
}
154154
logger.Str("uid", string(deploymentObject.GetUID())).Info("ArangoDeployment Found")
155155

156+
gv, err := r.Overrides.Marshal()
157+
if err != nil {
158+
logger.Err(err).Error("Unable to unmarshal values")
159+
return err
160+
}
161+
156162
for name, release := range r.Releases {
157163
ov, err := release.Overrides.Marshal()
158164
if err != nil {
@@ -166,9 +172,7 @@ func packageInstallRun(cmd *cobra.Command, args []string) error {
166172
"name": deployment,
167173
},
168174
},
169-
},
170-
171-
ov)
175+
}, gv, ov)
172176
if err != nil {
173177
return errors.Wrapf(err, "Unable to build helm data")
174178
}

pkg/platform/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func registry() (*cobra.Command, error) {
3232
cmd.Use = "registry"
3333
cmd.Short = "Registry related operations"
3434

35-
if err := cli.RegisterFlags(&cmd, flagPlatformStage, flagPlatformEndpoint, flagPlatformName); err != nil {
35+
if err := cli.RegisterFlags(&cmd, flagPlatformEndpoint, flagPlatformName); err != nil {
3636
return nil, err
3737
}
3838

pkg/platform/registry_install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func registryInstall() (*cobra.Command, error) {
4545
cmd.Use = "install [flags] [...charts]"
4646
cmd.Short = "Manages the Chart Installation"
4747

48-
if err := cli.RegisterFlags(&cmd, flagPlatformStage, flagPlatformEndpoint, flagPlatformName, flagOutput, flagUpgradeVersions, flagAll); err != nil {
48+
if err := cli.RegisterFlags(&cmd, flagPlatformEndpoint, flagPlatformName, flagOutput, flagUpgradeVersions, flagAll); err != nil {
4949
return nil, err
5050
}
5151

pkg/platform/registry_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func registryStatus() (*cobra.Command, error) {
4545
cmd.Use = "status"
4646
cmd.Short = "Describes Charts Status"
4747

48-
if err := cli.RegisterFlags(&cmd, flagPlatformStage, flagPlatformEndpoint, flagPlatformName, flagOutput); err != nil {
48+
if err := cli.RegisterFlags(&cmd, flagPlatformEndpoint, flagPlatformName, flagOutput); err != nil {
4949
return nil, err
5050
}
5151

pkg/platform/runner.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func getRunner() cli.Runner {
3131
cli.ValidateFlags(
3232
flagNamespace,
3333
flagPlatformName,
34-
flagPlatformStage,
3534
flagPlatformEndpoint,
3635
flagOutput,
3736
flagUpgradeVersions,

pkg/platform/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func service() (*cobra.Command, error) {
3232
cmd.Use = "service"
3333
cmd.Short = "Service related operations"
3434

35-
if err := cli.RegisterFlags(&cmd, flagPlatformStage, flagPlatformEndpoint, flagPlatformName); err != nil {
35+
if err := cli.RegisterFlags(&cmd, flagPlatformEndpoint, flagPlatformName); err != nil {
3636
return nil, err
3737
}
3838

0 commit comments

Comments
 (0)