Skip to content
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

🐛 When infrastructureRef is nil, set InfrastructureReadyCondition to true #10909

Merged

Conversation

vincepri
Copy link
Member

… to true

Some clients, like MachineHealthCheck are checking this condition to continue operations. Set it for backward compatibility

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):
Fixes #

/area api

@k8s-ci-robot k8s-ci-robot added the area/api Issues or PRs related to the APIs label Jul 19, 2024
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 19, 2024
@vincepri
Copy link
Member Author

/cherry-pick release-1.7

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 19, 2024
@k8s-infra-cherrypick-robot

@vincepri: once the present PR merges, I will cherry-pick it on top of release-1.7 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.7

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.

@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member

sbueringer commented Jul 19, 2024

Change makes sense to me

@fabriziopandini
Copy link
Member

lgtm pending fixing the linter error

…true

Some clients, like MachineHealthCheck are checking this condition to
continue operations. Set it for backward compatibility

Signed-off-by: Vince Prignano <[email protected]>
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 19, 2024
@@ -172,6 +172,50 @@ func TestClusterReconciler(t *testing.T) {
}, timeout).Should(BeTrue())
})

t.Run("Should successfully patch a cluster object if the spec diff is empty but the status conditions diff is not", func(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you provide some context what use case this test is testing?

Copy link
Member

Choose a reason for hiding this comment

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

This seems to be some other controller also patching InfrastructureReady to true in parallel to the cluster controller?

Copy link
Member Author

Choose a reason for hiding this comment

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

I only added it for completeness, seems this really tests the patch helper?

Copy link
Member Author

Choose a reason for hiding this comment

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

The same test, but for cluster.Status.InfrastructureReady = true is above this one

Copy link
Member

@sbueringer sbueringer Jul 22, 2024

Choose a reason for hiding this comment

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

Ah, I didn't realize this is ~ a copy of an existing test :D

I was wondering what use case you're trying to test here :)

g.Eventually(func() bool {
ph, err := patch.NewHelper(cluster, env)
g.Expect(err).ToNot(HaveOccurred())
conditions.MarkTrue(cluster, clusterv1.InfrastructureReadyCondition)
Copy link
Member

Choose a reason for hiding this comment

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

Is this a diff? Isn't the cluster controller also setting this condition to true in reconcile?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is the controller running? Wouldn't the above patch also be the same?

Copy link
Member

Choose a reason for hiding this comment

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

l.192 seems to suggest that the controller is running :)

Copy link
Member

Choose a reason for hiding this comment

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

Ran both tests through the debugger. The patch here is literally a no-op (same in the pre-existing test)

@sbueringer
Copy link
Member

Let's merge this PR to unblock the definitely good & useful change. Let's continue to discuss the unit test and then follow-up if necessart

/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 22, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 53ca4145c2927b93bbabd9117c975669fad07b99

@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 Jul 22, 2024
@k8s-ci-robot k8s-ci-robot merged commit 38e89de into kubernetes-sigs:main Jul 22, 2024
21 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.8 milestone Jul 22, 2024
@k8s-infra-cherrypick-robot

@vincepri: new pull request created: #10921

In response to this:

/cherry-pick release-1.7

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.

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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants