Skip to content

Commit 8226121

Browse files
authored
[Bugfix] Use Profile Annotations (#1835)
1 parent 7b75f07 commit 8226121

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Change Log
22

33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
4+
- (Bugfix) Use Profile Annotations
45

56
## [1.2.46](https://github.com/arangodb/kube-arangodb/tree/1.2.46) (2025-02-24)
67
- (Bugfix) Clean Phase change properly during upgrade

docs/integration-sidecar.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ In order to inject specific profiles to the pod use label (split by `,`):
6262

6363
```yaml
6464
metadata:
65-
labels:
65+
annotations:
6666
profiles.arangodb.com/profiles: "gpu"
6767
```
6868

6969
or
7070

7171
```yaml
7272
metadata:
73-
labels:
73+
annotations:
7474
profiles.arangodb.com/profiles: "gpu,internal"
7575
```
7676

pkg/handlers/scheduler/webhooks/policies/handler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2024-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -75,6 +75,7 @@ func (h handler) Mutate(ctx context.Context, log logging.Logger, t webhook.Admis
7575
}
7676

7777
labels := new.GetLabels()
78+
annotations := new.GetAnnotations()
7879

7980
v := labels[constants.ProfilesDeployment]
8081
depl, err := h.client.Arango().DatabaseV1().ArangoDeployments(request.Namespace).Get(ctx, v, meta.GetOptions{})
@@ -89,7 +90,8 @@ func (h handler) Mutate(ctx context.Context, log logging.Logger, t webhook.Admis
8990
}, nil
9091
}
9192

92-
profiles := util.FilterList(util.FormatList(strings.Split(labels[constants.ProfilesList], ","), func(s string) string {
93+
allProfiles := util.FlattenLists(strings.Split(labels[constants.ProfilesList], ","), strings.Split(annotations[constants.ProfilesList], ","))
94+
profiles := util.FilterList(util.FormatList(allProfiles, func(s string) string {
9395
return strings.TrimSpace(s)
9496
}), func(s string) bool {
9597
return s != ""

pkg/util/list.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2023-2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2023-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -191,3 +191,7 @@ func FlattenList[A any](in [][]A) []A {
191191

192192
return res
193193
}
194+
195+
func FlattenLists[A any](in ...[]A) []A {
196+
return FlattenList(in)
197+
}

0 commit comments

Comments
 (0)