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

[release-1.4] šŸ› controlplane: prevent nil pointer exception in kcp controller when inā€¦ #8991

Merged

Conversation

chrischdi
Copy link
Member

ā€¦framachine does not exist for machine

What this PR does / why we need it:

This is a manual cherry-pick of changes which are already on main via https://github.com/kubernetes-sigs/cluster-api/pull/8940/files#diff-47cf5969a7a97b70232c5d97b882424745bd1ed511b29aa56f55194688ab833cR631-R634

It fixes a nil pointer by checking if the infraObject is nil.

This could maybe happen e.g. when the InfraMachine has a DeletionTimestamp.

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 #8989

The bug was introduced via the label propagation changes for v1.4, so previous versions should not be affected.

Also this is already fixed on main. This change is a manual cherry-pick of the related changes.

@k8s-ci-robot k8s-ci-robot added this to the v1.4 milestone Jul 11, 2023
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 11, 2023
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 11, 2023
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

Generally lgtm, would it be possible to add a test case that replicates the nil exception?

@chrischdi
Copy link
Member Author

Adjusted the existing test to also catch this case.

@chrischdi
Copy link
Member Author

Also created a PR for main which adds the same test: #8992

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve
/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 12, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 1a31b4cd1412baf7c56c9ca88d9968098e91cb6f

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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 12, 2023
@k8s-ci-robot k8s-ci-robot merged commit 3785302 into kubernetes-sigs:release-1.4 Jul 12, 2023
21 checks passed
@chrischdi chrischdi deleted the pr-capkcp-nil-fix branch July 12, 2023 16:56
@chrischdi
Copy link
Member Author

/area provider/control-plane-kubeadm

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/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/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.

None yet

3 participants