Skip to content

Reconcile OpenStack port additional security groups - #18732

Open
rdebnath-x-ion wants to merge 1 commit into
kubernetes:masterfrom
rdebnath-x-ion:paas-3687
Open

Reconcile OpenStack port additional security groups#18732
rdebnath-x-ion wants to merge 1 commit into
kubernetes:masterfrom
rdebnath-x-ion:paas-3687

Conversation

@rdebnath-x-ion

@rdebnath-x-ion rdebnath-x-ion commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What this does

Fixes reconciliation of an OpenStack Port's AdditionalSecurityGroups (extra, kOps-unmanaged security groups attached by name).

Two independent bugs are addressed:

  1. Drift was invisible (read path). newPortTaskFromCloud copied the desired AdditionalSecurityGroups into the actual state verbatim, without checking the port, so actual always equalled expected and a missing group was never detected. It now records an additional group in the actual state only if its ID is actually attached to the port.

  2. Changes were never applied (write path). RenderOpenstack had no code path to push a security-group change to an existing port — changes only took effect when an instance was recreated. It now, when the actual vs desired security groups differ, builds the merged set of managed + resolved additional security-group IDs and calls UpdatePort. Both kinds are sent together because OpenStack replaces the entire security-group set on update.

Change detection compares the actual and expected tasks directly rather than inspecting changes, because BuildChanges copies the expected value into changes for slice fields, making an emptied list indistinguishable there from an unchanged one.

Testing

  • New unit tests cover both paths: the read path drops additional groups not present on the port, and the write path issues a single UpdatePort with the merged managed + additional IDs.
  • Verified end-to-end against a live OpenStack cluster: adding/removing an additionalSecurityGroups entry is now applied to existing ports in place via UpdatePort, without a rolling-update.

Fixes #18731

@kubernetes-prow kubernetes-prow Bot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Aug 21, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 21, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: rdebnath-x-ion / name: Rounak Debnath (d518d95)

@kubernetes-prow kubernetes-prow Bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 21, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @rdebnath-x-ion. 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.

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Aug 21, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from hakman and olemarkus August 21, 2026 13:50
@kubernetes-prow kubernetes-prow Bot added the area/provider/openstack Issues or PRs related to openstack provider label Aug 21, 2026
@kubernetes-prow

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 olemarkus 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

@rdebnath-x-ion

Copy link
Copy Markdown
Contributor Author

/easycla

The OpenStack Port task tracks kOps-managed SecurityGroups and
user-supplied AdditionalSecurityGroups (by name). Two bugs prevented
AdditionalSecurityGroups from being reconciled on existing ports:

- newPortTaskFromCloud copied the desired AdditionalSecurityGroups into
  the actual state without checking the port, so drift was never
  detected.
- RenderOpenstack had no path to apply security-group changes to an
  existing port, so changes were only picked up when an instance was
  recreated.

Record an additional group in the actual state only when its ID is
actually attached to the port, and update the port in place via
UpdatePort with the merged managed + additional security-group IDs when
the actual and desired sets differ. Add unit tests for both the read
(drift detection) and write (in-place UpdatePort) paths.

Fixes kubernetes#18731

Signed-off-by: Rounak Debnath <r.debnath@x-ion.de>
@rdebnath-x-ion

Copy link
Copy Markdown
Contributor Author

/easycla

@kubernetes-prow

Copy link
Copy Markdown
Contributor

Invalid commit message issues detected

Invalid commit messages

Keywords which can automatically close issues and hashtag(#) mentions are not allowed.

  • d518d95 Reconcile OpenStack port additional security groups

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.

1 similar comment
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Invalid commit message issues detected

Invalid commit messages

Keywords which can automatically close issues and hashtag(#) mentions are not allowed.

  • d518d95 Reconcile OpenStack port additional security groups

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.

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/provider/openstack Issues or PRs related to openstack provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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.

OpenStack: Port additionalSecurityGroups are neither reconciled nor applied to existing ports

1 participant