This commit is contained in:
Ethan Shold
2024-01-26 17:49:08 -06:00
parent 3b87add6ad
commit 565270a55a
2 changed files with 21 additions and 18 deletions
+4 -4
View File
@@ -11,10 +11,10 @@ system_timezone: "Your/Timezone"
flannel_iface: "eth0" flannel_iface: "eth0"
# uncomment calico_iface to use tigera operator/calico cni instead of flannel https://docs.tigera.io/calico/latest/about # uncomment calico_iface to use tigera operator/calico cni instead of flannel https://docs.tigera.io/calico/latest/about
#calico_iface: "eth0" # calico_iface: "eth0"
calico_ebpf: false # use eBPF dataplane instead of iptables https://docs.tigera.io/calico/latest/operations/ebpf calico_ebpf: false # use eBPF dataplane instead of iptables
calico_cidr: "10.52.0.0/16" # calico cluster pod cidr pool calico_cidr: "10.52.0.0/16" # calico cluster pod cidr pool
calico_tag: "v3.27.0" # calico version tag calico_tag: "v3.27.0" # calico version tag
# apiserver_endpoint is virtual ip-address which will be configured on each master # apiserver_endpoint is virtual ip-address which will be configured on each master
apiserver_endpoint: "192.168.30.222" apiserver_endpoint: "192.168.30.222"
+17 -14
View File
@@ -1,5 +1,8 @@
--- ---
- block: - name: Deploy Calico to cluster
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
run_once: true
block:
- name: Create manifests directory on first master - name: Create manifests directory on first master
file: file:
path: /tmp/k3s path: /tmp/k3s
@@ -20,6 +23,9 @@
ansible.builtin.template: ansible.builtin.template:
src: "calico.crs.j2" src: "calico.crs.j2"
dest: /tmp/k3s/custom-resources.yaml dest: /tmp/k3s/custom-resources.yaml
owner: root
group: root
mode: 0755
- name: Deploy or replace Tigera Operator - name: Deploy or replace Tigera Operator
block: block:
@@ -49,10 +55,10 @@
retries: 7 retries: 7
delay: 7 delay: 7
with_items: with_items:
- { name: tigera-operator, type: deployment } - {name: tigera-operator, type: deployment}
loop_control: loop_control:
label: "{{ item.type }}/{{ item.name }}" label: "{{ item.type }}/{{ item.name }}"
- name: Deploy Calico custom resources - name: Deploy Calico custom resources
block: block:
- name: Deploy custom resources for Calico - name: Deploy custom resources for Calico
@@ -68,7 +74,7 @@
register: apply_cr register: apply_cr
changed_when: "'configured' in apply_cr.stdout or 'created' in apply_cr.stdout" changed_when: "'configured' in apply_cr.stdout or 'created' in apply_cr.stdout"
failed_when: "'Error' in apply_cr.stderr" failed_when: "'Error' in apply_cr.stderr"
- name: Wait for Calico system resources to be available - name: Wait for Calico system resources to be available
command: >- command: >-
{% if item.type == 'daemonset' %} {% if item.type == 'daemonset' %}
@@ -88,11 +94,11 @@
retries: 30 retries: 30
delay: 7 delay: 7
with_items: with_items:
- { name: calico-typha, type: deployment, namespace: calico-system } - {name: calico-typha, type: deployment, namespace: calico-system}
- { name: calico-kube-controllers, type: deployment, namespace: calico-system } - {name: calico-kube-controllers, type: deployment, namespace: calico-system}
- { name: csi-node-driver, type: daemonset, selector: 'k8s-app=csi-node-driver', namespace: calico-system } - {name: csi-node-driver, type: daemonset, selector: 'k8s-app=csi-node-driver', namespace: calico-system}
- { name: calico-node, type: daemonset, selector: 'k8s-app=calico-node', namespace: calico-system } - {name: calico-node, type: daemonset, selector: 'k8s-app=calico-node', namespace: calico-system}
- { name: calico-apiserver, type: deployment, selector: 'k8s-app=calico-apiserver', namespace: calico-apiserver } - {name: calico-apiserver, type: deployment, namespace: calico-apiserver}
loop_control: loop_control:
label: "{{ item.type }}/{{ item.name }}" label: "{{ item.type }}/{{ item.name }}"
@@ -100,12 +106,9 @@
ansible.builtin.command: ansible.builtin.command:
cmd: > cmd: >
kubectl patch felixconfiguration default kubectl patch felixconfiguration default
--type='merge' --type='merge'
--patch='{"spec": {"bpfKubeProxyIptablesCleanupEnabled": false}}' --patch='{"spec": {"bpfKubeProxyIptablesCleanupEnabled": false}}'
register: patch_result register: patch_result
changed_when: "'felixconfiguration.projectcalico.org/default patched' in patch_result.stdout" changed_when: "'felixconfiguration.projectcalico.org/default patched' in patch_result.stdout"
failed_when: "'Error' in patch_result.stderr" failed_when: "'Error' in patch_result.stderr"
when: calico_ebpf == true when: calico_ebpf
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
run_once: true # stops "skipped" log spam