Skip to content

Commit

Permalink
Removed +required tag from ExtensionServiceReference.Name
Browse files Browse the repository at this point in the history
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, <nil>:
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 <[email protected]>
  • Loading branch information
tsaarni committed Sep 9, 2024
1 parent bc4adee commit de3bbd0
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 31 deletions.
1 change: 0 additions & 1 deletion apis/projectcontour/v1/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
6 changes: 0 additions & 6 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down
6 changes: 0 additions & 6 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down
6 changes: 0 additions & 6 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down
6 changes: 0 additions & 6 deletions examples/render/contour-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down
6 changes: 0 additions & 6 deletions examples/render/contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down Expand Up @@ -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: |-
Expand Down

0 comments on commit de3bbd0

Please sign in to comment.