diff --git a/pkg/webhook/namespace/user_metadata.go b/pkg/webhook/namespace/user_metadata.go index 2a90df1ea..41b79d43d 100644 --- a/pkg/webhook/namespace/user_metadata.go +++ b/pkg/webhook/namespace/user_metadata.go @@ -135,6 +135,14 @@ func (r *userMetadataHandler) OnUpdate(client client.Client, decoder *admission. labels, annotations := oldNs.GetLabels(), oldNs.GetAnnotations() + if labels == nil { + labels = make(map[string]string) + } + + if annotations == nil { + annotations = make(map[string]string) + } + for key, value := range newNs.GetLabels() { v, ok := labels[key] if !ok {