Skip to content

Commit

Permalink
Extract Pod network CIDR to the variable
Browse files Browse the repository at this point in the history
- And also use it in Calico tasks
- Remove unused variables for Cilium

Signed-off-by: flavono123 <flavono123@gmail.com>
  • Loading branch information
flavono123 committed May 25, 2022
1 parent 66a5ee9 commit 0188346
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
17 changes: 2 additions & 15 deletions provisioning/roles/kubernetes/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,10 @@ controlplane_node_ip: "{{ hostvars[controlplane_node_hostname]['ansible_facts'][
kube_version: 1.23.6

kube_apiserver_port: 6443
kube_pod_network_cidr: 172.16.0.0/16

kubeadm_init_options:
apiserver-advertise-address: "{{ controlplane_node_ip }}"
control-plane-endpoint: "{{ controlplane_node_ip }}:{{ kube_apiserver_port }}"
apiserver-cert-extra-sans: "{{ controlplane_node_ip }}"
pod-network-cidr: 172.16.0.0/16

# cilium
cilium_version: 1.11.4
cilium_helm_values:
devices: enp0s8
tunnel: disabled
autoDirectNodeRoutes: 'true'
ipv4NativeRoutingCIDR: 192.168.0.0/16
ipam.operator.clusterPoolIPv4PodCIDRList:
- 172.16.0.0/16
# hubble.relay.enabled: true
# hubble.ui.enabled: true
# hostServices.enabled: true

pod-network-cidr: "{{ kube_pod_network_cidr }}"
2 changes: 1 addition & 1 deletion provisioning/roles/kubernetes/tasks/calico.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
- name: Copy the Calico custom resource definition
become: yes
copy:
content: "{{ calico_custom_resource_response.content | regex_replace('192\\.168\\.0\\.0\\/16', '172.16.0.0/16') | to_yaml(indent=2, width=1337) | replace('\\n', '\n') | replace('\"', '') }}"
content: "{{ calico_custom_resource_response.content | regex_replace('192\\.168\\.0\\.0\\/16', kube_pod_network_cidr) | to_yaml(indent=2, width=1337) | replace('\\n', '\n') | replace('\"', '') }}"
dest: $HOME/calico/custom-resources.yaml
ignore_errors: "{{ ansible_check_mode }}"

Expand Down

0 comments on commit 0188346

Please sign in to comment.