Skip to content

Commit

Permalink
[prometheus-blackbox-exporter] fix linting failure due to deprecated …
Browse files Browse the repository at this point in the history
…api version (see issue prometheus-community#56) (prometheus-community#57)

* fix linting failure due to deprecated api version (see issue prometheus-community#56)

Signed-off-by: Jorrit Salverda <jsalverda@travix.com>

* use rbac.apiVersion template to set correct apiVersion for role and rolebinding

Signed-off-by: Jorrit Salverda <jsalverda@travix.com>
Signed-off-by: André Bauer <andre.bauer@kiwigrid.com>
  • Loading branch information
JorritSalverda authored and André Bauer committed Oct 7, 2020
1 parent 7b7dfed commit 856a06b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-blackbox-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
11 changes: 11 additions & 0 deletions charts/prometheus-blackbox-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
2 changes: 1 addition & 1 deletion charts/prometheus-blackbox-exporter/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.pspEnabled }}
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: {{ template "rbac.apiVersion" . }}
kind: Role
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.pspEnabled }}
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: {{ template "rbac.apiVersion" . }}
kind: RoleBinding
metadata:
labels:
Expand Down

0 comments on commit 856a06b

Please sign in to comment.