From b13e2442b117d5f76a054e471260bff27bbf29d5 Mon Sep 17 00:00:00 2001 From: Kevin Leimkuhler Date: Thu, 16 Apr 2020 16:49:11 -0700 Subject: [PATCH] Add rolling update strategy to multi-replica pods (#4267) This introduces a rolling update strategy to Linkerd deployments that have three replicas during HA deployments. This allows for at most one pod to begin terminating before a new pod ready is ready. This allows for upgrades to take place on three node clusters. As a pod begins terminating, it opens up the node for the new pod to start initializing. `.Values.enablePodAntiAffinity` was chosen as the conditional here because it is set by the `values-ha.yaml` config on HA deployments --- charts/linkerd2/templates/controller.yaml | 5 +++++ charts/linkerd2/templates/destination.yaml | 5 +++++ charts/linkerd2/templates/identity.yaml | 5 +++++ charts/linkerd2/templates/proxy-injector.yaml | 5 +++++ charts/linkerd2/templates/sp-validator.yaml | 5 +++++ charts/linkerd2/templates/tap.yaml | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/charts/linkerd2/templates/controller.yaml b/charts/linkerd2/templates/controller.yaml index d871a1f42..a7d72a4df 100644 --- a/charts/linkerd2/templates/controller.yaml +++ b/charts/linkerd2/templates/controller.yaml @@ -45,6 +45,11 @@ spec: {{.Values.global.controllerComponentLabel}}: controller {{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}} {{- include "partials.proxy.labels" .Values.global.proxy | nindent 6}} + {{- if .Values.enablePodAntiAffinity }} + strategy: + rollingUpdate: + maxUnavailable: 1 + {{- end }} template: metadata: annotations: diff --git a/charts/linkerd2/templates/destination.yaml b/charts/linkerd2/templates/destination.yaml index 4a55d35aa..8914b8b62 100644 --- a/charts/linkerd2/templates/destination.yaml +++ b/charts/linkerd2/templates/destination.yaml @@ -45,6 +45,11 @@ spec: {{.Values.global.controllerComponentLabel}}: destination {{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}} {{- include "partials.proxy.labels" .Values.global.proxy | nindent 6}} + {{- if .Values.enablePodAntiAffinity }} + strategy: + rollingUpdate: + maxUnavailable: 1 + {{- end }} template: metadata: annotations: diff --git a/charts/linkerd2/templates/identity.yaml b/charts/linkerd2/templates/identity.yaml index 45210f492..7bfd30085 100644 --- a/charts/linkerd2/templates/identity.yaml +++ b/charts/linkerd2/templates/identity.yaml @@ -65,6 +65,11 @@ spec: {{.Values.global.controllerComponentLabel}}: identity {{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}} {{- include "partials.proxy.labels" .Values.global.proxy | nindent 6}} + {{- if .Values.enablePodAntiAffinity }} + strategy: + rollingUpdate: + maxUnavailable: 1 + {{- end }} template: metadata: annotations: diff --git a/charts/linkerd2/templates/proxy-injector.yaml b/charts/linkerd2/templates/proxy-injector.yaml index ccaa5063f..4759f2399 100644 --- a/charts/linkerd2/templates/proxy-injector.yaml +++ b/charts/linkerd2/templates/proxy-injector.yaml @@ -24,6 +24,11 @@ spec: selector: matchLabels: {{.Values.global.controllerComponentLabel}}: proxy-injector + {{- if .Values.enablePodAntiAffinity }} + strategy: + rollingUpdate: + maxUnavailable: 1 + {{- end }} template: metadata: annotations: diff --git a/charts/linkerd2/templates/sp-validator.yaml b/charts/linkerd2/templates/sp-validator.yaml index b9278d6b2..8d1e0f325 100644 --- a/charts/linkerd2/templates/sp-validator.yaml +++ b/charts/linkerd2/templates/sp-validator.yaml @@ -43,6 +43,11 @@ spec: selector: matchLabels: {{.Values.global.controllerComponentLabel}}: sp-validator + {{- if .Values.enablePodAntiAffinity }} + strategy: + rollingUpdate: + maxUnavailable: 1 + {{- end }} template: metadata: annotations: diff --git a/charts/linkerd2/templates/tap.yaml b/charts/linkerd2/templates/tap.yaml index 08fcd9daa..40209f58d 100644 --- a/charts/linkerd2/templates/tap.yaml +++ b/charts/linkerd2/templates/tap.yaml @@ -48,6 +48,11 @@ spec: {{.Values.global.controllerComponentLabel}}: tap {{.Values.global.controllerNamespaceLabel}}: {{.Values.global.namespace}} {{- include "partials.proxy.labels" .Values.global.proxy | nindent 6}} + {{- if .Values.enablePodAntiAffinity }} + strategy: + rollingUpdate: + maxUnavailable: 1 + {{- end }} template: metadata: annotations: