@@ -59,48 +59,55 @@ func (p *HelmReleaseProxy) Default() {
5959var _ webhook.Validator = & HelmReleaseProxy {}
6060
6161// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
62- func (r * HelmReleaseProxy ) ValidateCreate () (admission.Warnings , error ) {
63- helmreleaseproxylog .Info ("validate create" , "name" , r .Name )
62+ func (p * HelmReleaseProxy ) ValidateCreate () (admission.Warnings , error ) {
63+ helmreleaseproxylog .Info ("validate create" , "name" , p .Name )
6464
6565 // TODO(user): fill in your validation logic upon object creation.
6666 return nil , nil
6767}
6868
6969// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
70- func (r * HelmReleaseProxy ) ValidateUpdate (oldRaw runtime.Object ) (admission.Warnings , error ) {
71- helmreleaseproxylog .Info ("validate update" , "name" , r .Name )
70+ func (p * HelmReleaseProxy ) ValidateUpdate (oldRaw runtime.Object ) (admission.Warnings , error ) {
71+ helmreleaseproxylog .Info ("validate update" , "name" , p .Name )
7272
7373 var allErrs field.ErrorList
7474 old , ok := oldRaw .(* HelmReleaseProxy )
7575 if ! ok {
7676 return nil , apierrors .NewBadRequest (fmt .Sprintf ("expected a HelmReleaseProxy but got a %T" , old ))
7777 }
7878
79- if ! reflect .DeepEqual (r .Spec .RepoURL , old .Spec .RepoURL ) {
79+ if ! reflect .DeepEqual (p .Spec .RepoURL , old .Spec .RepoURL ) {
8080 allErrs = append (allErrs ,
8181 field .Invalid (field .NewPath ("spec" , "RepoURL" ),
82- r .Spec .RepoURL , "field is immutable" ),
82+ p .Spec .RepoURL , "field is immutable" ),
8383 )
8484 }
8585
86- if ! reflect .DeepEqual (r .Spec .ChartName , old .Spec .ChartName ) {
86+ if ! reflect .DeepEqual (p .Spec .ChartName , old .Spec .ChartName ) {
8787 allErrs = append (allErrs ,
8888 field .Invalid (field .NewPath ("spec" , "ChartName" ),
89- r .Spec .ChartName , "field is immutable" ),
89+ p .Spec .ChartName , "field is immutable" ),
9090 )
9191 }
9292
93- if ! reflect .DeepEqual (r .Spec .ReleaseNamespace , old .Spec .ReleaseNamespace ) {
93+ if ! reflect .DeepEqual (p .Spec .ReleaseNamespace , old .Spec .ReleaseNamespace ) {
9494 allErrs = append (allErrs ,
9595 field .Invalid (field .NewPath ("spec" , "ReleaseNamespace" ),
96- r .Spec .ReleaseNamespace , "field is immutable" ),
96+ p .Spec .ReleaseNamespace , "field is immutable" ),
97+ )
98+ }
99+
100+ if p .Spec .ReconcileStrategy != old .Spec .ReconcileStrategy {
101+ allErrs = append (allErrs ,
102+ field .Invalid (field .NewPath ("spec" , "ReconcileStrategy" ),
103+ p .Spec .ReconcileStrategy , "field is immutable" ),
97104 )
98105 }
99106
100107 // TODO: add webhook for ReleaseName. Currently it's being set if the release name is generated.
101108
102109 if len (allErrs ) > 0 {
103- return nil , apierrors .NewInvalid (GroupVersion .WithKind ("HelmReleaseProxy" ).GroupKind (), r .Name , allErrs )
110+ return nil , apierrors .NewInvalid (GroupVersion .WithKind ("HelmReleaseProxy" ).GroupKind (), p .Name , allErrs )
104111 }
105112
106113 return nil , nil
0 commit comments