Skip to content

openstack : add the external_openstack_lbaas_member_subnet_id variable #12267

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

voondo
Copy link

@voondo voondo commented May 28, 2025

What type of PR is this?
/kind feature

What this PR does / why we need it:
It adds the variable external_openstack_lbaas_member_subnet_id which is used to define member-subnet-id in the file roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-config.j2

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Add external_openstack_lbaas_member_subnet_id: str  (not set by default), to define a specific `member-subnet-id` for the openstack load balancers

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 28, 2025
@k8s-ci-robot k8s-ci-robot requested review from ErikJiang and VannTen May 28, 2025 15:09
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 28, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @voondo. Thanks for your PR.

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

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.

@yankay
Copy link
Member

yankay commented Jun 3, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 3, 2025
@VannTen
Copy link
Contributor

VannTen commented Jun 5, 2025

What happens exactly if the var is not set ? We try to avoid is defined check and have all variables in roles defaults as much as practically possible.

@voondo
Copy link
Author

voondo commented Jun 5, 2025

According to the cloud-provider-openstack documentation, it defaults to subnet-id (so external_openstack_lbaas_subnet_id for kubespray) :

member-subnet-id ID of the Neutron network on which to create the members of the load balancer. The load balancer gets another network port on this subnet. Defaults to subnet-id if not set.

https://github.com/kubernetes/cloud-provider-openstack/blob/master/docs/openstack-cloud-controller-manager/using-openstack-cloud-controller-manager.md#load-balancer

Do you think it's better to replicate this behavior in kubespray with something like:

in roles/kubernetes-apps/external_cloud_controller/openstack/defaults/main.yml

external_openstack_lbaas_member_subnet_id: "{{ external_openstack_lbaas_subnet_id }}"

and in roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-config.j2

{% if external_openstack_lbaas_subnet_id is defined %}
subnet-id={{ external_openstack_lbaas_subnet_id }}
member-subnet-id={{ external_openstack_lbaas_member_subnet_id }}
{% endif %}

or more directly:

{% if external_openstack_lbaas_subnet_id is defined %}
subnet-id={{ external_openstack_lbaas_subnet_id }}
member-subnet-id={{ external_openstack_lbaas_member_subnet_id | default(external_openstack_lbaas_subnet_id) }}
{% endif %}

?

Note that the template roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-config.j2 has already a ton of is defined. Maybe a global refactor would be a good thing but that would be beyond the scope of this pull request.

@VannTen
Copy link
Contributor

VannTen commented Jun 15, 2025

Yes, just default to the subnet-it and put it in the same cond block.

Note that the template roles/kubernetes-apps/external_cloud_controller/openstack/templates/external-openstack-cloud-config.j2 has already a ton of is defined. Maybe a global refactor would be a good thing but that would be beyond the scope of this pull request.

Yes to both (and not just this file, the idiom is plaguing kubespray everywhere and that makes templates significantly harder to read ^^)

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. kind/feature Categorizes issue or PR as related to a new feature. ok-to-test Indicates a non-member PR verified by an org member that 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.

4 participants