Set Typha replica count to 0 when Calico is not enabled

This commit is contained in:
Casey Davenport 2017-06-16 11:18:18 -07:00
parent 2d023ab085
commit 2ba0f1c211
3 changed files with 14 additions and 10 deletions

View File

@ -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

View File

@ -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"

View File

@ -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"