Skip to content

⚠️ Improve Cluster CRD Go type #12489

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 2 commits into from
Jul 16, 2025

Conversation

sbueringer
Copy link
Member

@sbueringer sbueringer commented Jul 14, 2025

What this PR does / why we need it:
Did an audit for the Cluster CRD go type and mostly removed unnecessary pointers to make it easier to use the type. This also lead to some changes in other types for consistency.

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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-area PR is missing an area label size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 14, 2025
@k8s-ci-robot k8s-ci-robot requested review from elmiko and g-gaston July 14, 2025 18:20
@sbueringer sbueringer force-pushed the pr-audit-cluster-type branch 3 times, most recently from 78f8bfd to 4e51eb8 Compare July 15, 2025 13:19
@sbueringer sbueringer added the area/api Issues or PRs related to the APIs label Jul 15, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/needs-area PR is missing an area label label Jul 15, 2025
@sbueringer sbueringer changed the title [WIP] ⚠️ Improve Cluster type ⚠️ Improve Cluster CRD Go type Jul 15, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2025
@sbueringer
Copy link
Member Author

/assign @JoelSpeed @fabriziopandini

@sbueringer sbueringer force-pushed the pr-audit-cluster-type branch from 8ac73bb to 5004212 Compare July 15, 2025 14:34
@sbueringer
Copy link
Member Author

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member Author

sbueringer commented Jul 15, 2025

@JoelSpeed Would be good if you can review the changes to the API

Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

API changes are good as far as I can see

@sbueringer
Copy link
Member Author

sbueringer commented Jul 15, 2025

Nice. Found an error in a ClusterClass through MinProperties (https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/kubernetes-sigs_cluster-api/12489/pull-cluster-api-e2e-main/1945129804692983808):

                    Causes: [
                        {
                            Type: "FieldValueInvalid",
                            Message: "Invalid value: 0: spec.workers.machineDeployments[0].machineHealthCheck in body should have at least 1 properties",
                            Field: "spec.workers.machineDeployments[0].machineHealthCheck",
                        },
                        {
                            Type: "FieldValueInvalid",
                            Message: "Invalid value: 0: spec.controlPlane.machineHealthCheck in body should have at least 1 properties",
                            Field: "spec.controlPlane.machineHealthCheck",
                        },
                    ],
I0715 16:13:34.559671   88756 warning_handler.go:64] "unknown field \"spec.controlPlane.machineHealthCheck.unhealthyConditions\""
I0715 16:13:34.559714   88756 warning_handler.go:64] "unknown field \"spec.workers.machineDeployments[0].machineHealthCheck.unhealthyConditions\""

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

API changes are good as far as I can see

Thank you!

/test pull-cluster-api-e2e-main

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jul 15, 2025

@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 474a36b 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.

@sbueringer
Copy link
Member Author

/override pull-cluster-api-e2e-main

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

@k8s-ci-robot
Copy link
Contributor

@sbueringer: Overrode contexts on behalf of sbueringer: pull-cluster-api-e2e-main

In response to this:

/override pull-cluster-api-e2e-main

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

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.

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.

Great to see improvements both on yaml and go types!

Comment on lines +2415 to +2417
allOf:
- minProperties: 1
- minProperties: 1
Copy link
Member

Choose a reason for hiding this comment

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

Looks like controller-gen is not de-duping.
Could you kindly double check this is not an issue + may be open and issue in controller-gen

Copy link
Member Author

@sbueringer sbueringer Jul 16, 2025

Choose a reason for hiding this comment

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

This works:

  1. The CRD can be deployed (the apiserver doesn't reject it)
  2. See ⚠️ Improve Cluster CRD Go type #12489 (comment)

Opened an issue: kubernetes-sigs/controller-tools#1234

@@ -118,7 +118,7 @@ spec:
kind: KubeadmControlPlaneTemplate
name: in-memory-control-plane
machineHealthCheck:
unhealthyConditions:
unhealthyNodeConditions:
Copy link
Member

Choose a reason for hiding this comment

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

nice catch!

@fabriziopandini
Copy link
Member

/lgtm
/approve

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

LGTM label has been added.

Git tree hash: 007bd1c3b4520ba4beb4f82087ea099033858a70

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 Jul 16, 2025
@k8s-ci-robot k8s-ci-robot merged commit cb05ce9 into kubernetes-sigs:main Jul 16, 2025
20 of 21 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.11 milestone Jul 16, 2025
@sbueringer sbueringer deleted the pr-audit-cluster-type branch July 16, 2025 08:40
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/api Issues or PRs related to the APIs 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/XXL Denotes a PR that changes 1000+ 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.

4 participants