Skip to content

Conversation

@nayuta723
Copy link
Contributor

What this PR does / why we need it:
This PR introduces a new forbiddenmarkers linter check targeting the KubeadmConfigSpec struct and its nested fields. We've repeatedly encountered issues where adding new default values via OpenAPI markers (e.g., // +kubebuilder:default) leads to unintended KubeadmControlPlane (KCP) rollouts following a CAPI upgrade.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #8147

/area ci

@k8s-ci-robot k8s-ci-robot added area/ci Issues or PRs related to ci cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 13, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @nayuta723. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

linters:
- kubeapilinter

## Apply forbiddenmarkers only to api/bootstrap/kubeadm
Copy link
Member

@sbueringer sbueringer Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go one step further and block all defaulting (as we don't want to use OpenAPI defaulting at all nowadays)

I think we can drop this config here and then add an exclude for existing markers. If I see correctly there is only one usage of the default marker in v1beta2 today.
Let's add this exclude in its own section directly above "# TODO: Excludes that should be removed once the corresponding issues in KAL are fixed"

(v1beta1 is probably already excluded correctly in l.91++)

@sbueringer
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 13, 2025
Comment on lines 85 to 90
## Apply forbiddenmarkers only to api/bootstrap/kubeadm
- path-except: "api/bootstrap/kubeadm/.*"
text: "forbiddenmarkers"
linters:
- kubeapilinter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add other forbidden markers in the future, this will prevent them from being picked up in the wider APIs.

Have you considered making the text more specific to only pick up the default markers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nayuta723
Copy link
Contributor Author

@sbueringer @JoelSpeed
Thank you for the review. I've made the corrections, so please take a look.

@sbueringer sbueringer added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Oct 13, 2025
@sbueringer
Copy link
Member

/lgtm
/assign @JoelSpeed

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 13, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: c7c8dd56aec60c3c6d571efc47f4604cc5153642

@sivchari
Copy link
Member

/lgtm

@sbueringer
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 16, 2025
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last nits

@k8s-ci-robot k8s-ci-robot merged commit 8a02bd2 into kubernetes-sigs:main Oct 16, 2025
16 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.12 milestone Oct 16, 2025
@sbueringer
Copy link
Member

sbueringer commented Oct 16, 2025

Sorry shouldn't have approved and added comments. I'll follow-up :)

(xref: #12869)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/ci Issues or PRs related to ci cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add validation for KubeadmConfigSpec defaulting

5 participants