From b8bf0dd11c59ed498f7564fb4bbb737a4c59d68e Mon Sep 17 00:00:00 2001 From: Tim Hobbs Date: Thu, 11 Jul 2019 18:58:55 +0200 Subject: [PATCH] [stable/fluent-bit] Determine correct PodSecurityPolicy ApiGroup (#15355) * Determine correct PodSecurityPolicy ApiGroup PodSecurityPolicy API Group changed between Kubernetes version 1.13 (extensions) and 1.14 (policy) Signed-off-by: Tim Hobbs * Bump version Signed-off-by: Tim Hobbs --- stable/fluent-bit/Chart.yaml | 2 +- stable/fluent-bit/templates/_helpers.tpl | 10 ++++++++++ stable/fluent-bit/templates/cluster-role.yaml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/stable/fluent-bit/Chart.yaml b/stable/fluent-bit/Chart.yaml index 667edc328b..f18ff784e2 100755 --- a/stable/fluent-bit/Chart.yaml +++ b/stable/fluent-bit/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: fluent-bit -version: 2.4.1 +version: 2.4.2 appVersion: 1.2.1 description: Fast and Lightweight Log/Data Forwarder for Linux, BSD and OSX keywords: diff --git a/stable/fluent-bit/templates/_helpers.tpl b/stable/fluent-bit/templates/_helpers.tpl index 42453daea6..59505cb5b3 100644 --- a/stable/fluent-bit/templates/_helpers.tpl +++ b/stable/fluent-bit/templates/_helpers.tpl @@ -55,3 +55,13 @@ Create the name of the service account to use {{- end -}} {{- end -}} +{{/* +Return the appropriate apiGroup for PodSecurityPolicy. +*/}} +{{- define "rbac.pspApiGroup" -}} +{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "extensions" -}} +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "policy" -}} +{{- end -}} +{{- end -}} diff --git a/stable/fluent-bit/templates/cluster-role.yaml b/stable/fluent-bit/templates/cluster-role.yaml index 19fbf626cb..69c79891d3 100644 --- a/stable/fluent-bit/templates/cluster-role.yaml +++ b/stable/fluent-bit/templates/cluster-role.yaml @@ -17,7 +17,7 @@ rules: - get {{- if .Values.rbac.pspEnabled }} - apiGroups: - - policy + - {{ template "rbac.pspApiGroup" . }} resources: - podsecuritypolicies resourceNames: