Skip to content

loadbalancer_sg: nil-check subnet.Extract result#3105

Open
SAY-5 wants to merge 1 commit intokubernetes:masterfrom
SAY-5:fix/lb-sg-subnet-nil-3101
Open

loadbalancer_sg: nil-check subnet.Extract result#3105
SAY-5 wants to merge 1 commit intokubernetes:masterfrom
SAY-5:fix/lb-sg-subnet-nil-3101

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 2, 2026

What this PR does / why we need it:

subnets.Get(...).Extract() can return a nil Subnet with no error in some OpenStack misconfigurations. Dereferencing subnet.CIDR then SIGSEGVs the OCCM service worker into CrashLoopBackOff. This adds a nil check that treats the nil result as not-found and continues, matching the existing 404 path.

Which issue this PR fixes(if applicable):
fixes #3101

Special notes for reviewers:
The Subnet field on the gophercloud GetResult is a pointer and can be nil even when Extract() returns no error: https://github.com/gophercloud/gophercloud/blob/f4ea62fe7ab75f55496aeaad98a0859170b546eb/openstack/networking/v2/subnets/results.go#L17-L21

Release note:

[openstack-cloud-controller-manager] Fix nil-pointer panic in loadbalancer security-group reconciler when subnets.Get returns a nil Subnet with no error.

@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 2, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @SAY-5!

It looks like this is your first PR to kubernetes/cloud-provider-openstack 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/cloud-provider-openstack has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 2, 2026
@k8s-ci-robot k8s-ci-robot requested review from anguslees and zetaab May 2, 2026 09:38
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign anguslees for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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
Copy link
Copy Markdown
Contributor

Hi @SAY-5. Thanks for your PR.

I'm waiting for a kubernetes 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.

Details

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.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 2, 2026
@stephenfin
Copy link
Copy Markdown
Member

The fix seems reasonable given the Subnet field is a pointer and potentially nil.

However, you need to fix the commit message and add the missing release note section to the PR summary before we can test and merge this.

return fmt.Errorf(
"failed to find subnet %s from openstack: %v", svcConf.lbMemberSubnetID, err)
}
if subnet == nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IMHO this check needs to be implemented in gophercloud

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good point

Refs kubernetes#3101. subnets.Get(...).Extract() can return a nil Subnet with no error in some OpenStack misconfigurations, and dereferencing subnet.CIDR then SIGSEGVs the OCCM service worker into CrashLoopBackOff. Treat the nil result as not-found and continue.

Signed-off-by: SAY-5 <say.apm35@gmail.com>
@SAY-5 SAY-5 force-pushed the fix/lb-sg-subnet-nil-3101 branch from aba0c73 to c52bd29 Compare May 5, 2026 21:24
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 5, 2026
@SAY-5
Copy link
Copy Markdown
Author

SAY-5 commented May 5, 2026

Updated commit message + added release note. Thanks @stephenfin!

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

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[occm] openstack.(*LbaasV2).ensureAndUpdateOctaviaSecurityGroup encounters SIGSEGV

4 participants