-
Notifications
You must be signed in to change notification settings - 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
⚠️ Align Spec fields to optionalfields API conventions #12431
Conversation
/test pull-cluster-api-e2e-main |
e0ec217
to
dbe8095
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold
for discussion
@@ -1184,8 +1185,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 comment
The 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 comment
The 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 comment
The 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 comment
The 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 comment
The 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)
/test pull-cluster-api-e2e-main |
dbe8095
to
14067e6
Compare
/test pull-cluster-api-e2e-main |
api/controlplane/kubeadm/v1beta2/kubeadmcontrolplanetemplate_types.go
Outdated
Show resolved
Hide resolved
// +optional | ||
Spec KubeadmControlPlaneTemplateResourceSpec `json:"spec,omitempty,omitzero"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Verified it is actually optional
@@ -1184,8 +1185,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 comment
The 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
9e87ba6
to
b51663d
Compare
b51663d
to
c099e66
Compare
Rebased on top of main |
/test pull-cluster-api-e2e-main |
c099e66
to
d35e8dc
Compare
341c983
to
717a702
Compare
/test pull-cluster-api-e2e-main |
717a702
to
8573573
Compare
/test pull-cluster-api-e2e-main |
Great Job! /lgtm |
LGTM label has been added. Git tree hash: d09fe1cfe1fc6574f218cdf476f0b8852b8361a7
|
/override pull-cluster-api-e2e-main Unrelated flake. I have a PR stacked on top of this and the test there is green (but also a bit flaky sometimes) EDIT: This test (https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/kubernetes-sigs_cluster-api/12431/pull-cluster-api-e2e-main/1940969900210130944) became flaky very recently across all our branches (including release-1.10 / release-1.9 / release-1.8). So entirely unrelated to this PR. |
@sbueringer: Overrode contexts on behalf of sbueringer: pull-cluster-api-e2e-main In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Going to merge this one so we can already review #12299 more easily (Fabrizio is on PTO next week) @JoelSpeed If you have further findings, just let me know and I'll follow-up quickly /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Part of #10852