@@ -106,19 +106,6 @@ func (v *NIMServiceCustomValidator) ValidateCreate(_ context.Context, obj runtim
106106
107107// ValidateUpdate implements webhook.CustomValidator so a webhook will be registered for the type NIMService.
108108func (v * NIMServiceCustomValidator ) ValidateUpdate (_ context.Context , oldObj , newObj runtime.Object ) (admission.Warnings , error ) {
109- nimservice , ok := newObj .(* appsv1alpha1.NIMService )
110- if ! ok {
111- return nil , fmt .Errorf ("expected a NIMService object for the newObj but got %T" , newObj )
112- }
113- nimservicelog .V (4 ).Info ("Validation for NIMService upon update" , "name" , nimservice .GetName ())
114-
115- fldPath := field .NewPath ("nimservice" ).Child ("spec" )
116- // Start with structural validation to ensure the updated object is well formed.
117- warningList , errList := validateNIMServiceSpec (& nimservice .Spec , fldPath , v .k8sVersion )
118-
119- // All fields of NIMService.Spec are mutable, except for:
120- // - Spec.MultiNode
121- // - If PVC has been created with PVC.Create = true, reject any updates to any fields of PVC object
122109 oldNIMService , ok := oldObj .(* appsv1alpha1.NIMService )
123110 if ! ok {
124111 return nil , fmt .Errorf ("expected a NIMService object for oldObj but got %T" , oldObj )
@@ -127,6 +114,11 @@ func (v *NIMServiceCustomValidator) ValidateUpdate(_ context.Context, oldObj, ne
127114 if ! ok {
128115 return nil , fmt .Errorf ("expected a NIMService object for newObj but got %T" , newObj )
129116 }
117+ nimservicelog .V (4 ).Info ("Validation for NIMService upon update" , "name" , newNIMService .GetName ())
118+
119+ fldPath := field .NewPath ("nimservice" ).Child ("spec" )
120+ // Start with structural validation to ensure the updated object is well formed.
121+ warningList , errList := validateNIMServiceSpec (& newNIMService .Spec , fldPath , v .k8sVersion )
130122
131123 wList , eList := validateMultiNodeImmutability (oldNIMService , newNIMService , field .NewPath ("spec" ).Child ("multiNode" ))
132124 warningList = append (warningList , wList ... )
0 commit comments