Skip to content

Commit f39166a

Browse files
committed
[Feature] [Platform] Dump CLI switch to Services
1 parent 788269b commit f39166a

File tree

3 files changed

+32
-48
lines changed

3 files changed

+32
-48
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

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)