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

Set firewall rules for custom CIDR ranges #293

Merged
merged 1 commit into from
Feb 22, 2024
Merged

Set firewall rules for custom CIDR ranges #293

merged 1 commit into from
Feb 22, 2024

Conversation

laszlojau
Copy link
Contributor

Changes

role: prereq

Linked Issues

#292

@laszlojau
Copy link
Contributor Author

I tried to keep multiple options open for passing the CIDR range to the prereq role, happy to update/simplify the logic if needed.

@dereknola
Copy link
Member

dereknola commented Feb 5, 2024

I'm happy to support this since we introduced the firewall exception as an addon. But you should simplify the logic. Just have a cluster_cidr and service_cidr default vars that could be overriden by the inventory var.

Additionally, you need to sign all your commits to comply with the DCO.

@laszlojau
Copy link
Contributor Author

I'm happy to support this since we introduced the firewall exception as an addon. But you should simplify the logic. Just have a cluster_cidr and service_cidr default vars that could be overriden by the inventory var.

Wouldn't that mean having to set the variable twice? Or you mean pass those values through as k3s server arguments as well? I'd prefer setting it once if possible. What if I just looked at the server_config_yaml?

I.e. do something like this instead:

cluster_cidr: "{{ (server_config_yaml | from_yaml)['cluster-cidr'] | default('10.42.0.0/16') }}"
service_cidr: "{{ (server_config_yaml | from_yaml)['service-cidr'] | default('10.43.0.0/16') }}"

And then the loop could be something like:

  loop: "{{ (cluster_cidr + ',' + service_cidr) | split(',') }}"

@dereknola
Copy link
Member

Yeah i think that would work:

  • If hard defined as a variable, use that.
  • Otherwise attempt to figure it out from the k3s config.yaml values
  • Otherwise use the defaults

@laszlojau
Copy link
Contributor Author

Updated the logic and signed the commit, let me know if you need anything else.

@dereknola dereknola merged commit 9c8ba5c into k3s-io:master Feb 22, 2024
2 checks passed
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