Skip to content

⚠️ Change User.PasswdFrom from *PasswdSource to PasswdSource + add omitzero, extend SSA patch helper to handle arrays #12560

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

Merged
merged 1 commit into from
Aug 1, 2025

Conversation

sbueringer
Copy link
Member

@sbueringer sbueringer commented Jul 31, 2025

What this PR does / why we need it:

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 31, 2025
@k8s-ci-robot k8s-ci-robot added do-not-merge/needs-area PR is missing an area label size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 31, 2025
@sbueringer sbueringer added area/provider/control-plane-kubeadm Issues or PRs related to KCP area/provider/bootstrap-kubeadm Issues or PRs related to CAPBK labels Jul 31, 2025
@k8s-ci-robot k8s-ci-robot removed do-not-merge/needs-area PR is missing an area label labels Jul 31, 2025
@sbueringer
Copy link
Member Author

/assign @JoelSpeed @fabriziopandini

@sbueringer
Copy link
Member Author

/hold
Merging the bigger one PR first :)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 31, 2025
@sbueringer
Copy link
Member Author

/test pull-cluster-api-e2e-main-gke

@@ -211,6 +211,10 @@ linters:
- kubeapilinter

# TODO: Excludes that should be removed once https://github.com/kubernetes-sigs/kube-api-linter/issues/132 will be fixed
- path: "api/.*"
text: "optionalfields: field (.*) is optional and (should have the omitempty tag|should be a pointer)"
Copy link
Contributor

Choose a reason for hiding this comment

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

This disables the whole linter practically?

Are we on the latest KAL?

Copy link
Member Author

Choose a reason for hiding this comment

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

KAL main had some other issues

Copy link
Member Author

Choose a reason for hiding this comment

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

With KAL main I'm getting these:

api/core/v1beta2/clusterclass_types.go:285:2: optionalfields: field TemplateRef is optional and should have the omitempty tag (kubeapilinter)
        TemplateRef MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty,omitzero"`
        ^
api/core/v1beta2/clusterclass_types.go:564:2: optionalfields: field TemplateRef is optional and should have the omitempty tag (kubeapilinter)
        TemplateRef MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty,omitzero"`
        ^
api/core/v1beta2/clusterclass_types.go:1020:2: optionalfields: field XMetadata is optional and should have the omitempty tag (kubeapilinter)
        XMetadata VariableSchemaMetadata `json:"x-metadata,omitempty,omitzero"`
        ^
api/core/v1beta2/machine_types.go:522:2: optionalfields: field NodeRef is optional and should have the omitempty tag (kubeapilinter)
        NodeRef MachineNodeReference `json:"nodeRef,omitempty,omitzero"`
        ^
api/core/v1beta2/machine_types.go:714:2: optionalfields: field ConfigRef is optional and should have the omitempty tag (kubeapilinter)
        ConfigRef ContractVersionedObjectReference `json:"configRef,omitempty,omitzero"`
        ^
api/core/v1beta2/machinehealthcheck_types.go:131:2: optionalfields: field TemplateRef is optional and should have the omitempty tag (kubeapilinter)
        TemplateRef MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty,omitzero"`
        ^
api/runtime/v1beta2/extensionconfig_types.go:77:2: optionalfields: field Service is optional and should have the omitempty tag (kubeapilinter)
        Service ServiceReference `json:"service,omitempty,omitzero"`
        ^

... (34x overall, basically all fixed fields)

I dont' remember if KAL v0.0.0-20250723124831-1b29e82a0f55 produces the exact same findings, the exclude captures both.

WIth your required-field branch these false positives go away

Copy link
Member Author

@sbueringer sbueringer Jul 31, 2025

Choose a reason for hiding this comment

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

Hm also these I think (but I think that was with the version currently on this branch)

api/runtime/v1beta2/extensionconfig_types.go:77:2: optionalfields: field Service is optional and has a valid zero value ({}), but the validation is not complete (e.g. min properties/adding required fields). The field should be a pointer to allow the zero value to be set. If the zero value is not a valid use case, complete the validation and remove the pointer. (kubeapilinter)
        Service ServiceReference `json:"service,omitempty,omitzero"`

Copy link
Member Author

@sbueringer sbueringer Jul 31, 2025

Choose a reason for hiding this comment

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

I'll open a WIP PR tomorrow with cleaned up excludes with your required fields branch

Copy link
Member Author

Choose a reason for hiding this comment

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

(This diff is now gone from this PR after rebase)

Copy link
Member Author

Choose a reason for hiding this comment

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

PR with clean excludes based on your required-fields-v2 branch: #12563

@fabriziopandini
Copy link
Member

lgtm pending rebase

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2025
…ero, extend SSA patch helper to handle arrays
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2025
@sbueringer
Copy link
Member Author

/test pull-cluster-api-e2e-main-gke

@k8s-ci-robot
Copy link
Contributor

@sbueringer: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-apidiff-main aad7f3c link false /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

/lgtm

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

LGTM label has been added.

Git tree hash: 7ba6868490c8f0f7c4523c1aec86d5ae6fc4bd83

@sbueringer
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 31, 2025
@JoelSpeed
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed

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 Aug 1, 2025
@k8s-ci-robot k8s-ci-robot merged commit 37e5033 into kubernetes-sigs:main Aug 1, 2025
18 of 19 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.11 milestone Aug 1, 2025
@sbueringer sbueringer deleted the pr-passwd-ssa branch August 1, 2025 10:01
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/provider/bootstrap-kubeadm Issues or PRs related to CAPBK area/provider/control-plane-kubeadm Issues or PRs related to KCP 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants