Skip to content

Commit

Permalink
Fix adding labels and annotations to a resource that didn't have any
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecat committed Feb 12, 2018
1 parent 54aebed commit d082b8f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kubernetes/patch_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ func diffStringMap(pathPrefix string, oldV, newV map[string]interface{}) PatchOp

pathPrefix = strings.TrimRight(pathPrefix, "/")

// If old value was empty, just create the object
if len(oldV) == 0 {
ops = append(ops, &AddOperation{
Path: pathPrefix,
Value: newV,
})
return ops
}

// This is suboptimal for adding whole new map from scratch
// or deleting the whole map, but it's actually intention.
// There may be some other map items managed outside of TF
Expand Down

0 comments on commit d082b8f

Please sign in to comment.