allowing option to deploy namespaced grafana rbac rules (#10846)

Signed-off-by: Sergio Millan Rodriguez <sergio.rodriguez@ticketmaster.co.uk>
This commit is contained in:
Sergio Millan
2019-01-26 22:19:43 -08:00
committed by Kubernetes Prow Robot
parent 11fa809d7a
commit fee2557f99
7 changed files with 32 additions and 6 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: grafana
version: 1.25.3
version: 1.25.4
appVersion: 5.4.3
kubeVersion: "^1.8.0-0"
description: The leading tool for querying and visualizing time series and metrics.
+1
View File
@@ -88,6 +88,7 @@ The command removes all the Kubernetes components associated with the chart and
| `admin.userKey` | The key in the existing admin secret containing the username. | `"admin-user"` |
| `admin.passwordKey` | The key in the existing admin secret containing the password. | `"admin-password"` |
| `rbac.create` | Create and use RBAC resources | `true` |
| `rbac.namespaced` | Creates Role and Rolebinding instead of the default ClusterRole and ClusteRoleBindings for the grafana instance | `false` |
| `rbac.pspEnabled` | Create PodSecurityPolicy (with `rbac.create`, grant roles permissions as well) | `true` |
| `rbac.pspUseAppArmor` | Enforce AppArmor in created PodSecurityPolicy (requires `rbac.pspEnabled`) | `true` |
+1 -1
View File
@@ -1,4 +1,4 @@
{{- if .Values.rbac.create }}
{{- if and .Values.rbac.create (not .Values.rbac.namespaced) }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
@@ -1,4 +1,4 @@
{{- if .Values.rbac.create }}
{{- if and .Values.rbac.create (not .Values.rbac.namespaced) }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
@@ -20,4 +20,4 @@ roleRef:
kind: ClusterRole
name: {{ template "grafana.fullname" . }}-clusterrole
apiGroup: rbac.authorization.k8s.io
{{- end}}
{{- end -}}
+15 -2
View File
@@ -1,4 +1,4 @@
{{- if .Values.rbac.create }}
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
@@ -8,11 +8,24 @@ metadata:
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- if .Values.rbac.pspEnabled }}
{{- with .Values.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
{{- if or .Values.rbac.pspEnabled (and .Values.rbac.namespaced (or .Values.sidecar.dashboards.enabled .Values.sidecar.datasources.enabled)) }}
rules:
{{- if .Values.rbac.pspEnabled }}
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames: [{{ template "grafana.fullname" . }}]
{{- end }}
{{- if and .Values.rbac.namespaced (or .Values.sidecar.dashboards.enabled .Values.sidecar.datasources.enabled) }}
- apiGroups: [""] # "" indicates the core API group
resources: ["configmaps"]
verbs: ["get", "watch", "list"]
{{- end }}
{{- else }}
rules: []
{{- end }}
{{- end }}
+11
View File
@@ -8,6 +8,10 @@ metadata:
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- with .Values.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
@@ -15,4 +19,11 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ template "grafana.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- if .Values.rbac.namespaced }}
roleRef:
kind: Role
name: {{ template "grafana.fullname" . }}
apiGroup: rbac.authorization.k8s.io
{{- end }}
{{- end -}}
+1
View File
@@ -2,6 +2,7 @@ rbac:
create: true
pspEnabled: true
pspUseAppArmor: true
namespaced: false
serviceAccount:
create: true
name: