Skip to content

Commit 7bcbd2d

Browse files
authored
[Feature] [1.0] Allow replace on empty annotations (#645)
1 parent 1321cee commit 7bcbd2d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
44
- Fix Panics in Deployments without authentication
55
- Fix ChaosMonkey mode
6+
- Allow append on empty annotations
67

78
## [1.0.8](https://github.com/arangodb/kube-arangodb/tree/1.0.8) (2020-09-10)
89
- Fix Volume rotation on AKS

pkg/util/collection/map.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ func getFieldPatch(mode api.LabelsMode, section string, expected map[string]stri
160160
case api.LabelsDisabledMode:
161161
break
162162
case api.LabelsAppendMode:
163+
if len(actual) == 0 {
164+
return patch.NewPatch(patch.ItemReplace(patch.NewPath("metadata", section), expected))
165+
}
163166
for e, v := range expected {
164167
if a, ok := actual[e]; !ok {
165168
p.ItemAdd(patch.NewPath("metadata", section, e), v)
@@ -168,6 +171,9 @@ func getFieldPatch(mode api.LabelsMode, section string, expected map[string]stri
168171
}
169172
}
170173
case api.LabelsReplaceMode:
174+
if len(actual) == 0 {
175+
return patch.NewPatch(patch.ItemReplace(patch.NewPath("metadata", section), expected))
176+
}
171177
for e, v := range expected {
172178
if a, ok := actual[e]; !ok {
173179
p.ItemAdd(patch.NewPath("metadata", section, e), v)

0 commit comments

Comments
 (0)