From 7a54fb15cdd28ca9a4a8ba63eff800c4b245b3f5 Mon Sep 17 00:00:00 2001 From: framsouza Date: Mon, 28 Feb 2022 10:28:29 +0100 Subject: [PATCH] Add support to PodDisruptionBudget policy/v1 (#1420) * Adding support to Ingress networking.k8s.io/v1 * Adjusting ES service name * Removing ingress typo & adjusting python test * Adjusting python tests to use the new ingress version * fixing conflict * Adding support to kubernetes ingress v1 & ClassName * Adding reformatted files * fixing conflict * Adding ClassName & Pathtype on ingress settings * Performing syntax adjustments and removing comments * Adding support to policy/v1 * Add logstash support to policy/v1 * Adding support to podsecuritypolicy Co-authored-by: jmlrt <8582351+jmlrt@users.noreply.github.com> --- elasticsearch/templates/poddisruptionbudget.yaml | 5 ++++- elasticsearch/templates/podsecuritypolicy.yaml | 4 ++++ logstash/templates/poddisruptionbudget.yaml | 4 ++++ logstash/templates/podsecuritypolicy.yaml | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) 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 }}