feat(prometheus-couchdb-exporter): add configurable apiVersion (#384)

Signed-off-by: Gabriel Melillo <gabriel@melillo.me>
This commit is contained in:
Gabriel Melillo
2020-11-18 17:04:28 +05:30
committed by GitHub
parent 3927541fb1
commit b08985ee72
4 changed files with 15 additions and 4 deletions
@@ -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:
@@ -40,4 +40,15 @@ Create the name of the service account to use
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- 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 -}}
@@ -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" . }}
@@ -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" . }}