From 1c575a23b80e9df8960676889a34261aa44ceae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dulko?= Date: Wed, 7 Nov 2018 14:34:56 +0100 Subject: [PATCH] Make sure we never have 2 kuryr-controllers This commit adds constraints preventing 2 kuryr-controllers from being created in non-HA deployments running on K8s when doing an update of the K8s Deployment (e.g. when upgrading the kuryr-controller image). Change-Id: Ic5fe9aa9e63f2bee51d85e112d543e6955ab3bc8 Closes-Bug: 1802099 --- devstack/lib/kuryr_kubernetes | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/devstack/lib/kuryr_kubernetes b/devstack/lib/kuryr_kubernetes index aba3fd075..3b371b8e2 100644 --- a/devstack/lib/kuryr_kubernetes +++ b/devstack/lib/kuryr_kubernetes @@ -522,6 +522,21 @@ metadata: namespace: kube-system spec: replicas: ${KURYR_CONTROLLER_REPLICAS:-1} +EOF + + # When running without HA we should make sure that we won't have more than + # one kuryr-controller pod in the deployment. + if [ "$controller_ha" == "False" ]; then + cat >> "${output_dir}/controller_deployment.yml" << EOF + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 0 + maxUnavailable: 1 +EOF + fi + + cat >> "${output_dir}/controller_deployment.yml" << EOF template: metadata: labels: