fix(argo-cd): adjust api version of pod disruption budget by referring to k8s version (#1289)

Signed-off-by: yu-croco <yuki.kita22@gmail.com>
This commit is contained in:
Aikawa 2022-05-22 20:51:41 +09:00 committed by GitHub
parent 0e090ef854
commit 3332dc2e12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 7 deletions

View file

@ -284,3 +284,14 @@ Create the name of the configmap to use
key: redis-password
{{- end }}
{{- end -}}
{{/*
Return the appropriate apiVersion for pod disruption budget
*/}}
{{- define "argo-cd.podDisruptionBudget.apiVersion" -}}
{{- if semverCompare "<1.21-0" (include "argo-cd.kubeVersion" $) -}}
{{- print "policy/v1beta1" -}}
{{- else -}}
{{- print "policy/v1" -}}
{{- end -}}
{{- end -}}

View file

@ -1,5 +1,5 @@
{{- if .Values.controller.pdb.enabled }}
apiVersion: policy/v1beta1
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.controller.fullname" . }}

View file

@ -1,5 +1,5 @@
{{- if .Values.repoServer.pdb.enabled }}
apiVersion: policy/v1beta1
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.repoServer.fullname" . }}

View file

@ -1,5 +1,5 @@
{{- if .Values.server.pdb.enabled }}
apiVersion: policy/v1beta1
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.server.fullname" . }}

View file

@ -1,5 +1,5 @@
{{- if .Values.dex.pdb.enabled }}
apiVersion: policy/v1beta1
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.dex.fullname" . }}

View file

@ -1,5 +1,5 @@
{{- if .Values.redis.pdb.enabled }}
apiVersion: policy/v1beta1
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.redis.fullname" . }}