8000 [Bugfix] Use Profile Annotations by ajanikow · Pull Request #1835 · arangodb/kube-arangodb · GitHub
[go: up one dir, main page]

Skip to content

[Bugfix] Use Profile Annotations #1835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Log

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

## [1.2.46](https://github.com/arangodb/kube-arangodb/tree/1.2.46) (2025-02-24)
- (Bugfix) Clean Phase change properly during upgrade
Expand Down
4 changes: 2 additions & 2 deletions docs/integration-sidecar.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ In order to inject specific profiles to the pod use label (split by `,`):

```yaml
metadata:
labels:
annotations:
profiles.arangodb.com/profiles: "gpu"
```

or

```yaml
metadata:
labels:
annotations:
profiles.arangodb.com/profiles: "gpu,internal"
```

Expand Down
6 changes: 4 additions & 2 deletions pkg/handlers/scheduler/webhooks/policies/handler.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
// Copyright 2024-2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -75,6 +75,7 @@ func (h handler) Mutate(ctx context.Context, log logging.Logger, t webhook.Admis
}

labels := new.GetLabels()
annotations := new.GetAnnotations()

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

profiles := util.FilterList(util.FormatList(strings.Split(labels[constants.ProfilesList], ","), func(s string) string {
allProfiles := util.FlattenLists(strings.Split(labels[constants.ProfilesList], ","), strings.Split(annotations[constants.ProfilesList], ","))
profiles := util.FilterList(util.FormatList(allProfiles, func(s string) string {
return strings.TrimSpace(s)
}), func(s string) bool {
return s != ""
Expand Down
6 changes: 5 additions & 1 deletion pkg/util/list.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2023-2024 ArangoDB GmbH, Cologne, Germany
// Copyright 2023-2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -191,3 +191,7 @@ func FlattenList[A any](in [][]A) []A {

return res
}

func FlattenLists[A any](in ...[]A) []A {
return FlattenList(in)
}
0