Move cilium_deploy_additionnaly to kubespray-default (#12191)

Instead of using default(false) all over the place, use
kubespray-defaults
This commit is contained in:
Max Gautier
2025-05-07 14:05:17 +02:00
committed by GitHub
parent 985e4ebb23
commit d6d87e9a83
10 changed files with 22 additions and 20 deletions

View File

@@ -84,7 +84,7 @@
{% if not loop.last %}{{ ',' }}{% endif %} {% if not loop.last %}{{ ',' }}{% endif %}
{% endfor %}] {% endfor %}]
when: when:
- kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally
- kube_network_plugin != "calico" or calico_datastore == "etcd" - kube_network_plugin != "calico" or calico_datastore == "etcd"
- force_etcd_cert_refresh or not item in etcdcert_master.files | map(attribute='path') | list - force_etcd_cert_refresh or not item in etcdcert_master.files | map(attribute='path') | list

View File

@@ -54,7 +54,7 @@
run_once: true run_once: true
delegate_to: "{{ groups['etcd'][0] }}" delegate_to: "{{ groups['etcd'][0] }}"
when: when:
- kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally
- kube_network_plugin != "calico" or calico_datastore == "etcd" - kube_network_plugin != "calico" or calico_datastore == "etcd"
- gen_certs | default(false) - gen_certs | default(false)
notify: Set etcd_secret_changed notify: Set etcd_secret_changed
@@ -133,7 +133,7 @@
when: when:
- ('etcd' in group_names) - ('etcd' in group_names)
- inventory_hostname != groups['etcd'][0] - inventory_hostname != groups['etcd'][0]
- kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally
- kube_network_plugin != "calico" or calico_datastore == "etcd" - kube_network_plugin != "calico" or calico_datastore == "etcd"
notify: Set etcd_secret_changed notify: Set etcd_secret_changed
@@ -148,7 +148,7 @@
when: when:
- ('etcd' in group_names) - ('etcd' in group_names)
- inventory_hostname != groups['etcd'][0] - inventory_hostname != groups['etcd'][0]
- kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally
- kube_network_plugin != "calico" or calico_datastore == "etcd" - kube_network_plugin != "calico" or calico_datastore == "etcd"
loop_control: loop_control:
label: "{{ item.item }}" label: "{{ item.item }}"
@@ -162,7 +162,7 @@
- name: Gen_certs | Generate etcd certs on nodes if needed - name: Gen_certs | Generate etcd certs on nodes if needed
include_tasks: gen_nodes_certs_script.yml include_tasks: gen_nodes_certs_script.yml
when: when:
- kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally
- kube_network_plugin != "calico" or calico_datastore == "etcd" - kube_network_plugin != "calico" or calico_datastore == "etcd"
- ('k8s_cluster' in group_names) and - ('k8s_cluster' in group_names) and
sync_certs | default(false) and inventory_hostname not in groups['etcd'] sync_certs | default(false) and inventory_hostname not in groups['etcd']

View File

@@ -23,7 +23,7 @@
- name: Trust etcd CA on nodes if needed - name: Trust etcd CA on nodes if needed
include_tasks: upd_ca_trust.yml include_tasks: upd_ca_trust.yml
when: when:
- kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally
- kube_network_plugin != "calico" or calico_datastore == "etcd" - kube_network_plugin != "calico" or calico_datastore == "etcd"
- ('k8s_cluster' in group_names) - ('k8s_cluster' in group_names)
tags: tags:
@@ -35,7 +35,7 @@
changed_when: false changed_when: false
check_mode: false check_mode: false
when: when:
- kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally
- kube_network_plugin != "calico" or calico_datastore == "etcd" - kube_network_plugin != "calico" or calico_datastore == "etcd"
- ('k8s_cluster' in group_names) - ('k8s_cluster' in group_names)
tags: tags:
@@ -47,7 +47,7 @@
set_fact: set_fact:
etcd_client_cert_serial: "{{ etcd_client_cert_serial_result.stdout.split('=')[1] }}" etcd_client_cert_serial: "{{ etcd_client_cert_serial_result.stdout.split('=')[1] }}"
when: when:
- kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally
- kube_network_plugin != "calico" or calico_datastore == "etcd" - kube_network_plugin != "calico" or calico_datastore == "etcd"
- ('k8s_cluster' in group_names) - ('k8s_cluster' in group_names)
tags: tags:

View File

@@ -201,5 +201,5 @@
when: when:
- etcd_deployment_type == "kubeadm" - etcd_deployment_type == "kubeadm"
- inventory_hostname not in groups['kube_control_plane'] - inventory_hostname not in groups['kube_control_plane']
- kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally
- kube_network_plugin != "calico" or calico_datastore == "etcd" - kube_network_plugin != "calico" or calico_datastore == "etcd"

View File

