diff --git a/elasticsearch/templates/poddisruptionbudget.yaml b/elasticsearch/templates/poddisruptionbudget.yaml index b61f3c0f3..6d0bdf3fd 100644 --- a/elasticsearch/templates/poddisruptionbudget.yaml +++ b/elasticsearch/templates/poddisruptionbudget.yaml @@ -1,6 +1,9 @@ {{- if .Values.maxUnavailable }} ---- +{{- if .Capabilities.APIVersions.Has "policy/v1" -}} +apiVersion: policy/v1 +{{- else}} apiVersion: policy/v1beta1 +{{- end }} kind: PodDisruptionBudget metadata: name: "{{ template "elasticsearch.uname" . }}-pdb" diff --git a/elasticsearch/templates/podsecuritypolicy.yaml b/elasticsearch/templates/podsecuritypolicy.yaml index d8b35457a..e22e75c41 100644 --- a/elasticsearch/templates/podsecuritypolicy.yaml +++ b/elasticsearch/templates/podsecuritypolicy.yaml @@ -1,6 +1,10 @@ {{- if .Values.podSecurityPolicy.create -}} {{- $fullName := include "elasticsearch.uname" . -}} +{{- if .Capabilities.APIVersions.Has "policy/v1" -}} +apiVersion: policy/v1 +{{- else}} apiVersion: policy/v1beta1 +{{- end }} kind: PodSecurityPolicy metadata: name: {{ default $fullName .Values.podSecurityPolicy.name | quote }} diff --git a/logstash/templates/poddisruptionbudget.yaml b/logstash/templates/poddisruptionbudget.yaml index e2930fe66..a9ac86b3f 100644 --- a/logstash/templates/poddisruptionbudget.yaml +++ b/logstash/templates/poddisruptionbudget.yaml @@ -1,6 +1,10 @@ --- {{- if .Values.maxUnavailable }} +{{- if .Capabilities.APIVersions.Has "policy/v1" -}} +apiVersion: policy/v1 +{{- else}} apiVersion: policy/v1beta1 +{{- end }} kind: PodDisruptionBudget metadata: name: "{{ template "logstash.fullname" . }}-pdb" diff --git a/logstash/templates/podsecuritypolicy.yaml b/logstash/templates/podsecuritypolicy.yaml index 53eef917d..c6f9dbf73 100644 --- a/logstash/templates/podsecuritypolicy.yaml +++ b/logstash/templates/podsecuritypolicy.yaml @@ -1,6 +1,10 @@ {{- if .Values.podSecurityPolicy.create -}} {{- $fullName := include "logstash.fullname" . -}} +{{- if .Capabilities.APIVersions.Has "policy/v1" -}} +apiVersion: policy/v1 +{{- else}} apiVersion: policy/v1beta1 +{{- end }} kind: PodSecurityPolicy metadata: name: {{ default $fullName .Values.podSecurityPolicy.name | quote }}