Skip to content

Commit ac5456d

Browse files
authored
[Feature] Allow replace on empty annotations (#644)
1 parent 02f651c commit ac5456d

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
@@ -7,6 +7,7 @@
77
- Fix Upgrade procedure to safely evict pods during upgrade
88
- Fix Panics in Deployments without authentication
99
- Fix ChaosMonkey mode
10+
- Allow append on empty annotations
1011

1112
## [1.0.8](https://github.com/arangodb/kube-arangodb/tree/1.0.8) (2020-09-10)
1213
- 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)