diff --git a/stable/grafana/Chart.yaml b/stable/grafana/Chart.yaml index 016f415a70..502a579fea 100755 --- a/stable/grafana/Chart.yaml +++ b/stable/grafana/Chart.yaml @@ -1,6 +1,7 @@ name: grafana -version: 1.8.0 -appVersion: 5.0.4 +version: 1.9.0 +appVersion: 5.1.2 +kubeVersion: "^1.8.0-0" description: The leading tool for querying and visualizing time series and metrics. home: https://grafana.net icon: https://raw.githubusercontent.com/grafana/grafana/master/public/img/logo_transparent_400x.png diff --git a/stable/grafana/templates/_helpers.tpl b/stable/grafana/templates/_helpers.tpl index 7ca9802ed0..3a3ebd3ec5 100644 --- a/stable/grafana/templates/_helpers.tpl +++ b/stable/grafana/templates/_helpers.tpl @@ -30,3 +30,14 @@ Create chart name and version as used by the chart label. {{- define "grafana.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Create the name of the service account +*/}} +{{- define "grafana.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "grafana.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/stable/grafana/templates/deployment.yaml b/stable/grafana/templates/deployment.yaml index 3e71df65df..df7f1a6c9f 100644 --- a/stable/grafana/templates/deployment.yaml +++ b/stable/grafana/templates/deployment.yaml @@ -29,6 +29,7 @@ spec: {{ toYaml . | indent 8 }} {{- end }} spec: + serviceAccountName: {{ template "grafana.serviceAccountName" . }} {{- if .Values.schedulerName }} schedulerName: "{{ .Values.schedulerName }}" {{- end }} diff --git a/stable/grafana/templates/podsecuritypolicy.yaml b/stable/grafana/templates/podsecuritypolicy.yaml new file mode 100644 index 0000000000..a53c9cb87a --- /dev/null +++ b/stable/grafana/templates/podsecuritypolicy.yaml @@ -0,0 +1,46 @@ +{{- if .Values.rbac.pspEnabled }} +apiVersion: extensions/v1beta1 +kind: PodSecurityPolicy +metadata: + name: {{ template "grafana.fullname" . }} + labels: + app: {{ template "grafana.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + annotations: + seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default' + apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default' + seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default' + apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default' +spec: + privileged: false + allowPrivilegeEscalation: false + requiredDropCapabilities: + - ALL + volumes: + - 'configMap' + - 'emptyDir' + - 'projected' + - 'secret' + - 'downwardAPI' + - 'persistentVolumeClaim' + hostNetwork: false + hostIPC: false + hostPID: false + runAsUser: + rule: 'MustRunAsNonRoot' + seLinux: + rule: 'RunAsAny' + supplementalGroups: + rule: 'MustRunAs' + ranges: + - min: 1 + max: 65535 + fsGroup: + rule: 'MustRunAs' + ranges: + - min: 1 + max: 65535 + readOnlyRootFilesystem: false +{{- end }} diff --git a/stable/grafana/templates/role.yaml b/stable/grafana/templates/role.yaml new file mode 100644 index 0000000000..8091d49f2c --- /dev/null +++ b/stable/grafana/templates/role.yaml @@ -0,0 +1,18 @@ +{{- if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: Role +metadata: + name: {{ template "grafana.fullname" . }} + labels: + app: {{ template "grafana.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +{{- if .Values.rbac.pspEnabled }} +rules: +- apiGroups: ['extensions'] + resources: ['podsecuritypolicies'] + verbs: ['use'] + resourceNames: [{{ template "grafana.fullname" . }}] +{{- end }} +{{- end }} diff --git a/stable/grafana/templates/rolebinding.yaml b/stable/grafana/templates/rolebinding.yaml new file mode 100644 index 0000000000..199e8fe4ed --- /dev/null +++ b/stable/grafana/templates/rolebinding.yaml @@ -0,0 +1,18 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + name: {{ template "grafana.fullname" . }} + labels: + app: {{ template "grafana.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ template "grafana.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ template "grafana.serviceAccountName" . }} +{{- end -}} diff --git a/stable/grafana/templates/serviceaccount.yaml b/stable/grafana/templates/serviceaccount.yaml new file mode 100644 index 0000000000..04601d0544 --- /dev/null +++ b/stable/grafana/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: {{ template "grafana.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + name: {{ template "grafana.serviceAccountName" . }} +{{- end }} diff --git a/stable/grafana/values.yaml b/stable/grafana/values.yaml index 25e2ed845f..e6697bc386 100644 --- a/stable/grafana/values.yaml +++ b/stable/grafana/values.yaml @@ -1,10 +1,17 @@ +rbac: + create: true + pspEnabled: true +serviceAccount: + create: true + name: + replicas: 1 deploymentStrategy: RollingUpdate image: repository: grafana/grafana - tag: 5.0.4 + tag: 5.1.2 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets.