@@ -77,6 +77,16 @@ func (ent *EnterpriseSearch) WebhookPath() string {
7777func (ent * EnterpriseSearch ) validate (old * EnterpriseSearch ) (admission.Warnings , error ) {
7878 var errors field.ErrorList
7979 var warnings admission.Warnings
80+
81+ // check if the version is deprecated
82+ deprecationWarnings , deprecationErrors := checkIfVersionDeprecated (ent )
83+ if deprecationErrors != nil {
84+ errors = append (errors , deprecationErrors ... )
85+ }
86+ if deprecationWarnings != "" {
87+ warnings = append (warnings , deprecationWarnings )
88+ }
89+
8090 if old != nil {
8191 for _ , uc := range updateChecks {
8292 if err := uc (old , ent ); err != nil {
@@ -85,7 +95,7 @@ func (ent *EnterpriseSearch) validate(old *EnterpriseSearch) (admission.Warnings
8595 }
8696
8797 if len (errors ) > 0 {
88- return nil , apierrors .NewInvalid (groupKind , ent .Name , errors )
98+ return warnings , apierrors .NewInvalid (groupKind , ent .Name , errors )
8999 }
90100 }
91101
@@ -95,15 +105,6 @@ func (ent *EnterpriseSearch) validate(old *EnterpriseSearch) (admission.Warnings
95105 }
96106 }
97107
98- // check if the version is deprecated
99- deprecationWarnings , deprecationErrors := checkIfVersionDeprecated (ent )
100- if deprecationErrors != nil {
101- errors = append (errors , deprecationErrors ... )
102- }
103- if deprecationWarnings != "" {
104- warnings = append (warnings , deprecationWarnings )
105- }
106-
107108 if len (errors ) > 0 {
108109 return warnings , apierrors .NewInvalid (groupKind , ent .Name , errors )
109110 }
0 commit comments