Skip to content

Commit

Permalink
Set firewall rules for custom CIDR ranges (k3s-io#293)
Browse files Browse the repository at this point in the history
Signed-off-by: laszlojau <[email protected]>
  • Loading branch information
laszlojau authored Feb 22, 2024
1 parent 0603621 commit 9c8ba5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 2 additions & 6 deletions roles/prereq/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
community.general.ufw:
rule: allow
src: '{{ item }}'
loop:
- 10.42.0.0/16 # Pods
- 10.43.0.0/16 # Services
loop: "{{ (cluster_cidr + ',' + service_cidr) | split(',') }}"

- name: Allow Firewalld Exceptions
when:
Expand Down Expand Up @@ -90,9 +88,7 @@
state: enabled
permanent: true
immediate: true
loop:
- 10.42.0.0/16 # Pods
- 10.43.0.0/16 # Services
loop: "{{ (cluster_cidr + ',' + service_cidr) | split(',') }}"

- name: Add br_netfilter to /etc/modules-load.d/
ansible.builtin.copy:
Expand Down
3 changes: 3 additions & 0 deletions roles/prereq/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
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') }}"

0 comments on commit 9c8ba5c

Please sign in to comment.