diff --git a/roles/calico_master/tasks/main.yml b/roles/calico_master/tasks/main.yml index b09ac0fe7ed..8744be911bc 100644 --- a/roles/calico_master/tasks/main.yml +++ b/roles/calico_master/tasks/main.yml @@ -94,6 +94,10 @@ failed_when: "calico_pull_secret_create_output.rc != 0" changed_when: "('created' in calico_pull_secret_create_output.stdout) or ('configured' in calico_pull_secret_create_output.stdout)" +- name: Calico Master | Set the correct liveness and readiness checks + set_fact: + calico_binary_checks: "{{ (node_version > '3.2.0' and cnx != 'cnx') or (node_version > '2.2.0' and cnx == 'cnx') | bool }}" + - name: Calico Master | Write Calico v2 template: dest: "{{ mktemp.stdout }}/calico.yml" diff --git a/roles/calico_master/templates/calicov3.yml.j2 b/roles/calico_master/templates/calicov3.yml.j2 index 88a58af4af1..00f09279c4d 100644 --- a/roles/calico_master/templates/calicov3.yml.j2 +++ b/roles/calico_master/templates/calicov3.yml.j2 @@ -343,13 +343,24 @@ spec: httpGet: path: /liveness port: 9099 +{% if calico_binary_checks %} + host: localhost +{% endif %} periodSeconds: 10 initialDelaySeconds: 10 failureThreshold: 6 readinessProbe: +{% if calico_binary_checks %} + exec: + command: + - /bin/calico-node + - -bird-ready + - -felix-ready +{% else %} httpGet: path: /readiness port: 9099 +{% endif %} periodSeconds: 10 volumeMounts: - mountPath: /lib/modules