@@ -204,7 +204,7 @@
assert: assert:
that: ansible_kernel.split('-')[0] is version('4.9.17', '>=') that: ansible_kernel.split('-')[0] is version('4.9.17', '>=')
when: when:
- kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool - kube_network_plugin == 'cilium' or cilium_deploy_additionally
- not ignore_assert_errors - not ignore_assert_errors
- name: Stop if kernel version is too low for nftables - name: Stop if kernel version is too low for nftables

View File

@@ -632,7 +632,7 @@ downloads:
- kube_control_plane - kube_control_plane
cilium: cilium:
enabled: "{{ kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool }}" enabled: "{{ kube_network_plugin == 'cilium' or cilium_deploy_additionally }}"
container: true container: true
repo: "{{ cilium_image_repo }}" repo: "{{ cilium_image_repo }}"
tag: "{{ cilium_image_tag }}" tag: "{{ cilium_image_tag }}"
@@ -641,7 +641,7 @@ downloads:
- k8s_cluster - k8s_cluster
cilium_operator: cilium_operator:
enabled: "{{ kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool }}" enabled: "{{ kube_network_plugin == 'cilium' or cilium_deploy_additionally }}"
container: true container: true
repo: "{{ cilium_operator_image_repo }}" repo: "{{ cilium_operator_image_repo }}"
tag: "{{ cilium_operator_image_tag }}" tag: "{{ cilium_operator_image_tag }}"
@@ -695,7 +695,7 @@ downloads:
- k8s_cluster - k8s_cluster
ciliumcli: ciliumcli:
enabled: "{{ kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool }}" enabled: "{{ kube_network_plugin == 'cilium' or cilium_deploy_additionally }}"
file: true file: true
dest: "{{ local_release_dir }}/cilium-{{ cilium_cli_version }}-{{ image_arch }}.tar.gz" dest: "{{ local_release_dir }}/cilium-{{ cilium_cli_version }}-{{ image_arch }}.tar.gz"
checksum: "{{ ciliumcli_binary_checksum }}" checksum: "{{ ciliumcli_binary_checksum }}"

View File

@@ -204,6 +204,12 @@ kube_log_level: 2
kube_network_plugin: calico kube_network_plugin: calico
kube_network_plugin_multus: false kube_network_plugin_multus: false
## Network plugin options with dependencies across the whole playbook
# Deploy cilium even if kube_network_plugin is not cilium.
# This enables to deploy cilium alongside another CNI to replace kube-proxy.
cilium_deploy_additionally: false
# Determines if calico_rr group exists # Determines if calico_rr group exists
peer_with_calico_rr: "{{ 'calico_rr' in groups and groups['calico_rr'] | length > 0 }}" peer_with_calico_rr: "{{ 'calico_rr' in groups and groups['calico_rr'] | length > 0 }}"

View File

@@ -69,10 +69,6 @@ cilium_tofqdns_enable_poller: false
# `cilium_enable_legacy_services` is deprecated in 1.6, removed in 1.9 # `cilium_enable_legacy_services` is deprecated in 1.6, removed in 1.9
cilium_enable_legacy_services: false cilium_enable_legacy_services: false
# Deploy cilium even if kube_network_plugin is not cilium.
# This enables to deploy cilium alongside another CNI to replace kube-proxy.
cilium_deploy_additionally: false
# Auto direct nodes routes can be used to advertise pods routes in your cluster # Auto direct nodes routes can be used to advertise pods routes in your cluster
# without any tunelling (with `cilium_tunnel_mode` sets to `disabled`). # without any tunelling (with `cilium_tunnel_mode` sets to `disabled`).
# This works only if you have a L2 connectivity between all your nodes. # This works only if you have a L2 connectivity between all your nodes.

View File

@@ -18,13 +18,13 @@
when: when:
- cilium_ipsec_enabled is defined - cilium_ipsec_enabled is defined
- cilium_ipsec_enabled - cilium_ipsec_enabled
- kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool - kube_network_plugin == 'cilium' or cilium_deploy_additionally
- name: Stop if kernel version is too low for Cilium Wireguard encryption - name: Stop if kernel version is too low for Cilium Wireguard encryption
assert: assert:
that: ansible_kernel.split('-')[0] is version('5.6.0', '>=') that: ansible_kernel.split('-')[0] is version('5.6.0', '>=')
when: when:
- kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool - kube_network_plugin == 'cilium' or cilium_deploy_additionally
- cilium_encryption_enabled - cilium_encryption_enabled
- cilium_encryption_type == "wireguard" - cilium_encryption_type == "wireguard"
- not ignore_assert_errors - not ignore_assert_errors

View File

@@ -4,7 +4,7 @@ dependencies:
when: kube_network_plugin != 'none' when: kube_network_plugin != 'none'
- role: network_plugin/cilium - role: network_plugin/cilium
when: kube_network_plugin == 'cilium' or cilium_deploy_additionally | default(false) | bool when: kube_network_plugin == 'cilium' or cilium_deploy_additionally
tags: tags:
- cilium - cilium