fix: tenant owners cannot replace protected namesapce labels or annotations

This commit is contained in:
Dario Tranchitella
2022-07-22 19:29:27 +00:00
parent 3a174bf755
commit d84f0be76b
+2 -2
View File
@@ -115,7 +115,7 @@ func (r *userMetadataHandler) OnUpdate(client client.Client, decoder *admission.
var labels, annotations map[string]string
for key, value := range newNs.GetLabels() {
if _, ok := oldNs.GetLabels()[key]; !ok {
if _, ok := oldNs.GetLabels()[key]; ok {
if labels == nil {
labels = make(map[string]string)
}
@@ -125,7 +125,7 @@ func (r *userMetadataHandler) OnUpdate(client client.Client, decoder *admission.
}
for key, value := range newNs.GetAnnotations() {
if _, ok := oldNs.GetAnnotations()[key]; !ok {
if _, ok := oldNs.GetAnnotations()[key]; ok {
if annotations == nil {
annotations = make(map[string]string)
}