From de3bbd03083b69ef1a994da66bf80e732df271e3 Mon Sep 17 00:00:00 2001 From: Tero Saarni Date: Mon, 9 Sep 2024 10:23:20 +0300 Subject: [PATCH] Removed +required tag from ExtensionServiceReference.Name Starting with version v0.16.0 of controller-tool, the +required tag began being processed, leading to the inclusion of new "required" entries in CRDs. The ExtensionServiceReference is used in the AuthorizationServer as an optional field, but it is embedded as a struct rather than a pointer. This causes it to be included in requests even when not explicitly set. This resulted in the following error: HTTPProxy.projectcontour.io "external-auth" is invalid: [spec.virtualhost.authorization.extensionRef.name: Required value, : Invalid value: "null": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation] Ideally, HTTPProxy.Spec.VirtualHost.Authorization.ExtensionServiceRef should have been a pointer to make it truly optional. However, changing it to a pointer now would break backward compatibility. An alternative solution is to make ExtensionServiceReference.Name optional, which should be acceptable since the +required tag was never enforced by the CRD in the first place. Signed-off-by: Tero Saarni --- apis/projectcontour/v1/httpproxy.go | 1 - examples/contour/01-crds.yaml | 6 ------ examples/render/contour-deployment.yaml | 6 ------ examples/render/contour-gateway-provisioner.yaml | 6 ------ examples/render/contour-gateway.yaml | 6 ------ examples/render/contour.yaml | 6 ------ 6 files changed, 31 deletions(-) diff --git a/apis/projectcontour/v1/httpproxy.go b/apis/projectcontour/v1/httpproxy.go index 976795d6903..72ff28096d2 100644 --- a/apis/projectcontour/v1/httpproxy.go +++ b/apis/projectcontour/v1/httpproxy.go @@ -235,7 +235,6 @@ type ExtensionServiceReference struct { // // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names // - // +required // +kubebuilder:validation:MinLength=1 Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"` } diff --git a/examples/contour/01-crds.yaml b/examples/contour/01-crds.yaml index 263deaca6a8..120d436876b 100644 --- a/examples/contour/01-crds.yaml +++ b/examples/contour/01-crds.yaml @@ -682,8 +682,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -4486,8 +4484,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -7463,8 +7459,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- diff --git a/examples/render/contour-deployment.yaml b/examples/render/contour-deployment.yaml index 3622648f85e..2a58d134ad2 100644 --- a/examples/render/contour-deployment.yaml +++ b/examples/render/contour-deployment.yaml @@ -902,8 +902,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -4706,8 +4704,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -7683,8 +7679,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- diff --git a/examples/render/contour-gateway-provisioner.yaml b/examples/render/contour-gateway-provisioner.yaml index c1959dc485c..ad12d7023b2 100644 --- a/examples/render/contour-gateway-provisioner.yaml +++ b/examples/render/contour-gateway-provisioner.yaml @@ -693,8 +693,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -4497,8 +4495,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -7474,8 +7470,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- diff --git a/examples/render/contour-gateway.yaml b/examples/render/contour-gateway.yaml index 342939c7aab..e61577a61d3 100644 --- a/examples/render/contour-gateway.yaml +++ b/examples/render/contour-gateway.yaml @@ -718,8 +718,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -4522,8 +4520,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -7499,8 +7495,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- diff --git a/examples/render/contour.yaml b/examples/render/contour.yaml index 5e21b770065..493883e51b1 100644 --- a/examples/render/contour.yaml +++ b/examples/render/contour.yaml @@ -902,8 +902,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -4706,8 +4704,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |- @@ -7683,8 +7679,6 @@ spec: More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ minLength: 1 type: string - required: - - name type: object failOpen: description: |-