From 566b26c71ae1468312091790302a9352a911f3e5 Mon Sep 17 00:00:00 2001 From: matt Date: Tue, 11 Sep 2018 15:23:25 -0700 Subject: [PATCH] Add proper liveness and readiness checks for Calico 3.2 --- roles/calico_master/tasks/main.yml | 4 ++++ roles/calico_master/templates/calicov3.yml.j2 | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/roles/calico_master/tasks/main.yml b/roles/calico_master/tasks/main.yml index 69ab530a5ff..34fd7450b9f 100644 --- a/roles/calico_master/tasks/main.yml +++ b/roles/calico_master/tasks/main.yml @@ -37,6 +37,10 @@ set_fact: node_version: "{{ calico_node_image | regex_replace('^.*node:v?(.*)$', '\\1') }}" +- 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 02618eec466..d2c34cd7727 100644 --- a/roles/calico_master/templates/calicov3.yml.j2 +++ b/roles/calico_master/templates/calicov3.yml.j2 @@ -341,13 +341,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