Skip to content

Commit

Permalink
Preserve existing annotations in submitted pod (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
asaintsever authored Nov 11, 2021
1 parent a33ebf9 commit 830a4a9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- [OVAI #2](https://github.com/asaintsever/open-vault-agent-injector/pull/2) - Add issuer on [vault k8s config](https://www.vaultproject.io/docs/auth/kubernetes#discovering-the-service-account-issuer) for Kubernetes 1.21+

**Fixed**

- [OVAI #3](https://github.com/asaintsever/open-vault-agent-injector/pull/3) - Preserve existing annotations in submitted pod

## Release v1.0.0 - 2021-09-21

**Changed**
Expand Down
2 changes: 1 addition & 1 deletion VERSION_CHART
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1
2 changes: 1 addition & 1 deletion VERSION_OVAI
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1
11 changes: 4 additions & 7 deletions pkg/webhook/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,15 @@ Loop:
func updateAnnotation(target map[string]string, added map[string]string) (patch []ctx.PatchOperation) {
for key, value := range added {
if target == nil || target[key] == "" {
target = map[string]string{}
patch = append(patch, ctx.PatchOperation{
Op: ctx.JsonPatchOpAdd,
Path: ctx.JsonPathAnnotations,
Value: map[string]string{
key: value,
},
Op: ctx.JsonPatchOpAdd,
Path: ctx.JsonPathAnnotations + "/" + strings.Replace(key, "/", "~1", -1), // as per http://jsonpatch.com/#json-pointer
Value: value,
})
} else {
patch = append(patch, ctx.PatchOperation{
Op: ctx.JsonPatchOpReplace,
Path: ctx.JsonPathAnnotations + "/" + key,
Path: ctx.JsonPathAnnotations + "/" + strings.Replace(key, "/", "~1", -1), // as per http://jsonpatch.com/#json-pointer
Value: value,
})
}
Expand Down

0 comments on commit 830a4a9

Please sign in to comment.