Skip to content

Commit

Permalink
[charts/redis-ha] Use correct API version of PodDisruptionBudget. (#187
Browse files Browse the repository at this point in the history
…) (#210)

Signed-off-by: Mikhail Konyakhin <[email protected]>
  • Loading branch information
MemberIT authored Jul 26, 2022
1 parent 71e514b commit 6f52301
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/redis-ha/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- redis
- keyvalue
- database
version: 4.17.3
version: 4.17.4
appVersion: 6.2.5
description: This Helm chart provides a highly available Redis implementation with a master/slave configuration and uses Sentinel sidecars for failover management
icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png
Expand Down
11 changes: 11 additions & 0 deletions charts/redis-ha/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,14 @@ Create the name of the service account to use
{{ required "A valid .Values.redis.masterGroupName entry is required (matching ^[\\w-\\.]+$)" ""}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for poddisruptionbudget.
*/}}
{{- define "redis-ha.podDisruptionBudget.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "policy/v1" }}
{{- print "policy/v1" -}}
{{- else -}}
{{- print "policy/v1beta1" -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/redis-ha/templates/redis-ha-pdb.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.podDisruptionBudget -}}
apiVersion: policy/v1beta1
apiVersion: {{ template "redis-ha.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "redis-ha.fullname" . }}-pdb
Expand Down
2 changes: 1 addition & 1 deletion charts/redis-ha/templates/redis-haproxy-pdb.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.haproxy.podDisruptionBudget -}}
apiVersion: policy/v1beta1
apiVersion: {{ template "redis-ha.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "redis-ha.fullname" . }}-haproxy-pdb
Expand Down

0 comments on commit 6f52301

Please sign in to comment.