diff --git a/charts/prometheus-couchdb-exporter/Chart.yaml b/charts/prometheus-couchdb-exporter/Chart.yaml index ae5b7eec..40af12fd 100644 --- a/charts/prometheus-couchdb-exporter/Chart.yaml +++ b/charts/prometheus-couchdb-exporter/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "1.0" description: A Helm chart to export the metrics from couchdb in Prometheus format. name: prometheus-couchdb-exporter home: https://github.com/gesellix/couchdb-prometheus-exporter -version: 0.1.3 +version: 0.2.0 keywords: - couchdb-exporter sources: diff --git a/charts/prometheus-couchdb-exporter/templates/_helpers.tpl b/charts/prometheus-couchdb-exporter/templates/_helpers.tpl index e37e8ebc..d7ea406c 100644 --- a/charts/prometheus-couchdb-exporter/templates/_helpers.tpl +++ b/charts/prometheus-couchdb-exporter/templates/_helpers.tpl @@ -40,4 +40,15 @@ Create the name of the service account to use {{- else -}} {{ default "default" .Values.serviceAccount.name }} {{- end -}} -{{- end -}} \ No newline at end of file +{{- 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 -}} diff --git a/charts/prometheus-couchdb-exporter/templates/role.yaml b/charts/prometheus-couchdb-exporter/templates/role.yaml index 4a22e40b..30c66457 100644 --- a/charts/prometheus-couchdb-exporter/templates/role.yaml +++ b/charts/prometheus-couchdb-exporter/templates/role.yaml @@ -1,5 +1,5 @@ {{- if .Values.rbac.create }} -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: {{ template "rbac.apiVersion" . }} kind: Role metadata: name: {{ template "prometheus-couchdb-exporter.fullname" . }} diff --git a/charts/prometheus-couchdb-exporter/templates/rolebinding.yaml b/charts/prometheus-couchdb-exporter/templates/rolebinding.yaml index bd80e722..46941f7e 100644 --- a/charts/prometheus-couchdb-exporter/templates/rolebinding.yaml +++ b/charts/prometheus-couchdb-exporter/templates/rolebinding.yaml @@ -1,5 +1,5 @@ {{- if .Values.rbac.create -}} -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: {{ template "rbac.apiVersion" . }} kind: RoleBinding metadata: name: {{ template "prometheus-couchdb-exporter.fullname" . }}