@@ -8,35 +8,12 @@ import (
88 "sigs.k8s.io/controller-runtime/pkg/client"
99
1010 sharedValidation "github.com/pdok/smooth-operator/pkg/validation"
11- apierrors "k8s.io/apimachinery/pkg/api/errors"
12- "k8s.io/apimachinery/pkg/runtime/schema"
1311 "k8s.io/apimachinery/pkg/util/validation/field"
1412 "k8s.io/utils/strings/slices"
1513)
1614
1715func (wms * WMS ) ValidateCreate (c client.Client ) ([]string , error ) {
18- warnings := []string {}
19- allErrs := field.ErrorList {}
20-
21- err := sharedValidation .ValidateLabelsOnCreate (wms .Labels )
22- if err != nil {
23- allErrs = append (allErrs , err )
24- }
25-
26- err = sharedValidation .ValidateIngressRouteURLsContainsBaseURL (wms .Spec .IngressRouteURLs , wms .URL (), nil )
27- if err != nil {
28- allErrs = append (allErrs , err )
29- }
30-
31- ValidateWMS (c , wms , & warnings , & allErrs )
32-
33- if len (allErrs ) == 0 {
34- return warnings , nil
35- }
36-
37- return warnings , apierrors .NewInvalid (
38- schema.GroupKind {Group : "pdok.nl" , Kind : "WMS" },
39- wms .Name , allErrs )
16+ return ValidateCreate (c , wms , ValidateWMS )
4017}
4118
4219func (wms * WMS ) ValidateUpdate (c client.Client , wmsOld * WMS ) ([]string , error ) {
@@ -46,7 +23,7 @@ func (wms *WMS) ValidateUpdate(c client.Client, wmsOld *WMS) ([]string, error) {
4623// TODO fix linting (cyclop,funlen)
4724//
4825//nolint:cyclop,funlen
49- func ValidateWMS (c client. Client , wms * WMS , warnings * []string , allErrs * field.ErrorList ) {
26+ func ValidateWMS (wms * WMS , warnings * []string , allErrs * field.ErrorList ) {
5027 if strings .Contains (wms .GetName (), "wms" ) {
5128 sharedValidation .AddWarning (
5229 warnings ,
@@ -306,8 +283,6 @@ func ValidateWMS(c client.Client, wms *WMS, warnings *[]string, allErrs *field.E
306283
307284 podSpecPatch := wms .Spec .PodSpecPatch
308285 ValidateEphemeralStorage (podSpecPatch , allErrs )
309-
310- ValidateOwnerInfo (c , wms , allErrs )
311286}
312287
313288func findEqualChildStyleNames (layer * Layer , equalStyleNames * map [string ][]string ) {
0 commit comments