From 2ba0f1c2116b64294dd0ec6d2a800e6d5b06f722 Mon Sep 17 00:00:00 2001 From: Casey Davenport Date: Fri, 16 Jun 2017 11:18:18 -0700 Subject: [PATCH] Set Typha replica count to 0 when Calico is not enabled --- .../calico-policy-controller/typha-deployment.yaml | 2 -- cluster/gce/container-linux/configure-helper.sh | 11 +++++++---- cluster/gce/gci/configure-helper.sh | 11 +++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cluster/addons/calico-policy-controller/typha-deployment.yaml b/cluster/addons/calico-policy-controller/typha-deployment.yaml index 8b4cf0ddc94..2b49b09e5c5 100644 --- a/cluster/addons/calico-policy-controller/typha-deployment.yaml +++ b/cluster/addons/calico-policy-controller/typha-deployment.yaml @@ -20,8 +20,6 @@ spec: tolerations: - key: CriticalAddonsOnly operator: Exists - nodeSelector: - projectcalico.org/ds-ready: "true" hostNetwork: true containers: - image: calico/typha:v0.2.2 diff --git a/cluster/gce/container-linux/configure-helper.sh b/cluster/gce/container-linux/configure-helper.sh index c6dcdd52876..d7f4db6935c 100755 --- a/cluster/gce/container-linux/configure-helper.sh +++ b/cluster/gce/container-linux/configure-helper.sh @@ -66,10 +66,6 @@ function get-calico-typha-replicas { if [[ "${NUM_NODES}" -gt "500" ]]; then typha_count=5 fi - if [[ "${NETWORK_POLICY_PROVIDER:-}" != "calico" ]]; then - # We're not configured to use Calico, so don't start any Typhas. - typha_count=0 - fi echo "${typha_count}" } @@ -1272,6 +1268,13 @@ function start-kube-addons { sed -i -e "s@__CALICO_NODE_CPU__@$(get-calico-node-cpu)@g" "${ds_file}" sed -i -e "s@__CALICO_TYPHA_CPU__@$(get-calico-typha-cpu)@g" "${typha_dep_file}" sed -i -e "s@__CALICO_TYPHA_REPLICAS__@$(get-calico-typha-replicas)@g" "${typha_dep_file}" + else + # If not configured to use Calico, the set the typha replica count to 0, but only if the + # addon is present. + local -r typha_dep_file="${dst_dir}/calico-policy-controller/typha-deployment.yaml" + if [[ -e $typha_dep_file ]]; then + sed -i -e "s@__CALICO_TYPHA_REPLICAS__@0@g" "${typha_dep_file}" + fi fi if [[ "${ENABLE_DEFAULT_STORAGE_CLASS:-}" == "true" ]]; then setup-addon-manifests "addons" "storage-class/gce" diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 23b026fa87a..be22f8b1945 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -64,10 +64,6 @@ function get-calico-typha-replicas { if [[ "${NUM_NODES}" -gt "500" ]]; then typha_count=5 fi - if [[ "${NETWORK_POLICY_PROVIDER:-}" != "calico" ]]; then - # We're not configured to use Calico, so don't start any Typhas. - typha_count=0 - fi echo "${typha_count}" } @@ -1702,6 +1698,13 @@ function start-kube-addons { sed -i -e "s@__CALICO_NODE_CPU__@$(get-calico-node-cpu)@g" "${ds_file}" sed -i -e "s@__CALICO_TYPHA_CPU__@$(get-calico-typha-cpu)@g" "${typha_dep_file}" sed -i -e "s@__CALICO_TYPHA_REPLICAS__@$(get-calico-typha-replicas)@g" "${typha_dep_file}" + else + # If not configured to use Calico, the set the typha replica count to 0, but only if the + # addon is present. + local -r typha_dep_file="${dst_dir}/calico-policy-controller/typha-deployment.yaml" + if [[ -e $typha_dep_file ]]; then + sed -i -e "s@__CALICO_TYPHA_REPLICAS__@0@g" "${typha_dep_file}" + fi fi if [[ "${ENABLE_DEFAULT_STORAGE_CLASS:-}" == "true" ]]; then setup-addon-manifests "addons" "storage-class/gce"