Skip to content

Commit

Permalink
Merge pull request grafana#89 from grafana/zanhseh-patch-20201118
Browse files Browse the repository at this point in the history
Fix deprecated role APIs
  • Loading branch information
zanhsieh authored Nov 18, 2020
2 parents e10b57e + 9a5997a commit 1517320
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/grafana/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: grafana
version: 6.1.6
version: 6.1.7
appVersion: 7.3.3
kubeVersion: "^1.8.0-0"
description: The leading tool for querying and visualizing time series and metrics.
Expand Down
11 changes: 11 additions & 0 deletions charts/grafana/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,14 @@ Selector labels ImageRenderer
app.kubernetes.io/name: {{ include "grafana.name" . }}-image-renderer
app.kubernetes.io/instance: {{ .Release.Name }}
{{- 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/grafana/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if and .Values.rbac.create (not .Values.rbac.useExistingRole) -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: {{ template "rbac.apiVersion" . }}
kind: Role
metadata:
name: {{ template "grafana.fullname" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/grafana/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: {{ template "rbac.apiVersion" . }}
kind: RoleBinding
metadata:
name: {{ template "grafana.fullname" . }}
Expand Down

0 comments on commit 1517320

Please sign in to comment.