Skip to content

Commit 24d464a

Browse files
authored
[Bugfix] Fix labels propagation (#1004)
1 parent c0c98fd commit 24d464a

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

CHANGELOG.md

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

33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
44
- (Feature) Add ArangoSync TLS based rotation
5+
- (Bugfix) Fix labels propagation
56

67
## [1.2.13](https://github.com/arangodb/kube-arangodb/tree/1.2.13) (2022-06-07)
78
- (Bugfix) Fix arangosync members state inspection

pkg/deployment/resources/annotations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func ensureGroupLabelsMap(kind string, obj meta.Object, spec api.DeploymentSpec,
314314
func ensureLabelsMap(kind string, obj meta.Object, spec api.DeploymentSpec,
315315
patchCmd func(name string, d []byte) error) bool {
316316
expected := spec.Labels
317-
ignored := spec.AnnotationsIgnoreList
317+
ignored := spec.LabelsIgnoreList
318318

319319
mode := spec.LabelsMode.Get(getDefaultMode(expected))
320320

pkg/util/collection/map.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ import (
2929
)
3030

3131
const (
32-
kubernetesAnnotationMatch = ".*kubernetes\\.io/.*"
33-
arangoAnnotationMatch = ".*arangodb\\.com/.*"
32+
kubernetesIOMatch = ".*kubernetes\\.io/.*"
33+
arangoDBMatch = ".*arangodb\\.com/.*"
3434
)
3535

3636
var (
37-
kubernetesAnnotationRegex *regexp.Regexp
38-
arangoAnnotationRegex *regexp.Regexp
37+
kubernetesIORegex *regexp.Regexp
38+
arangoDBRegex *regexp.Regexp
3939

4040
reservedLabels = RestrictedList{
4141
k8sutil.LabelKeyArangoDeployment,
@@ -124,19 +124,19 @@ func (r RestrictedList) Filter(m map[string]string) map[string]string {
124124
}
125125

126126
func init() {
127-
r, err := regexp.Compile(kubernetesAnnotationMatch)
127+
r, err := regexp.Compile(kubernetesIOMatch)
128128
if err != nil {
129129
panic(err)
130130
}
131131

132-
kubernetesAnnotationRegex = r
132+
kubernetesIORegex = r
133133

134-
r, err = regexp.Compile(arangoAnnotationMatch)
134+
r, err = regexp.Compile(arangoDBMatch)
135135
if err != nil {
136136
panic(err)
137137
}
138138

139-
arangoAnnotationRegex = r
139+
arangoDBRegex = r
140140
}
141141

142142
func LabelsPatch(mode api.LabelsMode, expected map[string]string, actual map[string]string, ignored ...string) patch.Patch {
@@ -145,6 +145,14 @@ func LabelsPatch(mode api.LabelsMode, expected map[string]string, actual map[str
145145
return true
146146
}
147147

148+
if arangoDBRegex.MatchString(k) {
149+
return true
150+
}
151+
152+
if kubernetesIORegex.MatchString(k) {
153+
return true
154+
}
155+
148156
if NewRestrictedList(ignored...).IsRestricted(k) {
149157
return true
150158
}
@@ -155,11 +163,11 @@ func LabelsPatch(mode api.LabelsMode, expected map[string]string, actual map[str
155163

156164
func AnnotationsPatch(mode api.LabelsMode, expected map[string]string, actual map[string]string, ignored ...string) patch.Patch {
157165
return getFieldPatch(mode, "annotations", expected, actual, func(k, v string) bool {
158-
if kubernetesAnnotationRegex.MatchString(k) {
166+
if kubernetesIORegex.MatchString(k) {
159167
return true
160168
}
161169

162-
if arangoAnnotationRegex.MatchString(k) {
170+
if arangoDBRegex.MatchString(k) {
163171
return true
164172
}
165173

0 commit comments

Comments
 (0)