[stable/node-problem-detector] Template apiVersion for podSecurityPolicy (#19769)

* Template apiVersion for podSecurityPolicy for k8s version v1.16.3 or newer

Signed-off-by: Nikita Gorlov <nv30over@gmail.com>

* Updated chart version

Signed-off-by: Nikita Gorlov <nv30over@gmail.com>
This commit is contained in:
Nikita Gorlov
2019-12-27 05:09:39 -08:00
committed by Kubernetes Prow Robot
parent 0a846e8858
commit 81a4812bb5
3 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: node-problem-detector
version: "1.6.1"
version: "1.6.2"
appVersion: v0.7.0
home: https://github.com/kubernetes/node-problem-detector
description: Installs the node-problem-detector daemonset for monitoring extra attributes on nodes
@@ -48,3 +48,14 @@ Create the name of the configmap for storing custom monitor definitions
{{- $fullname := include "node-problem-detector.fullname" . -}}
{{- printf "%s-custom-config" $fullname | replace "+" "_" | trunc 63 -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for podSecurityPolicy.
*/}}
{{- define "podSecurityPolicy.apiVersion" -}}
{{- if semverCompare ">=1.10-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "policy/v1beta1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}
@@ -1,5 +1,5 @@
{{- if .Values.rbac.pspEnabled }}
apiVersion: extensions/v1beta1
apiVersion: {{ template "podSecurityPolicy.apiVersion" . }}
kind: PodSecurityPolicy
metadata:
name: {{ template "node-problem-detector.fullname" . }}