[calico]use ipamconfig instead of calico ipam command (#8839)
* use ipamconfig instead of calico ipam command * fix ansible lint
This commit is contained in:
parent
a26a9ee14f
commit
a28b58dbd0
5 changed files with 32 additions and 9 deletions
|
@ -18,6 +18,7 @@
|
||||||
template:
|
template:
|
||||||
src: "{{ item.file }}.j2"
|
src: "{{ item.file }}.j2"
|
||||||
dest: "{{ kube_config_dir }}/{{ item.file }}"
|
dest: "{{ kube_config_dir }}/{{ item.file }}"
|
||||||
|
mode: 0644
|
||||||
with_items:
|
with_items:
|
||||||
- {name: upcloud-csi-cred-secret, file: upcloud-csi-cred-secret.yml}
|
- {name: upcloud-csi-cred-secret, file: upcloud-csi-cred-secret.yml}
|
||||||
- {name: upcloud-csi-setup, file: upcloud-csi-setup.yml}
|
- {name: upcloud-csi-setup, file: upcloud-csi-setup.yml}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
template:
|
template:
|
||||||
src: "upcloud-csi-storage-class.yml.j2"
|
src: "upcloud-csi-storage-class.yml.j2"
|
||||||
dest: "{{ kube_config_dir }}/upcloud-csi-storage-class.yml"
|
dest: "{{ kube_config_dir }}/upcloud-csi-storage-class.yml"
|
||||||
|
mode: 0644
|
||||||
register: manifests
|
register: manifests
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == groups['kube_control_plane'][0]
|
- inventory_hostname == groups['kube_control_plane'][0]
|
||||||
|
|
|
@ -133,8 +133,14 @@ calico_felix_log_severity_screen: Info
|
||||||
# Calico container settings
|
# Calico container settings
|
||||||
calico_allow_ip_forwarding: false
|
calico_allow_ip_forwarding: false
|
||||||
|
|
||||||
# Calico IPAM strictaffinity
|
# Calico IPAM strictAffinity
|
||||||
calico_ipam_strictaffinity: false
|
calico_ipam_strictaffinity: false
|
||||||
|
|
||||||
|
# Calico IPAM autoAllocateBlocks
|
||||||
|
calcio_ipam_autoallocateblocks: true
|
||||||
|
|
||||||
|
# Calico IPAM maxBlocksPerHost, default 0
|
||||||
|
calico_ipam_maxblocksperhost: 0
|
||||||
|
|
||||||
# Calico apiserver (only with kdd)
|
# Calico apiserver (only with kdd)
|
||||||
calico_apiserver_enabled: false
|
calico_apiserver_enabled: false
|
||||||
|
|
|
@ -491,13 +491,20 @@
|
||||||
- peer_with_router|default(false)
|
- peer_with_router|default(false)
|
||||||
- inventory_hostname == groups['kube_control_plane'][0]
|
- inventory_hostname == groups['kube_control_plane'][0]
|
||||||
|
|
||||||
- name: Calico | Configure ipam strictaffinity
|
- name: Calico | Create Calico ipam manifests
|
||||||
command:
|
template:
|
||||||
cmd: "{{ bin_dir }}/calicoctl.sh ipam configure --strictaffinity={{ calico_ipam_strictaffinity }}"
|
src: "{{ item.file }}.j2"
|
||||||
register: output
|
dest: "{{ kube_config_dir }}/{{ item.file }}"
|
||||||
retries: 4
|
mode: 0644
|
||||||
until: output.rc == 0
|
with_items:
|
||||||
delay: "{{ retry_stagger | random + 3 }}"
|
- {name: calico, file: calico-ipamconfig.yml, type: ipam}
|
||||||
|
when:
|
||||||
|
- inventory_hostname in groups['kube_control_plane']
|
||||||
|
|
||||||
|
- name: Calico | Create ipamconfig resources
|
||||||
|
kube:
|
||||||
|
kubectl: "{{ bin_dir }}/kubectl"
|
||||||
|
filename: "{{ kube_config_dir }}/calico-ipamconfig.yml"
|
||||||
|
state: "latest"
|
||||||
when:
|
when:
|
||||||
- calico_ipam_strictaffinity is defined
|
|
||||||
- inventory_hostname == groups['kube_control_plane'][0]
|
- inventory_hostname == groups['kube_control_plane'][0]
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
apiVersion: crd.projectcalico.org/v1
|
||||||
|
kind: IPAMConfig
|
||||||
|
metadata:
|
||||||
|
name: default
|
||||||
|
spec:
|
||||||
|
autoAllocateBlocks: {{ calcio_ipam_autoallocateblocks }}
|
||||||
|
strictAffinity: {{ calico_ipam_strictaffinity }}
|
||||||
|
maxBlocksPerHost: {{ calico_ipam_maxblocksperhost }}
|
Loading…
Reference in a new issue