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

[WIP] Enable testing dual-stack scenarios #59

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

hardys
Copy link
Contributor

@hardys hardys commented Oct 21, 2024

Depends on #58 - adds an ipv6 network and management cluster configuration, remaining configuration of the management cluster still TODO so marking this as draft

external_network_bridge_ip_v6: "{{ external_network_cidr_v6|ansible.utils.nthhost(1)|default('', true) }}"
external_network_dhcp_range_v6:
- "{{ external_network_cidr_v6|ansible.utils.nthhost(200)|default('', true) }}"
- "{{ external_network_cidr_v6|ansible.utils.nthhost(250)|default('', true) }}"

Choose a reason for hiding this comment

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

We could use potentially different values here, but it probably makes sense to keep IPv4 and IPv6 aligned for the dual-stack case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah for debugging it seemed easier to just keep them the same, but users can override the values if they prefer something else

roles/libvirt-setup/defaults/main.yml Outdated Show resolved Hide resolved
{% endfor %}
</dhcp>
{% endif %}
</ip>
Copy link

@mchiappero mchiappero Oct 31, 2024

Choose a reason for hiding this comment

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

IPv6 does not include a DNS mapping as IPv4 (potentially) does. Not a must have, but to make IPv4 and IPv6 identical I'd include it, either now or later. What do you think?

Edit: sorry Steve, I did not check the documentation first, so if I got it right, the dns element adds additional records, while the A/AAAA records for the hosts are set through the ip/dhcp/host element. If this is correct, I would simply add the IPv6 section between the IPv4 and DNS elements rather than at the end, if you agree.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the dns stanza out of the v4/v6 conditional blocks which I think does the right thing but I need to test it - let me know if you think that's the right approach 👍

@@ -15,6 +15,9 @@ libvirt_nic_model: virtio
# Set to false for DHCP-less testing with static-ips
libvirt_network_dhcp: true

# Set to true for dual-stack testing with ipv6
libvirt_network_ipv6: false

Choose a reason for hiding this comment

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

I'd feel courageous here and enable it by default probably. And maybe add two flags to disable IPv4 and IPv6 when needed, so that we can easily enable single stack testing for both. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would prefer to leave it v4 only by default, just so for debugging the environment is as simple as possible

@@ -0,0 +1,8 @@
cni: {{cluster_cni}}
{% if libvirt_network_ipv6|bool %}
Copy link

@mchiappero mchiappero Oct 31, 2024

Choose a reason for hiding this comment

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

Maybe we can already put in place support for single v4, single v6 and dual here.

PS: fundamentally the more I think about it the more I think I'd take the time to enable all of the three combinations right now, it should be just a couple more ifs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added initial support for single-stack v6, not yet tested though and we know e.g Rancher doesn't yet support it so the management cluster at least probably has to remain dual-stack

This aligns with the upstream metal3-dev-env naming for easier reuse of the
same roles/templates
When ipv6 is enabled we configure the management cluster for dual stack
The network defaults are unused, and the networkData is not needed
since we're not deploying an image which can interpret this format
Add variable to optionally disable the ipv4 network
@hardys
Copy link
Contributor Author

hardys commented Nov 28, 2024

@mchiappero this is ready for another review pass when you get a moment - I think the dual-stack configuration should work now, I've not yet had time to validate the single-stack ipv6 case for downstream clusters (we may need to add variables for this so we can enable a dual-stack management cluster with single-stack downstream cluster example-manifests, or just render both I guess)

@hardys
Copy link
Contributor Author

hardys commented Nov 29, 2024

Looks like this is working for dual stack:

 kubectl get nodes sample-cluster-wz46w-p6c87 -o go-template --template='{{range .spec.podCIDRs}}{{printf "%s\n" .}}{{end}}'
192.168.1.0/24
2001:cafe:44:1::/64

I noticed we don't template the CNI though so will add a varable for that in the example-manifests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants