[calico] don't clobber user set felixconfig options that are not managed by kubespray
This commit is contained in:
parent
5684610a55
commit
c27dee57ea
1 changed files with 39 additions and 20 deletions
|
@ -156,26 +156,45 @@
|
||||||
- inventory_hostname in groups['kube_control_plane']
|
- inventory_hostname in groups['kube_control_plane']
|
||||||
- calico_datastore == "kdd"
|
- calico_datastore == "kdd"
|
||||||
|
|
||||||
- name: Calico | Configure calico FelixConfiguration
|
- block:
|
||||||
command:
|
- name: Calico | Get existing FelixConfiguration
|
||||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
command: "{{ bin_dir }}/calicoctl.sh get felixconfig default -o json"
|
||||||
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
register: _felix_cmd
|
||||||
vars:
|
ignore_errors: True
|
||||||
stdin: >
|
changed_when: False
|
||||||
{ "kind": "FelixConfiguration",
|
|
||||||
"apiVersion": "projectcalico.org/v3",
|
- name: Calico | Set kubespray FelixConfiguration
|
||||||
"metadata": {
|
set_fact:
|
||||||
"name": "default",
|
_felix_config: >
|
||||||
},
|
{
|
||||||
"spec": {
|
"kind": "FelixConfiguration",
|
||||||
"ipipEnabled": {{ calico_ipip_mode != 'Never' }},
|
"apiVersion": "projectcalico.org/v3",
|
||||||
"reportingInterval": "{{ calico_felix_reporting_interval }}",
|
"metadata": {
|
||||||
"bpfLogLevel": "{{ calico_bpf_log_level }}",
|
"name": "default",
|
||||||
"bpfEnabled": {{ calico_bpf_enabled | bool }},
|
},
|
||||||
"bpfExternalServiceMode": "{{ calico_bpf_service_mode }}",
|
"spec": {
|
||||||
"wireguardEnabled": {{ calico_wireguard_enabled | bool }},
|
"ipipEnabled": {{ calico_ipip_mode != 'Never' }},
|
||||||
"logSeverityScreen": "{{ calico_felix_log_severity_screen }}",
|
"reportingInterval": "{{ calico_felix_reporting_interval }}",
|
||||||
"vxlanEnabled": {{ calico_vxlan_mode != 'Never' }} }}
|
"bpfLogLevel": "{{ calico_bpf_log_level }}",
|
||||||
|
"bpfEnabled": {{ calico_bpf_enabled | bool }},
|
||||||
|
"bpfExternalServiceMode": "{{ calico_bpf_service_mode }}",
|
||||||
|
"wireguardEnabled": {{ calico_wireguard_enabled | bool }},
|
||||||
|
"logSeverityScreen": "{{ calico_felix_log_severity_screen }}",
|
||||||
|
"vxlanEnabled": {{ calico_vxlan_mode != 'Never' }}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Calico | Process FelixConfiguration
|
||||||
|
set_fact:
|
||||||
|
_felix_config: "{{ _felix_cmd.stdout | from_json | combine(_felix_config, recursive=True) }}"
|
||||||
|
when:
|
||||||
|
- _felix_cmd is success
|
||||||
|
|
||||||
|
- name: Calico | Configure calico FelixConfiguration
|
||||||
|
command:
|
||||||
|
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||||
|
stdin: "{{ _felix_config is string | ternary(_felix_config, _felix_config|to_json) }}"
|
||||||
|
changed_when: False
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == groups['kube_control_plane'][0]
|
- inventory_hostname == groups['kube_control_plane'][0]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue