From 04558452f6485420c03e074496da2b037cf629a9 Mon Sep 17 00:00:00 2001 From: Juan Ariza Toledano Date: Fri, 20 Sep 2019 17:41:42 +0200 Subject: [PATCH] [stable/external-dns] Update psp apiVersion to 'policy/v1beta1' - Mandatory for K8s 1.16 (#17288) * [stable/external-dns] Update psp apiVersion to 'policy/v1beta1' - Mandatory for K8s 1.16 Signed-off-by: juan131 * Update prerequisites Signed-off-by: juan131 * Add a macro to decide the ApiVersion to use for PSP based on K8s API Signed-off-by: juan131 * Fix chart version Signed-off-by: juan131 --- stable/external-dns/Chart.yaml | 2 +- stable/external-dns/templates/_helpers.tpl | 11 +++++++++++ stable/external-dns/templates/psp.yaml | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/stable/external-dns/Chart.yaml b/stable/external-dns/Chart.yaml index 6ea7d85138..1fc5bc730f 100644 --- a/stable/external-dns/Chart.yaml +++ b/stable/external-dns/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: external-dns -version: 2.6.3 +version: 2.6.4 appVersion: 0.5.17 description: ExternalDNS is a Kubernetes addon that configures public DNS servers with information about exposed Kubernetes services to make them discoverable. keywords: diff --git a/stable/external-dns/templates/_helpers.tpl b/stable/external-dns/templates/_helpers.tpl index 96f88028cb..fa6ab79cbb 100644 --- a/stable/external-dns/templates/_helpers.tpl +++ b/stable/external-dns/templates/_helpers.tpl @@ -206,6 +206,17 @@ external-dns: infoblox.wapiPassword {{- end -}} {{- end -}} +{{/* +Return the appropriate apiVersion for PodSecurityPolicy. +*/}} +{{- define "podSecurityPolicy.apiVersion" -}} +{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "extensions/v1beta1" -}} +{{- end -}} +{{- end -}} + {{/* Validate values of External DNS: - must provide the PowerDNS API URL when provider is "pdns" diff --git a/stable/external-dns/templates/psp.yaml b/stable/external-dns/templates/psp.yaml index 5a1627829d..b944849016 100644 --- a/stable/external-dns/templates/psp.yaml +++ b/stable/external-dns/templates/psp.yaml @@ -1,5 +1,5 @@ {{- if .Values.rbac.pspEnabled }} -apiVersion: extensions/v1beta1 +apiVersion: {{ template "podSecurityPolicy.apiVersion" . }} kind: PodSecurityPolicy metadata: name: {{ template "external-dns.fullname" . }}