-
Couldn't load subscription status.
- Fork 1.4k
⚠️ Align Spec fields to optionalfields API conventions #12431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,7 @@ type KubeadmControlPlaneTemplate struct { | |
|
|
||
| // spec is the desired state of KubeadmControlPlaneTemplate. | ||
| // +optional | ||
| Spec KubeadmControlPlaneTemplateSpec `json:"spec,omitempty"` | ||
| Spec KubeadmControlPlaneTemplateSpec `json:"spec,omitempty,omitzero"` | ||
sbueringer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
@@ -67,15 +67,16 @@ func init() { | |
| } | ||
|
|
||
| // KubeadmControlPlaneTemplateResource describes the data needed to create a KubeadmControlPlane from a template. | ||
| // +kubebuilder:validation:MinProperties=1 | ||
| type KubeadmControlPlaneTemplateResource struct { | ||
| // metadata is the standard object's metadata. | ||
| // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata | ||
| // +optional | ||
| ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| // spec is the desired state of KubeadmControlPlaneTemplateResource. | ||
| // +required | ||
| Spec KubeadmControlPlaneTemplateResourceSpec `json:"spec"` | ||
| // +optional | ||
| Spec KubeadmControlPlaneTemplateResourceSpec `json:"spec,omitempty,omitzero"` | ||
|
Comment on lines
+78
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why change from required? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it actually is optional and I aligned this here to the same field in KubeadmConfigTemplate which is also optional There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verified it is actually optional |
||
| } | ||
|
|
||
| // KubeadmControlPlaneTemplateResourceSpec defines the desired state of KubeadmControlPlane. | ||
|
|
@@ -91,8 +92,8 @@ type KubeadmControlPlaneTemplateResourceSpec struct { | |
|
|
||
| // kubeadmConfigSpec is a KubeadmConfigSpec | ||
| // to use for initializing and joining machines to the control plane. | ||
| // +required | ||
| KubeadmConfigSpec bootstrapv1.KubeadmConfigSpec `json:"kubeadmConfigSpec"` | ||
| // +optional | ||
| KubeadmConfigSpec bootstrapv1.KubeadmConfigSpec `json:"kubeadmConfigSpec,omitempty,omitzero"` | ||
|
|
||
| // rolloutBefore is a field to indicate a rollout should be performed | ||
| // if the specified criteria is met. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -458,6 +458,7 @@ const ( | |
| // ANCHOR: ClusterSpec | ||
|
|
||
| // ClusterSpec defines the desired state of Cluster. | ||
| // +kubebuilder:validation:MinProperties=1 | ||
| type ClusterSpec struct { | ||
| // paused can be used to prevent controllers from processing the Cluster and all its associated objects. | ||
| // +optional | ||
|
|
@@ -1185,8 +1186,8 @@ type Cluster struct { | |
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| // spec is the desired state of Cluster. | ||
| // +optional | ||
| Spec ClusterSpec `json:"spec,omitempty"` | ||
| // +required | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. required because either Cluster.spec.topology or Cluster.spec.controlPlaneRef / infrastructureRef should be set. An empty Cluster does not work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that validated in a webhook currently? That should be easy to validate in CEL and would make it easier to appreciate that this rule exists There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, there is no validation today. Neither in OpenAPI validation nor in the webhook. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could probably build some ratcheting validation to enforce this in the future, something for the backlog maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, will track as a follow-up to improve this (we'll also write up the variations of infraRef/cpRef/topology being set/unset that make sense) |
||
| Spec ClusterSpec `json:"spec,omitempty,omitzero"` | ||
| // status is the observed state of Cluster. | ||
| // +optional | ||
| Status ClusterStatus `json:"status,omitempty,omitzero"` | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.