Skip to content

Commit a92d8aa

Browse files
authored
[Feature] [Platform] Dump CLI switch to Services (#1999)
1 parent 788269b commit a92d8aa

File tree

4 files changed

+38
-54
lines changed

4 files changed

+38
-54
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- (Bugfix) (Platform) Fix Container Resource Adjustments
55
- (Bugfix) (Platform) Fix LM CLI Option
66
- (Bugfix) (Platform) Fix topology for Gateways
7+
- (Feature) (Platform) Dump CLI switch to Services
78

89
## [1.3.2](https://github.com/arangodb/kube-arangodb/tree/1.3.2) (2025-11-20)
910
- (Bugfix) (Platform) Increase memory limit for Inventory

docs/platform.install.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ packages:
3333
3434
### .package.packages.\<string\>.chart
3535
36-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L87)</sup>
36+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L83)</sup>
3737

3838
Chart defines override of the PackageSpec
3939
It supports multiple modes:
@@ -48,39 +48,39 @@ It supports multiple modes:
4848

4949
### .package.packages.\<string\>.overrides
5050

51-
Type: `Object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L91)</sup>
51+
Type: `Object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L87)</sup>
5252

5353
Overrides defines Values to override the Helm Chart Defaults (merged with Service Overrides)
5454

5555
***
5656

5757
### .package.packages.\<string\>.stage
5858

59-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L74)</sup>
59+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L70)</sup>
6060

6161
Stage defines stage used in the fetch from LicenseManager
6262

6363
***
6464

6565
### .package.packages.\<string\>.version
6666

67-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L77)</sup>
67+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L73)</sup>
6868

6969
Version keeps the version of the PackageSpec
7070

7171
***
7272

7373
### .package.releases.\<string\>.overrides
7474

75-
Type: `Object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L171)</sup>
75+
Type: `Object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L167)</sup>
7676

7777
Overrides defines Values to override the Helm Chart Defaults during installation
7878

7979
***
8080

8181
### .package.releases.\<string\>.package
8282

83-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L167)</sup>
83+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.3.2/pkg/util/k8sutil/helm/package.go#L163)</sup>
8484

8585
Package keeps the name of the Chart used from the installation script.
8686
References to value provided in Packages

pkg/util/k8sutil/helm/charts.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,22 @@ func GetLocalCharts(ctx context.Context, client kclient.Client, namespace string
4747
return in.GetName()
4848
}), nil
4949
}
50+
51+
func GetLocalServices(ctx context.Context, client kclient.Client, namespace string) (map[string]*platformApi.ArangoPlatformService, error) {
52+
l, err := list.ListObjects[*platformApi.ArangoPlatformServiceList, *platformApi.ArangoPlatformService](ctx, client.Arango().PlatformV1beta1().ArangoPlatformServices(namespace), func(result *platformApi.ArangoPlatformServiceList) []*platformApi.ArangoPlatformService {
53+
q := make([]*platformApi.ArangoPlatformService, len(result.Items))
54+
55+
for id, e := range result.Items {
56+
q[id] = e.DeepCopy()
57+
}
58+
59+
return q
60+
})
61+
if err != nil {
62+
return nil, err
63+
}
64+
65+
return util.ListAsMap(l, func(in *platformApi.ArangoPlatformService) string {
66+
return in.GetName()
67+
}), nil
68+
}

pkg/util/k8sutil/helm/package.go

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@ import (
2525
"encoding/base64"
2626
goStrings "strings"
2727

28-
"helm.sh/helm/v3/pkg/action"
29-
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
30-
3128
platformApi "github.com/arangodb/kube-arangodb/pkg/apis/platform/v1beta1"
3229
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
3330
"github.com/arangodb/kube-arangodb/pkg/util"
34-
utilConstants "github.com/arangodb/kube-arangodb/pkg/util/constants"
3531
"github.com/arangodb/kube-arangodb/pkg/util/errors"
3632
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
3733
)
@@ -176,16 +172,12 @@ func (p PackageRelease) Validate() error {
176172
}
177173

178174
func NewPackage(ctx context.Context, client kclient.Client, namespace, deployment string) (*Package, error) {
179-
hclient, err := NewClient(Configuration{
180-
Namespace: namespace,
181-
Config: client.Config(),
182-
Driver: nil,
183-
})
175+
charts, err := GetLocalCharts(ctx, client, namespace)
184176
if err != nil {
185177
return nil, err
186178
}
187179

188-
charts, err := GetLocalCharts(ctx, client, namespace)
180+
services, err := GetLocalServices(ctx, client, namespace)
189181
if err != nil {
190182
return nil, err
191183
}
@@ -198,7 +190,8 @@ func NewPackage(ctx context.Context, client kclient.Client, namespace, deploymen
198190

199191
for name, c := range charts {
200192
if !c.Status.Conditions.IsTrue(platformApi.ReadyCondition) {
201-
return nil, errors.Errorf("Chart `%s` is not in ready condition", name)
193+
logger.Warn("Chart %s is not ready", name)
194+
continue
202195
}
203196

204197
if info := c.Status.Info; info != nil {
@@ -210,46 +203,17 @@ func NewPackage(ctx context.Context, client kclient.Client, namespace, deploymen
210203
}
211204
}
212205
}
206+
}
213207

214-
existingReleases, err := hclient.List(ctx, func(in *action.List) {
215-
in.Selector = meta.FormatLabelSelector(&meta.LabelSelector{
216-
MatchLabels: map[string]string{
217-
utilConstants.HelmLabelArangoDBManaged: "true",
218-
utilConstants.HelmLabelArangoDBDeployment: deployment,
219-
utilConstants.HelmLabelArangoDBChart: name,
220-
utilConstants.HelmLabelArangoDBType: "platform",
221-
},
222-
})
223-
})
224-
if err != nil {
225-
logger.Err(err).Error("Unable to list releases")
226-
return nil, err
208+
for name, c := range services {
209+
if !c.Status.Conditions.IsTrue(platformApi.ReadyCondition) {
210+
logger.Warn("Service %s is not ready", name)
211+
continue
227212
}
228213

229-
for _, release := range existingReleases {
230-
var r PackageRelease
231-
232-
r.Package = name
233-
234-
data, err := release.Values.Marshal()
235-
if err != nil {
236-
logger.Err(err).Error("Unable to unmarshal values")
237-
return nil, err
238-
}
239-
240-
delete(data, "arangodb_platform")
241-
242-
if len(data) != 0 {
243-
values, err := NewValues(data)
244-
if err != nil {
245-
logger.Err(err).Error("Unable to marshal values")
246-
return nil, err
247-
}
248-
249-
r.Overrides = values
250-
}
251-
252-
out.Releases[release.Name] = r
214+
out.Releases[name] = PackageRelease{
215+
Package: c.Status.Chart.GetName(),
216+
Overrides: Values(c.Spec.Values),
253217
}
254218
}
255219

0 commit comments

Comments
 (0)