Fix AWSClusterControllerIdentity ValidateUpdate panic when AllowedNamespaces is nil
@@ -87,11 +87,13 @@ func (r *AWSClusterControllerIdentity) ValidateUpdate(old runtime.Object) error
r.Name, "AWSClusterControllerIdentity is a singleton and only acceptable name is default")
}
- // Validate selector parses as Selector
+ // Validate selector parses as Selector if AllowedNameSpaces is not nil
+ if r.Spec.AllowedNamespaces != nil {
_, err := metav1.LabelSelectorAsSelector(&r.Spec.AllowedNamespaces.Selector)
if err != nil {
return field.Invalid(field.NewPath("spec", "allowedNamespaces", "selectors"), r.Spec.AllowedNamespaces.Selector, err.Error())
}
+ }
return nil
}
