From 856a06bb7ab42c7f2214654982d52c22393ca6cb Mon Sep 17 00:00:00 2001 From: Jorrit Salverda Date: Mon, 7 Sep 2020 17:42:11 +0200 Subject: [PATCH] [prometheus-blackbox-exporter] fix linting failure due to deprecated api version (see issue #56) (#57) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix linting failure due to deprecated api version (see issue #56) Signed-off-by: Jorrit Salverda * use rbac.apiVersion template to set correct apiVersion for role and rolebinding Signed-off-by: Jorrit Salverda Signed-off-by: André Bauer --- charts/prometheus-blackbox-exporter/Chart.yaml | 2 +- .../templates/_helpers.tpl | 11 +++++++++++ .../prometheus-blackbox-exporter/templates/role.yaml | 2 +- .../templates/rolebinding.yaml | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/charts/prometheus-blackbox-exporter/Chart.yaml b/charts/prometheus-blackbox-exporter/Chart.yaml index 200035423ee1..5f5477500251 100644 --- a/charts/prometheus-blackbox-exporter/Chart.yaml +++ b/charts/prometheus-blackbox-exporter/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Prometheus Blackbox Exporter name: prometheus-blackbox-exporter -version: 4.3.1 +version: 4.3.2 appVersion: 0.16.0 home: https://github.com/prometheus/blackbox_exporter sources: diff --git a/charts/prometheus-blackbox-exporter/templates/_helpers.tpl b/charts/prometheus-blackbox-exporter/templates/_helpers.tpl index c95a3b40d8fb..3fef6cfa82e4 100644 --- a/charts/prometheus-blackbox-exporter/templates/_helpers.tpl +++ b/charts/prometheus-blackbox-exporter/templates/_helpers.tpl @@ -40,3 +40,14 @@ Create the name of the service account to use {{ default "default" .Values.serviceAccount.name }} {{- end -}} {{- end -}} + +{{/* +Return the appropriate apiVersion for rbac. +*/}} +{{- define "rbac.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/charts/prometheus-blackbox-exporter/templates/role.yaml b/charts/prometheus-blackbox-exporter/templates/role.yaml index c8d84f658323..aede83a5f67c 100644 --- a/charts/prometheus-blackbox-exporter/templates/role.yaml +++ b/charts/prometheus-blackbox-exporter/templates/role.yaml @@ -1,5 +1,5 @@ {{- if .Values.pspEnabled }} -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: {{ template "rbac.apiVersion" . }} kind: Role metadata: labels: diff --git a/charts/prometheus-blackbox-exporter/templates/rolebinding.yaml b/charts/prometheus-blackbox-exporter/templates/rolebinding.yaml index 608c4d97afe6..d36899be7181 100644 --- a/charts/prometheus-blackbox-exporter/templates/rolebinding.yaml +++ b/charts/prometheus-blackbox-exporter/templates/rolebinding.yaml @@ -1,5 +1,5 @@ {{- if .Values.pspEnabled }} -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: {{ template "rbac.apiVersion" . }} kind: RoleBinding metadata: labels: