From 90d630fb05857883ab9e63ad75830a0ebb5422ee Mon Sep 17 00:00:00 2001 From: Matias Charriere Date: Fri, 17 Nov 2023 10:22:46 +0100 Subject: [PATCH] Add metrics-api and web PDB. Install them only if replicas > 1. Signed-off-by: Matias Charriere --- .../linkerd-viz/templates/metrics-api.yaml | 21 +++++++++++++++++++ .../linkerd-viz/templates/tap-injector.yaml | 2 +- viz/charts/linkerd-viz/templates/tap.yaml | 2 +- viz/charts/linkerd-viz/templates/web.yaml | 21 +++++++++++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/viz/charts/linkerd-viz/templates/metrics-api.yaml b/viz/charts/linkerd-viz/templates/metrics-api.yaml index 1a84f7fa0b88d..c58789a5b360c 100644 --- a/viz/charts/linkerd-viz/templates/metrics-api.yaml +++ b/viz/charts/linkerd-viz/templates/metrics-api.yaml @@ -123,3 +123,24 @@ spec: seccompProfile: type: RuntimeDefault serviceAccountName: metrics-api +{{- if and .Values.enablePodDisruptionBudget (gt (int .Values.metricsAPI.replicas) 1) }} +--- +kind: PodDisruptionBudget +apiVersion: policy/v1 +metadata: + name: metrics-api + namespace: {{ .Release.Namespace }} + labels: + linkerd.io/extension: viz + component: metrics-api + namespace: {{.Release.Namespace}} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} + annotations: + {{ include "partials.annotations.created-by" . }} +spec: + maxUnavailable: 1 + selector: + matchLabels: + linkerd.io/extension: viz + component: metrics-api +{{- end }} diff --git a/viz/charts/linkerd-viz/templates/tap-injector.yaml b/viz/charts/linkerd-viz/templates/tap-injector.yaml index ab00f031fc468..cd5b8dbb2aab6 100644 --- a/viz/charts/linkerd-viz/templates/tap-injector.yaml +++ b/viz/charts/linkerd-viz/templates/tap-injector.yaml @@ -127,7 +127,7 @@ spec: - name: tls secret: secretName: tap-injector-k8s-tls -{{- if .Values.enablePodDisruptionBudget }} +{{- if and .Values.enablePodDisruptionBudget (gt (int .Values.tapInjector.replicas) 1) }} --- kind: PodDisruptionBudget apiVersion: policy/v1 diff --git a/viz/charts/linkerd-viz/templates/tap.yaml b/viz/charts/linkerd-viz/templates/tap.yaml index 37a5589a37848..15535c0767c9d 100644 --- a/viz/charts/linkerd-viz/templates/tap.yaml +++ b/viz/charts/linkerd-viz/templates/tap.yaml @@ -142,7 +142,7 @@ spec: - name: tls secret: secretName: tap-k8s-tls -{{- if .Values.enablePodDisruptionBudget }} +{{- if and .Values.enablePodDisruptionBudget (gt (int .Values.tap.replicas) 1) }} --- kind: PodDisruptionBudget apiVersion: policy/v1 diff --git a/viz/charts/linkerd-viz/templates/web.yaml b/viz/charts/linkerd-viz/templates/web.yaml index 95ba27d261896..06d715110b9fe 100644 --- a/viz/charts/linkerd-viz/templates/web.yaml +++ b/viz/charts/linkerd-viz/templates/web.yaml @@ -139,3 +139,24 @@ spec: seccompProfile: type: RuntimeDefault serviceAccountName: web +{{- if and .Values.enablePodDisruptionBudget (gt (int .Values.dashboard.replicas) 1) }} +--- +kind: PodDisruptionBudget +apiVersion: policy/v1 +metadata: + name: web + namespace: {{ .Release.Namespace }} + labels: + linkerd.io/extension: viz + component: web + namespace: {{.Release.Namespace}} + {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} + annotations: + {{ include "partials.annotations.created-by" . }} +spec: + maxUnavailable: 1 + selector: + matchLabels: + linkerd.io/extension: viz + component: web +{{- end }}