feat: latest prometheus versions

This commit is contained in:
Stefan Reimer 2022-12-06 20:43:11 +00:00
parent c5a414b136
commit 7faf1cb487
152 changed files with 46358 additions and 1924 deletions

View File

@ -169,6 +169,9 @@ kubectl delete deployment argocd-redis -n argocd || true
kubectl delete deployment argocd-repo-server -n argocd || true kubectl delete deployment argocd-repo-server -n argocd || true
kubectl delete statefulset argocd-application-controller -n argocd || true kubectl delete statefulset argocd-application-controller -n argocd || true
# Delete prometheus-push gateway due to label changes
kubectl delete deploy -l app=prometheus-pushgateway -n monitoring || true
control_plane_upgrade "apply_cert-manager, apply_istio, apply_istio-ingress, apply_istio-private-ingress, apply_logging, apply_metrics, apply_argocd" control_plane_upgrade "apply_cert-manager, apply_istio, apply_istio-ingress, apply_istio-private-ingress, apply_logging, apply_metrics, apply_argocd"
# Final step is to commit the new argocd kubezero app # Final step is to commit the new argocd kubezero app

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: kubezero-metrics name: kubezero-metrics
description: KubeZero Umbrella Chart for Prometheus, Grafana and Alertmanager as well as all Kubernetes integrations. description: KubeZero Umbrella Chart for Prometheus, Grafana and Alertmanager as well as all Kubernetes integrations.
type: application type: application
version: 0.8.7 version: 0.8.8
home: https://kubezero.com home: https://kubezero.com
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png
keywords: keywords:
@ -18,16 +18,16 @@ dependencies:
version: ">= 0.1.5" version: ">= 0.1.5"
repository: https://cdn.zero-downtime.net/charts/ repository: https://cdn.zero-downtime.net/charts/
- name: kube-prometheus-stack - name: kube-prometheus-stack
version: 41.4.1 version: 42.2.1
# Switch back to upstream once all alerts are fixed eg. etcd gpcr # Switch back to upstream once all alerts are fixed eg. etcd gpcr
# repository: https://prometheus-community.github.io/helm-charts # repository: https://prometheus-community.github.io/helm-charts
- name: prometheus-adapter - name: prometheus-adapter
version: 3.4.0 version: 3.4.2
repository: https://prometheus-community.github.io/helm-charts repository: https://prometheus-community.github.io/helm-charts
condition: prometheus-adapter.enabled condition: prometheus-adapter.enabled
- name: prometheus-pushgateway - name: prometheus-pushgateway
version: 1.20.0 version: 2.0.2
# Switch back to upstream once namespaces are supported # Switch back to upstream once namespaces are supported
# repository: https://prometheus-community.github.io/helm-charts repository: https://prometheus-community.github.io/helm-charts
condition: prometheus-pushgateway.enabled condition: prometheus-pushgateway.enabled
kubeVersion: ">= 1.24.0" kubeVersion: ">= 1.24.0"

View File

@ -11,15 +11,15 @@ dependencies:
- condition: kubeStateMetrics.enabled - condition: kubeStateMetrics.enabled
name: kube-state-metrics name: kube-state-metrics
repository: https://prometheus-community.github.io/helm-charts repository: https://prometheus-community.github.io/helm-charts
version: 4.20.* version: 4.24.*
- condition: nodeExporter.enabled - condition: nodeExporter.enabled
name: prometheus-node-exporter name: prometheus-node-exporter
repository: https://prometheus-community.github.io/helm-charts repository: https://prometheus-community.github.io/helm-charts
version: 4.3.* version: 4.8.*
- condition: grafana.enabled - condition: grafana.enabled
name: grafana name: grafana
repository: https://grafana.github.io/helm-charts repository: https://grafana.github.io/helm-charts
version: 6.40.* version: 6.45.*
description: kube-prometheus-stack collects Kubernetes manifests, Grafana dashboards, description: kube-prometheus-stack collects Kubernetes manifests, Grafana dashboards,
and Prometheus rules combined with documentation and scripts to provide easy to and Prometheus rules combined with documentation and scripts to provide easy to
operate end-to-end Kubernetes cluster monitoring with Prometheus using the Prometheus operate end-to-end Kubernetes cluster monitoring with Prometheus using the Prometheus
@ -34,8 +34,6 @@ kubeVersion: '>=1.16.0-0'
maintainers: maintainers:
- email: andrew@quadcorps.co.uk - email: andrew@quadcorps.co.uk
name: andrewgkew name: andrewgkew
- email: cedric@desaintmartin.fr
name: desaintmartin
- email: gianrubio@gmail.com - email: gianrubio@gmail.com
name: gianrubio name: gianrubio
- email: github.gkarthiks@gmail.com - email: github.gkarthiks@gmail.com
@ -46,9 +44,11 @@ maintainers:
name: scottrigby name: scottrigby
- email: miroslav.hadzhiev@gmail.com - email: miroslav.hadzhiev@gmail.com
name: Xtigyro name: Xtigyro
- email: quentin.bisson@gmail.com
name: QuentinBisson
name: kube-prometheus-stack name: kube-prometheus-stack
sources: sources:
- https://github.com/prometheus-community/helm-charts - https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus - https://github.com/prometheus-operator/kube-prometheus
type: application type: application
version: 41.4.1 version: 42.2.1

View File

@ -80,6 +80,29 @@ _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documen
A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an incompatible breaking change needing manual actions. A major chart version change (like v1.2.3 -> v2.0.0) indicates that there is an incompatible breaking change needing manual actions.
### From 41.x to 42.x
This includes the overridability of container registry for all containers at the global level using `global.imageRegistry` or per container image. The defaults have not changed but if you were using a custom image, you will have to override the registry of said custom container image before you upgrade.
For instance, the prometheus-config-reloader used to be configured as follow:
```yaml
image:
repository: quay.io/prometheus-operator/prometheus-config-reloader
tag: v0.60.1
sha: ""
```
But it now moved to:
```yaml
image:
registry: quay.io
repository: prometheus-operator/prometheus-config-reloader
tag: v0.60.1
sha: ""
```
### From 40.x to 41.x ### From 40.x to 41.x
This version upgrades Prometheus-Operator to v0.60.1, Prometheus to v2.39.1 and Thanos to v0.28.1. This version upgrades Prometheus-Operator to v0.60.1, Prometheus to v2.39.1 and Thanos to v0.28.1.

View File

@ -1,5 +1,5 @@
apiVersion: v2 apiVersion: v2
appVersion: 9.1.7 appVersion: 9.3.0
description: The leading tool for querying and visualizing time series and metrics. description: The leading tool for querying and visualizing time series and metrics.
home: https://grafana.net home: https://grafana.net
icon: https://raw.githubusercontent.com/grafana/grafana/master/public/img/logo_transparent_400x.png icon: https://raw.githubusercontent.com/grafana/grafana/master/public/img/logo_transparent_400x.png
@ -19,4 +19,4 @@ name: grafana
sources: sources:
- https://github.com/grafana/grafana - https://github.com/grafana/grafana
type: application type: application
version: 6.40.4 version: 6.45.0

View File

@ -104,6 +104,7 @@ This version requires Helm >= 3.1.0.
| `persistence.accessModes` | Persistence access modes | `[ReadWriteOnce]` | | `persistence.accessModes` | Persistence access modes | `[ReadWriteOnce]` |
| `persistence.annotations` | PersistentVolumeClaim annotations | `{}` | | `persistence.annotations` | PersistentVolumeClaim annotations | `{}` |
| `persistence.finalizers` | PersistentVolumeClaim finalizers | `[ "kubernetes.io/pvc-protection" ]` | | `persistence.finalizers` | PersistentVolumeClaim finalizers | `[ "kubernetes.io/pvc-protection" ]` |
| `persistence.extraPvcLabels` | Extra labels to apply to a PVC. | `{}` |
| `persistence.subPath` | Mount a sub dir of the persistent volume (can be templated) | `nil` | | `persistence.subPath` | Mount a sub dir of the persistent volume (can be templated) | `nil` |
| `persistence.inMemory.enabled` | If persistence is not enabled, whether to mount the local storage in-memory to improve performance | `false` | | `persistence.inMemory.enabled` | If persistence is not enabled, whether to mount the local storage in-memory to improve performance | `false` |
| `persistence.inMemory.sizeLimit` | SizeLimit for the in-memory local storage | `nil` | | `persistence.inMemory.sizeLimit` | SizeLimit for the in-memory local storage | `nil` |
@ -134,6 +135,7 @@ This version requires Helm >= 3.1.0.
| `dashboards` | Dashboards to import | `{}` | | `dashboards` | Dashboards to import | `{}` |
| `dashboardsConfigMaps` | ConfigMaps reference that contains dashboards | `{}` | | `dashboardsConfigMaps` | ConfigMaps reference that contains dashboards | `{}` |
| `grafana.ini` | Grafana's primary configuration | `{}` | | `grafana.ini` | Grafana's primary configuration | `{}` |
| `global.imagePullSecrets` | Global image pull secrets (can be templated). Allows either an array of {name: pullSecret} maps (k8s-style), or an array of strings (more common helm-style). | `[]` |
| `ldap.enabled` | Enable LDAP authentication | `false` | | `ldap.enabled` | Enable LDAP authentication | `false` |
| `ldap.existingSecret` | The name of an existing secret containing the `ldap.toml` file, this must have the key `ldap-toml`. | `""` | | `ldap.existingSecret` | The name of an existing secret containing the `ldap.toml` file, this must have the key `ldap-toml`. | `""` |
| `ldap.config` | Grafana's LDAP configuration | `""` | | `ldap.config` | Grafana's LDAP configuration | `""` |
@ -206,6 +208,7 @@ This version requires Helm >= 3.1.0.
| `serviceAccount.autoMount` | Automount the service account token in the pod| `true` | | `serviceAccount.autoMount` | Automount the service account token in the pod| `true` |
| `serviceAccount.annotations` | ServiceAccount annotations | | | `serviceAccount.annotations` | ServiceAccount annotations | |
| `serviceAccount.create` | Create service account | `true` | | `serviceAccount.create` | Create service account | `true` |
| `serviceAccount.labels` | ServiceAccount labels | `{}` |
| `serviceAccount.name` | Service account name to use, when empty will be set to created account if `serviceAccount.create` is set else to `default` | `` | | `serviceAccount.name` | Service account name to use, when empty will be set to created account if `serviceAccount.create` is set else to `default` | `` |
| `serviceAccount.nameTest` | Service account name to use for test, when empty will be set to created account if `serviceAccount.create` is set else to `default` | `nil` | | `serviceAccount.nameTest` | Service account name to use for test, when empty will be set to created account if `serviceAccount.create` is set else to `default` | `nil` |
| `rbac.create` | Create and use RBAC resources | `true` | | `rbac.create` | Create and use RBAC resources | `true` |

View File

@ -1,6 +1,6 @@
extraConfigmapMounts: extraConfigmapMounts:
- name: '{{ template "grafana.fullname" . }}' - name: '{{ include "grafana.fullname" . }}'
configMap: '{{ template "grafana.fullname" . }}' configMap: '{{ include "grafana.fullname" . }}'
mountPath: /var/lib/grafana/dashboards/test-dashboard.json mountPath: /var/lib/grafana/dashboards/test-dashboard.json
# This is not a realistic test, but for this we only care about extraConfigmapMounts not being empty and pointing to an existing ConfigMap # This is not a realistic test, but for this we only care about extraConfigmapMounts not being empty and pointing to an existing ConfigMap
subPath: grafana.ini subPath: grafana.ini

View File

@ -1,10 +1,10 @@
1. Get your '{{ .Values.adminUser }}' user password by running: 1. Get your '{{ .Values.adminUser }}' user password by running:
kubectl get secret --namespace {{ template "grafana.namespace" . }} {{ template "grafana.fullname" . }} -o jsonpath="{.data.admin-password}" | base64 --decode ; echo kubectl get secret --namespace {{ include "grafana.namespace" . }} {{ include "grafana.fullname" . }} -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
2. The Grafana server can be accessed via port {{ .Values.service.port }} on the following DNS name from within your cluster: 2. The Grafana server can be accessed via port {{ .Values.service.port }} on the following DNS name from within your cluster:
{{ template "grafana.fullname" . }}.{{ template "grafana.namespace" . }}.svc.cluster.local {{ include "grafana.fullname" . }}.{{ include "grafana.namespace" . }}.svc.cluster.local
{{ if .Values.ingress.enabled }} {{ if .Values.ingress.enabled }}
If you bind grafana to 80, please update values in values.yaml and reinstall: If you bind grafana to 80, please update values in values.yaml and reinstall:
``` ```
@ -24,24 +24,24 @@
Or grafana would always crash. Or grafana would always crash.
From outside the cluster, the server URL(s) are: From outside the cluster, the server URL(s) are:
{{- range .Values.ingress.hosts }} {{- range .Values.ingress.hosts }}
http://{{ . }} http://{{ . }}
{{- end }} {{- end }}
{{ else }} {{- else }}
Get the Grafana URL to visit by running these commands in the same shell: Get the Grafana URL to visit by running these commands in the same shell:
{{ if contains "NodePort" .Values.service.type -}} {{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ template "grafana.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "grafana.fullname" . }}) export NODE_PORT=$(kubectl get --namespace {{ include "grafana.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "grafana.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ template "grafana.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}") export NODE_IP=$(kubectl get nodes --namespace {{ include "grafana.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT echo http://$NODE_IP:$NODE_PORT
{{ else if contains "LoadBalancer" .Values.service.type -}} {{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available. NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc --namespace {{ template "grafana.namespace" . }} -w {{ template "grafana.fullname" . }}' You can watch the status of by running 'kubectl get svc --namespace {{ include "grafana.namespace" . }} -w {{ include "grafana.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ template "grafana.namespace" . }} {{ template "grafana.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') export SERVICE_IP=$(kubectl get svc --namespace {{ include "grafana.namespace" . }} {{ include "grafana.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
http://$SERVICE_IP:{{ .Values.service.port -}} http://$SERVICE_IP:{{ .Values.service.port -}}
{{ else if contains "ClusterIP" .Values.service.type }} {{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ template "grafana.namespace" . }} -l "app.kubernetes.io/name={{ template "grafana.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export POD_NAME=$(kubectl get pods --namespace {{ include "grafana.namespace" . }} -l "app.kubernetes.io/name={{ include "grafana.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace {{ template "grafana.namespace" . }} port-forward $POD_NAME 3000 kubectl --namespace {{ include "grafana.namespace" . }} port-forward $POD_NAME 3000
{{- end }} {{- end }}
{{- end }} {{- end }}
3. Login with the password from step 1 and the username: {{ .Values.adminUser }} 3. Login with the password from step 1 and the username: {{ .Values.adminUser }}

View File

@ -3,8 +3,8 @@
Expand the name of the chart. Expand the name of the chart.
*/}} */}}
{{- define "grafana.name" -}} {{- define "grafana.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end -}} {{- end }}
{{/* {{/*
Create a default fully qualified app name. Create a default fully qualified app name.
@ -12,54 +12,54 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
If release name contains chart name it will be used as a full name. If release name contains chart name it will be used as a full name.
*/}} */}}
{{- define "grafana.fullname" -}} {{- define "grafana.fullname" -}}
{{- if .Values.fullnameOverride -}} {{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else -}} {{- else }}
{{- $name := default .Chart.Name .Values.nameOverride -}} {{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name -}} {{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} {{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else -}} {{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* {{/*
Create chart name and version as used by the chart label. Create chart name and version as used by the chart label.
*/}} */}}
{{- define "grafana.chart" -}} {{- define "grafana.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end -}} {{- end }}
{{/* {{/*
Create the name of the service account Create the name of the service account
*/}} */}}
{{- define "grafana.serviceAccountName" -}} {{- define "grafana.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}} {{- if .Values.serviceAccount.create }}
{{ default (include "grafana.fullname" .) .Values.serviceAccount.name }} {{- default (include "grafana.fullname" .) .Values.serviceAccount.name }}
{{- else -}} {{- else }}
{{ default "default" .Values.serviceAccount.name }} {{- default "default" .Values.serviceAccount.name }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{- define "grafana.serviceAccountNameTest" -}} {{- define "grafana.serviceAccountNameTest" -}}
{{- if .Values.serviceAccount.create -}} {{- if .Values.serviceAccount.create }}
{{ default (print (include "grafana.fullname" .) "-test") .Values.serviceAccount.nameTest }} {{- default (print (include "grafana.fullname" .) "-test") .Values.serviceAccount.nameTest }}
{{- else -}} {{- else }}
{{ default "default" .Values.serviceAccount.nameTest }} {{- default "default" .Values.serviceAccount.nameTest }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* {{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}} */}}
{{- define "grafana.namespace" -}} {{- define "grafana.namespace" -}}
{{- if .Values.namespaceOverride -}} {{- if .Values.namespaceOverride }}
{{- .Values.namespaceOverride -}} {{- .Values.namespaceOverride }}
{{- else -}} {{- else }}
{{- .Release.Namespace -}} {{- .Release.Namespace }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* {{/*
Common labels Common labels
@ -71,10 +71,10 @@ helm.sh/chart: {{ include "grafana.chart" . }}
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }} app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
{{- end }} {{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.extraLabels }} {{- with .Values.extraLabels }}
{{ toYaml .Values.extraLabels }} {{ toYaml . }}
{{- end }}
{{- end }} {{- end }}
{{- end -}}
{{/* {{/*
Selector labels Selector labels
@ -82,7 +82,7 @@ Selector labels
{{- define "grafana.selectorLabels" -}} {{- define "grafana.selectorLabels" -}}
app.kubernetes.io/name: {{ include "grafana.name" . }} app.kubernetes.io/name: {{ include "grafana.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}} {{- end }}
{{/* {{/*
Common labels Common labels
@ -94,7 +94,7 @@ helm.sh/chart: {{ include "grafana.chart" . }}
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }} app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
{{- end }} {{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}} {{- end }}
{{/* {{/*
Selector labels ImageRenderer Selector labels ImageRenderer
@ -102,73 +102,87 @@ Selector labels ImageRenderer
{{- define "grafana.imageRenderer.selectorLabels" -}} {{- define "grafana.imageRenderer.selectorLabels" -}}
app.kubernetes.io/name: {{ include "grafana.name" . }}-image-renderer app.kubernetes.io/name: {{ include "grafana.name" . }}-image-renderer
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}} {{- end }}
{{/* {{/*
Looks if there's an existing secret and reuse its password. If not it generates Looks if there's an existing secret and reuse its password. If not it generates
new password and use it. new password and use it.
*/}} */}}
{{- define "grafana.password" -}} {{- define "grafana.password" -}}
{{- $secret := (lookup "v1" "Secret" (include "grafana.namespace" .) (include "grafana.fullname" .) ) -}} {{- $secret := (lookup "v1" "Secret" (include "grafana.namespace" .) (include "grafana.fullname" .) ) }}
{{- if $secret -}} {{- if $secret }}
{{- index $secret "data" "admin-password" -}} {{- index $secret "data" "admin-password" }}
{{- else -}} {{- else }}
{{- (randAlphaNum 40) | b64enc | quote -}} {{- (randAlphaNum 40) | b64enc | quote }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* {{/*
Return the appropriate apiVersion for rbac. Return the appropriate apiVersion for rbac.
*/}} */}}
{{- define "grafana.rbac.apiVersion" -}} {{- define "grafana.rbac.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }} {{- if $.Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1" }}
{{- print "rbac.authorization.k8s.io/v1" -}} {{- print "rbac.authorization.k8s.io/v1" }}
{{- else -}} {{- else }}
{{- print "rbac.authorization.k8s.io/v1beta1" -}} {{- print "rbac.authorization.k8s.io/v1beta1" }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* {{/*
Return the appropriate apiVersion for ingress. Return the appropriate apiVersion for ingress.
*/}} */}}
{{- define "grafana.ingress.apiVersion" -}} {{- define "grafana.ingress.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) -}} {{- if and ($.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) }}
{{- print "networking.k8s.io/v1" -}} {{- print "networking.k8s.io/v1" }}
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}} {{- else if $.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
{{- print "networking.k8s.io/v1beta1" -}} {{- print "networking.k8s.io/v1beta1" }}
{{- else -}} {{- else }}
{{- print "extensions/v1beta1" -}} {{- print "extensions/v1beta1" }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* {{/*
Return the appropriate apiVersion for podDisruptionBudget. Return the appropriate apiVersion for podDisruptionBudget.
*/}} */}}
{{- define "grafana.podDisruptionBudget.apiVersion" -}} {{- define "grafana.podDisruptionBudget.apiVersion" -}}
{{- if $.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget" -}} {{- if $.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget" }}
{{- print "policy/v1" -}} {{- print "policy/v1" }}
{{- else -}} {{- else }}
{{- print "policy/v1beta1" -}} {{- print "policy/v1beta1" }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* {{/*
Return if ingress is stable. Return if ingress is stable.
*/}} */}}
{{- define "grafana.ingress.isStable" -}} {{- define "grafana.ingress.isStable" -}}
{{- eq (include "grafana.ingress.apiVersion" .) "networking.k8s.io/v1" -}} {{- eq (include "grafana.ingress.apiVersion" .) "networking.k8s.io/v1" }}
{{- end -}} {{- end }}
{{/* {{/*
Return if ingress supports ingressClassName. Return if ingress supports ingressClassName.
*/}} */}}
{{- define "grafana.ingress.supportsIngressClassName" -}} {{- define "grafana.ingress.supportsIngressClassName" -}}
{{- or (eq (include "grafana.ingress.isStable" .) "true") (and (eq (include "grafana.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} {{- or (eq (include "grafana.ingress.isStable" .) "true") (and (eq (include "grafana.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
{{- end -}} {{- end }}
{{/* {{/*
Return if ingress supports pathType. Return if ingress supports pathType.
*/}} */}}
{{- define "grafana.ingress.supportsPathType" -}} {{- define "grafana.ingress.supportsPathType" -}}
{{- or (eq (include "grafana.ingress.isStable" .) "true") (and (eq (include "grafana.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}} {{- or (eq (include "grafana.ingress.isStable" .) "true") (and (eq (include "grafana.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
{{- end -}} {{- end }}
{{/*
Formats imagePullSecrets. Input is (dict "root" . "imagePullSecrets" .{specific imagePullSecrets})
*/}}
{{- define "grafana.imagePullSecrets" -}}
{{- $root := .root }}
{{- range (concat .root.Values.global.imagePullSecrets .imagePullSecrets) }}
{{- if eq (typeOf .) "map[string]interface {}" }}
- {{ toYaml (dict "name" (tpl .name $root)) | trim }}
{{- else }}
- name: {{ tpl . $root }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -1,8 +1,9 @@
{{- define "grafana.pod" -}} {{- define "grafana.pod" -}}
{{- if .Values.schedulerName }} {{- $root := . -}}
schedulerName: "{{ .Values.schedulerName }}" {{- with .Values.schedulerName }}
schedulerName: "{{ . }}"
{{- end }} {{- end }}
serviceAccountName: {{ template "grafana.serviceAccountName" . }} serviceAccountName: {{ include "grafana.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.autoMount }} automountServiceAccountToken: {{ .Values.serviceAccount.autoMount }}
{{- with .Values.securityContext }} {{- with .Values.securityContext }}
securityContext: securityContext:
@ -12,8 +13,8 @@ securityContext:
hostAliases: hostAliases:
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}
{{- end }} {{- end }}
{{- if .Values.priorityClassName }} {{- with .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }} priorityClassName: {{ . }}
{{- end }} {{- end }}
{{- if ( or .Values.persistence.enabled .Values.dashboards .Values.extraInitContainers (and .Values.sidecar.datasources.enabled .Values.sidecar.datasources.initDatasources) (and .Values.sidecar.notifiers.enabled .Values.sidecar.notifiers.initNotifiers)) }} {{- if ( or .Values.persistence.enabled .Values.dashboards .Values.extraInitContainers (and .Values.sidecar.datasources.enabled .Values.sidecar.datasources.initDatasources) (and .Values.sidecar.notifiers.enabled .Values.sidecar.notifiers.initNotifiers)) }}
initContainers: initContainers:
@ -26,10 +27,15 @@ initContainers:
image: "{{ .Values.initChownData.image.repository }}:{{ .Values.initChownData.image.tag }}" image: "{{ .Values.initChownData.image.repository }}:{{ .Values.initChownData.image.tag }}"
{{- end }} {{- end }}
imagePullPolicy: {{ .Values.initChownData.image.pullPolicy }} imagePullPolicy: {{ .Values.initChownData.image.pullPolicy }}
{{- with .Values.initChownData.securityContext }}
securityContext: securityContext:
runAsNonRoot: false {{- toYaml . | nindent 6 }}
runAsUser: 0 {{- end }}
command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.runAsGroup }}", "/var/lib/grafana"] command:
- chown
- -R
- {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.runAsGroup }}
- /var/lib/grafana
{{- with .Values.initChownData.resources }} {{- with .Values.initChownData.resources }}
resources: resources:
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
@ -37,9 +43,9 @@ initContainers:
volumeMounts: volumeMounts:
- name: storage - name: storage
mountPath: "/var/lib/grafana" mountPath: "/var/lib/grafana"
{{- if .Values.persistence.subPath }} {{- with .Values.persistence.subPath }}
subPath: {{ tpl .Values.persistence.subPath . }} subPath: {{ tpl . $root }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.dashboards }} {{- if .Values.dashboards }}
- name: download-dashboards - name: download-dashboards
@ -56,36 +62,41 @@ initContainers:
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
env: env:
{{- range $key, $value := .Values.downloadDashboards.env }} {{- range $key, $value := .Values.downloadDashboards.env }}
- name: "{{ $key }}" - name: "{{ $key }}"
value: "{{ $value }}" value: "{{ $value }}"
{{- end }} {{- end }}
{{- range $key, $value := .Values.downloadDashboards.envValueFrom }}
- name: {{ $key | quote }}
valueFrom:
{{- tpl (toYaml $value) $ | nindent 10 }}
{{- end }}
{{- with .Values.downloadDashboards.securityContext }} {{- with .Values.downloadDashboards.securityContext }}
securityContext: securityContext:
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
{{- if .Values.downloadDashboards.envFromSecret }} {{- with .Values.downloadDashboards.envFromSecret }}
envFrom: envFrom:
- secretRef: - secretRef:
name: {{ tpl .Values.downloadDashboards.envFromSecret . }} name: {{ tpl . $root }}
{{- end }} {{- end }}
volumeMounts: volumeMounts:
- name: config - name: config
mountPath: "/etc/grafana/download_dashboards.sh" mountPath: "/etc/grafana/download_dashboards.sh"
subPath: download_dashboards.sh subPath: download_dashboards.sh
- name: storage - name: storage
mountPath: "/var/lib/grafana" mountPath: "/var/lib/grafana"
{{- if .Values.persistence.subPath }} {{- with .Values.persistence.subPath }}
subPath: {{ tpl .Values.persistence.subPath . }} subPath: {{ tpl . $root }}
{{- end }} {{- end }}
{{- range .Values.extraSecretMounts }} {{- range .Values.extraSecretMounts }}
- name: {{ .name }} - name: {{ .name }}
mountPath: {{ .mountPath }} mountPath: {{ .mountPath }}
readOnly: {{ .readOnly }} readOnly: {{ .readOnly }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if and .Values.sidecar.datasources.enabled .Values.sidecar.datasources.initDatasources }} {{- if and .Values.sidecar.datasources.enabled .Values.sidecar.datasources.initDatasources }}
- name: {{ template "grafana.name" . }}-init-sc-datasources - name: {{ include "grafana.name" . }}-init-sc-datasources
{{- if .Values.sidecar.image.sha }} {{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}" image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }} {{- else }}
@ -105,9 +116,9 @@ initContainers:
value: "LIST" value: "LIST"
- name: LABEL - name: LABEL
value: "{{ .Values.sidecar.datasources.label }}" value: "{{ .Values.sidecar.datasources.label }}"
{{- if .Values.sidecar.datasources.labelValue }} {{- with .Values.sidecar.datasources.labelValue }}
- name: LABEL_VALUE - name: LABEL_VALUE
value: {{ quote .Values.sidecar.datasources.labelValue }} value: {{ quote . }}
{{- end }} {{- end }}
{{- if or .Values.sidecar.logLevel .Values.sidecar.datasources.logLevel }} {{- if or .Values.sidecar.logLevel .Values.sidecar.datasources.logLevel }}
- name: LOG_LEVEL - name: LOG_LEVEL
@ -117,17 +128,17 @@ initContainers:
value: "/etc/grafana/provisioning/datasources" value: "/etc/grafana/provisioning/datasources"
- name: RESOURCE - name: RESOURCE
value: {{ quote .Values.sidecar.datasources.resource }} value: {{ quote .Values.sidecar.datasources.resource }}
{{- if .Values.sidecar.enableUniqueFilenames }} {{- with .Values.sidecar.enableUniqueFilenames }}
- name: UNIQUE_FILENAMES - name: UNIQUE_FILENAMES
value: "{{ .Values.sidecar.enableUniqueFilenames }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.datasources.searchNamespace }} {{- if .Values.sidecar.datasources.searchNamespace }}
- name: NAMESPACE - name: NAMESPACE
value: "{{ tpl (.Values.sidecar.datasources.searchNamespace | join ",") . }}" value: "{{ tpl (.Values.sidecar.datasources.searchNamespace | join ",") . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.skipTlsVerify }} {{- with .Values.sidecar.skipTlsVerify }}
- name: SKIP_TLS_VERIFY - name: SKIP_TLS_VERIFY
value: "{{ .Values.sidecar.skipTlsVerify }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- with .Values.sidecar.resources }} {{- with .Values.sidecar.resources }}
resources: resources:
@ -142,7 +153,7 @@ initContainers:
mountPath: "/etc/grafana/provisioning/datasources" mountPath: "/etc/grafana/provisioning/datasources"
{{- end }} {{- end }}
{{- if and .Values.sidecar.notifiers.enabled .Values.sidecar.notifiers.initNotifiers }} {{- if and .Values.sidecar.notifiers.enabled .Values.sidecar.notifiers.initNotifiers }}
- name: {{ template "grafana.name" . }}-init-sc-notifiers - name: {{ include "grafana.name" . }}-init-sc-notifiers
{{- if .Values.sidecar.image.sha }} {{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}" image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }} {{- else }}
@ -162,9 +173,9 @@ initContainers:
value: LIST value: LIST
- name: LABEL - name: LABEL
value: "{{ .Values.sidecar.notifiers.label }}" value: "{{ .Values.sidecar.notifiers.label }}"
{{- if .Values.sidecar.notifiers.labelValue }} {{- with .Values.sidecar.notifiers.labelValue }}
- name: LABEL_VALUE - name: LABEL_VALUE
value: {{ quote .Values.sidecar.notifiers.labelValue }} value: {{ quote . }}
{{- end }} {{- end }}
{{- if or .Values.sidecar.logLevel .Values.sidecar.notifiers.logLevel }} {{- if or .Values.sidecar.logLevel .Values.sidecar.notifiers.logLevel }}
- name: LOG_LEVEL - name: LOG_LEVEL
@ -174,17 +185,17 @@ initContainers:
value: "/etc/grafana/provisioning/notifiers" value: "/etc/grafana/provisioning/notifiers"
- name: RESOURCE - name: RESOURCE
value: {{ quote .Values.sidecar.notifiers.resource }} value: {{ quote .Values.sidecar.notifiers.resource }}
{{- if .Values.sidecar.enableUniqueFilenames }} {{- with .Values.sidecar.enableUniqueFilenames }}
- name: UNIQUE_FILENAMES - name: UNIQUE_FILENAMES
value: "{{ .Values.sidecar.enableUniqueFilenames }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.notifiers.searchNamespace }} {{- with .Values.sidecar.notifiers.searchNamespace }}
- name: NAMESPACE - name: NAMESPACE
value: "{{ tpl (.Values.sidecar.notifiers.searchNamespace | join ",") . }}" value: "{{ tpl (. | join ",") $root }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.skipTlsVerify }} {{- with .Values.sidecar.skipTlsVerify }}
- name: SKIP_TLS_VERIFY - name: SKIP_TLS_VERIFY
value: "{{ .Values.sidecar.skipTlsVerify }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- with .Values.sidecar.livenessProbe }} {{- with .Values.sidecar.livenessProbe }}
livenessProbe: livenessProbe:
@ -206,22 +217,19 @@ initContainers:
- name: sc-notifiers-volume - name: sc-notifiers-volume
mountPath: "/etc/grafana/provisioning/notifiers" mountPath: "/etc/grafana/provisioning/notifiers"
{{- end}} {{- end}}
{{- if .Values.extraInitContainers }} {{- with .Values.extraInitContainers }}
{{ tpl (toYaml .Values.extraInitContainers) . | indent 2 }} {{- tpl (toYaml .) $root | nindent 2 }}
{{- end }} {{- end }}
{{- if .Values.image.pullSecrets }} {{- if or .Values.image.pullSecrets .Values.global.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
{{- $root := . }} {{- include "grafana.imagePullSecrets" (dict "root" $root "imagePullSecrets" .Values.image.pullSecrets) | nindent 2 }}
{{- range .Values.image.pullSecrets }}
- name: {{ tpl . $root }}
{{- end}}
{{- end }} {{- end }}
{{- if not .Values.enableKubeBackwardCompatibility }} {{- if not .Values.enableKubeBackwardCompatibility }}
enableServiceLinks: {{ .Values.enableServiceLinks }} enableServiceLinks: {{ .Values.enableServiceLinks }}
{{- end }} {{- end }}
containers: containers:
{{- if .Values.sidecar.alerts.enabled }} {{- if .Values.sidecar.alerts.enabled }}
- name: {{ template "grafana.name" . }}-sc-alerts - name: {{ include "grafana.name" . }}-sc-alerts
{{- if .Values.sidecar.image.sha }} {{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}" image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }} {{- else }}
@ -253,11 +261,11 @@ containers:
value: "/etc/grafana/provisioning/alerting" value: "/etc/grafana/provisioning/alerting"
- name: RESOURCE - name: RESOURCE
value: {{ quote .Values.sidecar.alerts.resource }} value: {{ quote .Values.sidecar.alerts.resource }}
{{- if .Values.sidecar.enableUniqueFilenames }} {{- with .Values.sidecar.enableUniqueFilenames }}
- name: UNIQUE_FILENAMES - name: UNIQUE_FILENAMES
value: "{{ .Values.sidecar.enableUniqueFilenames }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- with .Values.sidecar.alerts.searchNamespace }} {{- with .Values.sidecar.alerts.searchNamespace }}
- name: NAMESPACE - name: NAMESPACE
value: {{ . | join "," | quote }} value: {{ . | join "," | quote }}
{{- end }} {{- end }}
@ -324,7 +332,7 @@ containers:
mountPath: "/etc/grafana/provisioning/alerting" mountPath: "/etc/grafana/provisioning/alerting"
{{- end}} {{- end}}
{{- if .Values.sidecar.dashboards.enabled }} {{- if .Values.sidecar.dashboards.enabled }}
- name: {{ template "grafana.name" . }}-sc-dashboard - name: {{ include "grafana.name" . }}-sc-dashboard
{{- if .Values.sidecar.image.sha }} {{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}" image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }} {{- else }}
@ -344,9 +352,9 @@ containers:
value: {{ .Values.sidecar.dashboards.watchMethod }} value: {{ .Values.sidecar.dashboards.watchMethod }}
- name: LABEL - name: LABEL
value: "{{ .Values.sidecar.dashboards.label }}" value: "{{ .Values.sidecar.dashboards.label }}"
{{- if .Values.sidecar.dashboards.labelValue }} {{- with .Values.sidecar.dashboards.labelValue }}
- name: LABEL_VALUE - name: LABEL_VALUE
value: {{ quote .Values.sidecar.dashboards.labelValue }} value: {{ quote . }}
{{- end }} {{- end }}
{{- if or .Values.sidecar.logLevel .Values.sidecar.dashboards.logLevel }} {{- if or .Values.sidecar.logLevel .Values.sidecar.dashboards.logLevel }}
- name: LOG_LEVEL - name: LOG_LEVEL
@ -356,25 +364,25 @@ containers:
value: "{{ .Values.sidecar.dashboards.folder }}{{- with .Values.sidecar.dashboards.defaultFolderName }}/{{ . }}{{- end }}" value: "{{ .Values.sidecar.dashboards.folder }}{{- with .Values.sidecar.dashboards.defaultFolderName }}/{{ . }}{{- end }}"
- name: RESOURCE - name: RESOURCE
value: {{ quote .Values.sidecar.dashboards.resource }} value: {{ quote .Values.sidecar.dashboards.resource }}
{{- if .Values.sidecar.enableUniqueFilenames }} {{- with .Values.sidecar.enableUniqueFilenames }}
- name: UNIQUE_FILENAMES - name: UNIQUE_FILENAMES
value: "{{ .Values.sidecar.enableUniqueFilenames }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.dashboards.searchNamespace }} {{- with .Values.sidecar.dashboards.searchNamespace }}
- name: NAMESPACE - name: NAMESPACE
value: "{{ tpl (.Values.sidecar.dashboards.searchNamespace | join ",") . }}" value: "{{ tpl (. | join ",") $root }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.skipTlsVerify }} {{- with .Values.sidecar.skipTlsVerify }}
- name: SKIP_TLS_VERIFY - name: SKIP_TLS_VERIFY
value: "{{ .Values.sidecar.skipTlsVerify }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.dashboards.folderAnnotation }} {{- with .Values.sidecar.dashboards.folderAnnotation }}
- name: FOLDER_ANNOTATION - name: FOLDER_ANNOTATION
value: "{{ .Values.sidecar.dashboards.folderAnnotation }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.dashboards.script }} {{- with .Values.sidecar.dashboards.script }}
- name: SCRIPT - name: SCRIPT
value: "{{ .Values.sidecar.dashboards.script }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.dashboards.watchServerTimeout }} {{- if .Values.sidecar.dashboards.watchServerTimeout }}
{{- if ne .Values.sidecar.dashboards.watchMethod "WATCH" }} {{- if ne .Values.sidecar.dashboards.watchMethod "WATCH" }}
@ -388,7 +396,7 @@ containers:
{{- fail (printf "Cannot use .Values.sidecar.dashboards.watchClientTimeout with .Values.sidecar.dashboards.watchMethod %s" .Values.sidecar.dashboards.watchMethod) }} {{- fail (printf "Cannot use .Values.sidecar.dashboards.watchClientTimeout with .Values.sidecar.dashboards.watchMethod %s" .Values.sidecar.dashboards.watchMethod) }}
{{- end }} {{- end }}
- name: WATCH_CLIENT_TIMEOUT - name: WATCH_CLIENT_TIMEOUT
value: "{{ .Values.sidecar.dashboards.watchClientTimeout }}" value: {{ .Values.sidecar.dashboards.watchClientTimeout | quote }}
{{- end }} {{- end }}
{{- with .Values.sidecar.livenessProbe }} {{- with .Values.sidecar.livenessProbe }}
livenessProbe: livenessProbe:
@ -409,12 +417,12 @@ containers:
volumeMounts: volumeMounts:
- name: sc-dashboard-volume - name: sc-dashboard-volume
mountPath: {{ .Values.sidecar.dashboards.folder | quote }} mountPath: {{ .Values.sidecar.dashboards.folder | quote }}
{{- if .Values.sidecar.dashboards.extraMounts }} {{- with .Values.sidecar.dashboards.extraMounts }}
{{- toYaml .Values.sidecar.dashboards.extraMounts | trim | nindent 6}} {{- toYaml . | trim | nindent 6 }}
{{- end }} {{- end }}
{{- end}} {{- end}}
{{- if .Values.sidecar.datasources.enabled }} {{- if .Values.sidecar.datasources.enabled }}
- name: {{ template "grafana.name" . }}-sc-datasources - name: {{ include "grafana.name" . }}-sc-datasources
{{- if .Values.sidecar.image.sha }} {{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}" image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }} {{- else }}
@ -434,9 +442,9 @@ containers:
value: {{ .Values.sidecar.datasources.watchMethod }} value: {{ .Values.sidecar.datasources.watchMethod }}
- name: LABEL - name: LABEL
value: "{{ .Values.sidecar.datasources.label }}" value: "{{ .Values.sidecar.datasources.label }}"
{{- if .Values.sidecar.datasources.labelValue }} {{- with .Values.sidecar.datasources.labelValue }}
- name: LABEL_VALUE - name: LABEL_VALUE
value: {{ quote .Values.sidecar.datasources.labelValue }} value: {{ quote . }}
{{- end }} {{- end }}
{{- if or .Values.sidecar.logLevel .Values.sidecar.datasources.logLevel }} {{- if or .Values.sidecar.logLevel .Values.sidecar.datasources.logLevel }}
- name: LOG_LEVEL - name: LOG_LEVEL
@ -446,13 +454,13 @@ containers:
value: "/etc/grafana/provisioning/datasources" value: "/etc/grafana/provisioning/datasources"
- name: RESOURCE - name: RESOURCE
value: {{ quote .Values.sidecar.datasources.resource }} value: {{ quote .Values.sidecar.datasources.resource }}
{{- if .Values.sidecar.enableUniqueFilenames }} {{- with .Values.sidecar.enableUniqueFilenames }}
- name: UNIQUE_FILENAMES - name: UNIQUE_FILENAMES
value: "{{ .Values.sidecar.enableUniqueFilenames }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.datasources.searchNamespace }} {{- with .Values.sidecar.datasources.searchNamespace }}
- name: NAMESPACE - name: NAMESPACE
value: "{{ tpl (.Values.sidecar.datasources.searchNamespace | join ",") . }}" value: "{{ tpl (. | join ",") $root }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.skipTlsVerify }} {{- if .Values.sidecar.skipTlsVerify }}
- name: SKIP_TLS_VERIFY - name: SKIP_TLS_VERIFY
@ -517,7 +525,7 @@ containers:
mountPath: "/etc/grafana/provisioning/datasources" mountPath: "/etc/grafana/provisioning/datasources"
{{- end}} {{- end}}
{{- if .Values.sidecar.notifiers.enabled }} {{- if .Values.sidecar.notifiers.enabled }}
- name: {{ template "grafana.name" . }}-sc-notifiers - name: {{ include "grafana.name" . }}-sc-notifiers
{{- if .Values.sidecar.image.sha }} {{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}" image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }} {{- else }}
@ -537,9 +545,9 @@ containers:
value: {{ .Values.sidecar.notifiers.watchMethod }} value: {{ .Values.sidecar.notifiers.watchMethod }}
- name: LABEL - name: LABEL
value: "{{ .Values.sidecar.notifiers.label }}" value: "{{ .Values.sidecar.notifiers.label }}"
{{- if .Values.sidecar.notifiers.labelValue }} {{- with .Values.sidecar.notifiers.labelValue }}
- name: LABEL_VALUE - name: LABEL_VALUE
value: {{ quote .Values.sidecar.notifiers.labelValue }} value: {{ quote . }}
{{- end }} {{- end }}
{{- if or .Values.sidecar.logLevel .Values.sidecar.notifiers.logLevel }} {{- if or .Values.sidecar.logLevel .Values.sidecar.notifiers.logLevel }}
- name: LOG_LEVEL - name: LOG_LEVEL
@ -555,11 +563,11 @@ containers:
{{- end }} {{- end }}
{{- if .Values.sidecar.notifiers.searchNamespace }} {{- if .Values.sidecar.notifiers.searchNamespace }}
- name: NAMESPACE - name: NAMESPACE
value: "{{ tpl (.Values.sidecar.notifiers.searchNamespace | join ",") . }}" value: "{{ tpl (. | join ",") $root }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.skipTlsVerify }} {{- with .Values.sidecar.skipTlsVerify }}
- name: SKIP_TLS_VERIFY - name: SKIP_TLS_VERIFY
value: "{{ .Values.sidecar.skipTlsVerify }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.notifiers.script }} {{- if .Values.sidecar.notifiers.script }}
- name: SCRIPT - name: SCRIPT
@ -620,7 +628,7 @@ containers:
mountPath: "/etc/grafana/provisioning/notifiers" mountPath: "/etc/grafana/provisioning/notifiers"
{{- end}} {{- end}}
{{- if .Values.sidecar.plugins.enabled }} {{- if .Values.sidecar.plugins.enabled }}
- name: {{ template "grafana.name" . }}-sc-plugins - name: {{ include "grafana.name" . }}-sc-plugins
{{- if .Values.sidecar.image.sha }} {{- if .Values.sidecar.image.sha }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}" image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}@sha256:{{ .Values.sidecar.image.sha }}"
{{- else }} {{- else }}
@ -652,21 +660,21 @@ containers:
value: "/etc/grafana/provisioning/plugins" value: "/etc/grafana/provisioning/plugins"
- name: RESOURCE - name: RESOURCE
value: {{ quote .Values.sidecar.plugins.resource }} value: {{ quote .Values.sidecar.plugins.resource }}
{{- if .Values.sidecar.enableUniqueFilenames }} {{- with .Values.sidecar.enableUniqueFilenames }}
- name: UNIQUE_FILENAMES - name: UNIQUE_FILENAMES
value: "{{ .Values.sidecar.enableUniqueFilenames }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.plugins.searchNamespace }} {{- with .Values.sidecar.plugins.searchNamespace }}
- name: NAMESPACE - name: NAMESPACE
value: "{{ tpl (.Values.sidecar.plugins.searchNamespace | join ",") . }}" value: "{{ tpl (. | join ",") $root }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.plugins.script }} {{- with .Values.sidecar.plugins.script }}
- name: SCRIPT - name: SCRIPT
value: "{{ .Values.sidecar.plugins.script }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.sidecar.skipTlsVerify }} {{- with .Values.sidecar.skipTlsVerify }}
- name: SKIP_TLS_VERIFY - name: SKIP_TLS_VERIFY
value: "{{ .Values.sidecar.skipTlsVerify }}" value: "{{ . }}"
{{- end }} {{- end }}
{{- if and (not .Values.env.GF_SECURITY_ADMIN_USER) (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) }} {{- if and (not .Values.env.GF_SECURITY_ADMIN_USER) (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) }}
- name: REQ_USERNAME - name: REQ_USERNAME
@ -729,12 +737,12 @@ containers:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
{{- end }} {{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.command }} {{- if .Values.command }}
command: command:
{{- range .Values.command }} {{- range .Values.command }}
- {{ . | quote }} - {{ . | quote }}
{{- end }} {{- end }}
{{- end}} {{- end}}
{{- with .Values.containerSecurityContext }} {{- with .Values.containerSecurityContext }}
securityContext: securityContext:
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
@ -748,7 +756,6 @@ containers:
mountPath: "/etc/grafana/ldap.toml" mountPath: "/etc/grafana/ldap.toml"
subPath: ldap.toml subPath: ldap.toml
{{- end }} {{- end }}
{{- $root := . }}
{{- range .Values.extraConfigmapMounts }} {{- range .Values.extraConfigmapMounts }}
- name: {{ tpl .name $root }} - name: {{ tpl .name $root }}
mountPath: {{ tpl .mountPath $root }} mountPath: {{ tpl .mountPath $root }}
@ -757,95 +764,95 @@ containers:
{{- end }} {{- end }}
- name: storage - name: storage
mountPath: "/var/lib/grafana" mountPath: "/var/lib/grafana"
{{- if .Values.persistence.subPath }} {{- with .Values.persistence.subPath }}
subPath: {{ tpl .Values.persistence.subPath . }} subPath: {{ tpl . $root }}
{{- end }} {{- end }}
{{- if .Values.dashboards }} {{- with .Values.dashboards }}
{{- range $provider, $dashboards := .Values.dashboards }} {{- range $provider, $dashboards := . }}
{{- range $key, $value := $dashboards }} {{- range $key, $value := $dashboards }}
{{- if (or (hasKey $value "json") (hasKey $value "file")) }} {{- if (or (hasKey $value "json") (hasKey $value "file")) }}
- name: dashboards-{{ $provider }} - name: dashboards-{{ $provider }}
mountPath: "/var/lib/grafana/dashboards/{{ $provider }}/{{ $key }}.json" mountPath: "/var/lib/grafana/dashboards/{{ $provider }}/{{ $key }}.json"
subPath: "{{ $key }}.json" subPath: "{{ $key }}.json"
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end -}} {{- end }}
{{- if .Values.dashboardsConfigMaps }} {{- with .Values.dashboardsConfigMaps }}
{{- range (keys .Values.dashboardsConfigMaps | sortAlpha) }} {{- range (keys . | sortAlpha) }}
- name: dashboards-{{ . }} - name: dashboards-{{ . }}
mountPath: "/var/lib/grafana/dashboards/{{ . }}" mountPath: "/var/lib/grafana/dashboards/{{ . }}"
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.datasources }} {{- with .Values.datasources }}
{{- range (keys .Values.datasources | sortAlpha) }} {{- range (keys . | sortAlpha) }}
- name: config - name: config
mountPath: "/etc/grafana/provisioning/datasources/{{ . }}" mountPath: "/etc/grafana/provisioning/datasources/{{ . }}"
subPath: {{ . | quote }} subPath: {{ . | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.notifiers }} {{- with .Values.notifiers }}
{{- range (keys .Values.notifiers | sortAlpha) }} {{- range (keys . | sortAlpha) }}
- name: config - name: config
mountPath: "/etc/grafana/provisioning/notifiers/{{ . }}" mountPath: "/etc/grafana/provisioning/notifiers/{{ . }}"
subPath: {{ . | quote }} subPath: {{ . | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.alerting }} {{- with .Values.alerting }}
{{- range (keys .Values.alerting | sortAlpha) }} {{- range (keys . | sortAlpha) }}
- name: config - name: config
mountPath: "/etc/grafana/provisioning/alerting/{{ . }}" mountPath: "/etc/grafana/provisioning/alerting/{{ . }}"
subPath: {{ . | quote }} subPath: {{ . | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.dashboardProviders }} {{- with .Values.dashboardProviders }}
{{- range (keys .Values.dashboardProviders | sortAlpha) }} {{- range (keys . | sortAlpha) }}
- name: config - name: config
mountPath: "/etc/grafana/provisioning/dashboards/{{ . }}" mountPath: "/etc/grafana/provisioning/dashboards/{{ . }}"
subPath: {{ . | quote }} subPath: {{ . | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- with .Values.sidecar.alerts.enabled }} {{- with .Values.sidecar.alerts.enabled }}
- name: sc-alerts-volume - name: sc-alerts-volume
mountPath: "/etc/grafana/provisioning/alerting" mountPath: "/etc/grafana/provisioning/alerting"
{{- end}} {{- end}}
{{- if .Values.sidecar.dashboards.enabled }} {{- if .Values.sidecar.dashboards.enabled }}
- name: sc-dashboard-volume - name: sc-dashboard-volume
mountPath: {{ .Values.sidecar.dashboards.folder | quote }} mountPath: {{ .Values.sidecar.dashboards.folder | quote }}
{{ if .Values.sidecar.dashboards.SCProvider }} {{- if .Values.sidecar.dashboards.SCProvider }}
- name: sc-dashboard-provider - name: sc-dashboard-provider
mountPath: "/etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml" mountPath: "/etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml"
subPath: provider.yaml subPath: provider.yaml
{{- end}} {{- end}}
{{- end}} {{- end}}
{{- if .Values.sidecar.datasources.enabled }} {{- if .Values.sidecar.datasources.enabled }}
- name: sc-datasources-volume - name: sc-datasources-volume
mountPath: "/etc/grafana/provisioning/datasources" mountPath: "/etc/grafana/provisioning/datasources"
{{- end}} {{- end}}
{{- if .Values.sidecar.plugins.enabled }} {{- if .Values.sidecar.plugins.enabled }}
- name: sc-plugins-volume - name: sc-plugins-volume
mountPath: "/etc/grafana/provisioning/plugins" mountPath: "/etc/grafana/provisioning/plugins"
{{- end}} {{- end}}
{{- if .Values.sidecar.notifiers.enabled }} {{- if .Values.sidecar.notifiers.enabled }}
- name: sc-notifiers-volume - name: sc-notifiers-volume
mountPath: "/etc/grafana/provisioning/notifiers" mountPath: "/etc/grafana/provisioning/notifiers"
{{- end}} {{- end}}
{{- range .Values.extraSecretMounts }} {{- range .Values.extraSecretMounts }}
- name: {{ .name }} - name: {{ .name }}
mountPath: {{ .mountPath }} mountPath: {{ .mountPath }}
readOnly: {{ .readOnly }} readOnly: {{ .readOnly }}
subPath: {{ .subPath | default "" }} subPath: {{ .subPath | default "" }}
{{- end }} {{- end }}
{{- range .Values.extraVolumeMounts }} {{- range .Values.extraVolumeMounts }}
- name: {{ .name }} - name: {{ .name }}
mountPath: {{ .mountPath }} mountPath: {{ .mountPath }}
subPath: {{ .subPath | default "" }} subPath: {{ .subPath | default "" }}
readOnly: {{ .readOnly }} readOnly: {{ .readOnly }}
{{- end }} {{- end }}
{{- range .Values.extraEmptyDirMounts }} {{- range .Values.extraEmptyDirMounts }}
- name: {{ .name }} - name: {{ .name }}
mountPath: {{ .mountPath }} mountPath: {{ .mountPath }}
{{- end }} {{- end }}
ports: ports:
- name: {{ .Values.podPortName }} - name: {{ .Values.podPortName }}
containerPort: {{ .Values.service.targetPort }} containerPort: {{ .Values.service.targetPort }}
@ -869,7 +876,7 @@ containers:
- name: GF_INSTALL_PLUGINS - name: GF_INSTALL_PLUGINS
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
key: plugins key: plugins
{{- end }} {{- end }}
{{- if .Values.smtp.existingSecret }} {{- if .Values.smtp.existingSecret }}
@ -886,9 +893,9 @@ containers:
{{- end }} {{- end }}
{{- if .Values.imageRenderer.enabled }} {{- if .Values.imageRenderer.enabled }}
- name: GF_RENDERING_SERVER_URL - name: GF_RENDERING_SERVER_URL
value: http://{{ template "grafana.fullname" . }}-image-renderer.{{ template "grafana.namespace" . }}:{{ .Values.imageRenderer.service.port }}/render value: http://{{ include "grafana.fullname" . }}-image-renderer.{{ include "grafana.namespace" . }}:{{ .Values.imageRenderer.service.port }}/render
- name: GF_RENDERING_CALLBACK_URL - name: GF_RENDERING_CALLBACK_URL
value: {{ .Values.imageRenderer.grafanaProtocol }}://{{ template "grafana.fullname" . }}.{{ template "grafana.namespace" . }}:{{ .Values.service.port }}/{{ .Values.imageRenderer.grafanaSubPath }} value: {{ .Values.imageRenderer.grafanaProtocol }}://{{ include "grafana.fullname" . }}.{{ include "grafana.namespace" . }}:{{ .Values.service.port }}/{{ .Values.imageRenderer.grafanaSubPath }}
{{- end }} {{- end }}
- name: GF_PATHS_DATA - name: GF_PATHS_DATA
value: {{ (get .Values "grafana.ini").paths.data }} value: {{ (get .Values "grafana.ini").paths.data }}
@ -898,35 +905,35 @@ containers:
value: {{ (get .Values "grafana.ini").paths.plugins }} value: {{ (get .Values "grafana.ini").paths.plugins }}
- name: GF_PATHS_PROVISIONING - name: GF_PATHS_PROVISIONING
value: {{ (get .Values "grafana.ini").paths.provisioning }} value: {{ (get .Values "grafana.ini").paths.provisioning }}
{{- range $key, $value := .Values.envValueFrom }} {{- range $key, $value := .Values.envValueFrom }}
- name: {{ $key | quote }} - name: {{ $key | quote }}
valueFrom: valueFrom:
{{ tpl (toYaml $value) $ | indent 10 }} {{- tpl (toYaml $value) $ | nindent 10 }}
{{- end }} {{- end }}
{{- range $key, $value := .Values.env }} {{- range $key, $value := .Values.env }}
- name: "{{ tpl $key $ }}" - name: "{{ tpl $key $ }}"
value: "{{ tpl (print $value) $ }}" value: "{{ tpl (print $value) $ }}"
{{- end }} {{- end }}
{{- if or .Values.envFromSecret (or .Values.envRenderSecret .Values.envFromSecrets) .Values.envFromConfigMaps }} {{- if or .Values.envFromSecret (or .Values.envRenderSecret .Values.envFromSecrets) .Values.envFromConfigMaps }}
envFrom: envFrom:
{{- if .Values.envFromSecret }} {{- if .Values.envFromSecret }}
- secretRef: - secretRef:
name: {{ tpl .Values.envFromSecret . }} name: {{ tpl .Values.envFromSecret . }}
{{- end }} {{- end }}
{{- if .Values.envRenderSecret }} {{- if .Values.envRenderSecret }}
- secretRef: - secretRef:
name: {{ template "grafana.fullname" . }}-env name: {{ include "grafana.fullname" . }}-env
{{- end }} {{- end }}
{{- range .Values.envFromSecrets }} {{- range .Values.envFromSecrets }}
- secretRef: - secretRef:
name: {{ tpl .name $ }} name: {{ tpl .name $ }}
optional: {{ .optional | default false }} optional: {{ .optional | default false }}
{{- end }} {{- end }}
{{- range .Values.envFromConfigMaps }} {{- range .Values.envFromConfigMaps }}
- configMapRef: - configMapRef:
name: {{ tpl .name $ }} name: {{ tpl .name $ }}
optional: {{ .optional | default false }} optional: {{ .optional | default false }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- with .Values.livenessProbe }} {{- with .Values.livenessProbe }}
livenessProbe: livenessProbe:
@ -936,24 +943,24 @@ containers:
readinessProbe: readinessProbe:
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
{{- if .Values.lifecycleHooks }} {{- with .Values.lifecycleHooks }}
lifecycle: {{ tpl (.Values.lifecycleHooks | toYaml) . | nindent 6 }} lifecycle:
{{- end }} {{- tpl (toYaml .) $root | nindent 6 }}
{{- end }}
{{- with .Values.resources }} {{- with .Values.resources }}
resources: resources:
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
{{- with .Values.extraContainers }} {{- with .Values.extraContainers }}
{{ tpl . $ | indent 2 }} {{- tpl . $ | nindent 2 }}
{{- end }} {{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}
{{- end }} {{- end }}
{{- $root := . }}
{{- with .Values.affinity }} {{- with .Values.affinity }}
affinity: affinity:
{{ tpl (toYaml .) $root | indent 2 }} {{- tpl (toYaml .) $root | nindent 2 }}
{{- end }} {{- end }}
{{- with .Values.topologySpreadConstraints }} {{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints: topologySpreadConstraints:
@ -966,30 +973,29 @@ tolerations:
volumes: volumes:
- name: config - name: config
configMap: configMap:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
{{- $root := . }} {{- range .Values.extraConfigmapMounts }}
{{- range .Values.extraConfigmapMounts }}
- name: {{ tpl .name $root }} - name: {{ tpl .name $root }}
configMap: configMap:
name: {{ tpl .configMap $root }} name: {{ tpl .configMap $root }}
{{- if .items }} {{- with .items }}
items: {{ toYaml .items | nindent 6 }} items:
{{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.dashboards }} {{- if .Values.dashboards }}
{{- range (keys .Values.dashboards | sortAlpha) }} {{- range (keys .Values.dashboards | sortAlpha) }}
- name: dashboards-{{ . }} - name: dashboards-{{ . }}
configMap: configMap:
name: {{ template "grafana.fullname" $ }}-dashboards-{{ . }} name: {{ include "grafana.fullname" $ }}-dashboards-{{ . }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.dashboardsConfigMaps }} {{- if .Values.dashboardsConfigMaps }}
{{ $root := . }} {{- range $provider, $name := .Values.dashboardsConfigMaps }}
{{- range $provider, $name := .Values.dashboardsConfigMaps }}
- name: dashboards-{{ $provider }} - name: dashboards-{{ $provider }}
configMap: configMap:
name: {{ tpl $name $root }} name: {{ tpl $name $root }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.ldap.enabled }} {{- if .Values.ldap.enabled }}
- name: ldap - name: ldap
@ -997,98 +1003,101 @@ volumes:
{{- if .Values.ldap.existingSecret }} {{- if .Values.ldap.existingSecret }}
secretName: {{ .Values.ldap.existingSecret }} secretName: {{ .Values.ldap.existingSecret }}
{{- else }} {{- else }}
secretName: {{ template "grafana.fullname" . }} secretName: {{ include "grafana.fullname" . }}
{{- end }} {{- end }}
items: items:
- key: ldap-toml - key: ldap-toml
path: ldap.toml path: ldap.toml
{{- end }} {{- end }}
{{- if and .Values.persistence.enabled (eq .Values.persistence.type "pvc") }} {{- if and .Values.persistence.enabled (eq .Values.persistence.type "pvc") }}
- name: storage - name: storage
persistentVolumeClaim: persistentVolumeClaim:
claimName: {{ tpl (.Values.persistence.existingClaim | default (include "grafana.fullname" .)) . }} claimName: {{ tpl (.Values.persistence.existingClaim | default (include "grafana.fullname" .)) . }}
{{- else if and .Values.persistence.enabled (eq .Values.persistence.type "statefulset") }} {{- else if and .Values.persistence.enabled (eq .Values.persistence.type "statefulset") }}
# nothing # nothing
{{- else }} {{- else }}
- name: storage - name: storage
{{- if .Values.persistence.inMemory.enabled }} {{- if .Values.persistence.inMemory.enabled }}
emptyDir: emptyDir:
medium: Memory medium: Memory
{{- if .Values.persistence.inMemory.sizeLimit }} {{- with .Values.persistence.inMemory.sizeLimit }}
sizeLimit: {{ .Values.persistence.inMemory.sizeLimit }} sizeLimit: {{ . }}
{{- end -}} {{- end }}
{{- else }} {{- else }}
emptyDir: {} emptyDir: {}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{- if .Values.sidecar.alerts.enabled }} {{- if .Values.sidecar.alerts.enabled }}
- name: sc-alerts-volume - name: sc-alerts-volume
{{- if .Values.sidecar.alerts.sizeLimit }}
emptyDir: emptyDir:
sizeLimit: {{ .Values.sidecar.alerts.sizeLimit }} {{- with .Values.sidecar.alerts.sizeLimit }}
{{- else }} sizeLimit: {{ . }}
emptyDir: {} {{- else }}
{{- end -}} {}
{{- end -}} {{- end }}
{{- if .Values.sidecar.dashboards.enabled }} {{- end }}
{{- if .Values.sidecar.dashboards.enabled }}
- name: sc-dashboard-volume - name: sc-dashboard-volume
{{- if .Values.sidecar.dashboards.sizeLimit }}
emptyDir: emptyDir:
sizeLimit: {{ .Values.sidecar.dashboards.sizeLimit }} {{- with .Values.sidecar.dashboards.sizeLimit }}
{{- else }} sizeLimit: {{ . }}
emptyDir: {} {{- else }}
{{- end -}} {}
{{- if .Values.sidecar.dashboards.SCProvider }} {{- end }}
{{- if .Values.sidecar.dashboards.SCProvider }}
- name: sc-dashboard-provider - name: sc-dashboard-provider
configMap: configMap:
name: {{ template "grafana.fullname" . }}-config-dashboards name: {{ include "grafana.fullname" . }}-config-dashboards
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.sidecar.datasources.enabled }} {{- if .Values.sidecar.datasources.enabled }}
- name: sc-datasources-volume - name: sc-datasources-volume
{{- if .Values.sidecar.datasources.sizeLimit }}
emptyDir: emptyDir:
sizeLimit: {{ .Values.sidecar.datasources.sizeLimit }} {{- with .Values.sidecar.datasources.sizeLimit }}
{{- else }} sizeLimit: {{ . }}
emptyDir: {} {{- else }}
{{- end -}} {}
{{- end -}} {{- end }}
{{- if .Values.sidecar.plugins.enabled }} {{- end }}
{{- if .Values.sidecar.plugins.enabled }}
- name: sc-plugins-volume - name: sc-plugins-volume
{{- if .Values.sidecar.plugins.sizeLimit }}
emptyDir: emptyDir:
sizeLimit: {{ .Values.sidecar.plugins.sizeLimit }} {{- with .Values.sidecar.plugins.sizeLimit }}
{{- else }} sizeLimit: {{ . }}
emptyDir: {} {{- else }}
{{- end -}} {}
{{- end -}} {{- end }}
{{- if .Values.sidecar.notifiers.enabled }} {{- end }}
{{- if .Values.sidecar.notifiers.enabled }}
- name: sc-notifiers-volume - name: sc-notifiers-volume
{{- if .Values.sidecar.notifiers.sizeLimit }}
emptyDir: emptyDir:
sizeLimit: {{ .Values.sidecar.notifiers.sizeLimit }} {{- with .Values.sidecar.notifiers.sizeLimit }}
{{- else }} sizeLimit: {{ . }}
emptyDir: {} {{- else }}
{{- end -}} {}
{{- end -}} {{- end }}
{{- range .Values.extraSecretMounts }} {{- end }}
{{- if .secretName }} {{- range .Values.extraSecretMounts }}
{{- if .secretName }}
- name: {{ .name }} - name: {{ .name }}
secret: secret:
secretName: {{ .secretName }} secretName: {{ .secretName }}
defaultMode: {{ .defaultMode }} defaultMode: {{ .defaultMode }}
{{- if .items }} {{- with .items }}
items: {{ toYaml .items | nindent 6 }} items:
{{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- else if .projected }} {{- else if .projected }}
- name: {{ .name }} - name: {{ .name }}
projected: {{- toYaml .projected | nindent 6 }} projected:
{{- else if .csi }} {{- toYaml .projected | nindent 6 }}
{{- else if .csi }}
- name: {{ .name }} - name: {{ .name }}
csi: {{- toYaml .csi | nindent 6 }} csi:
{{- end }} {{- toYaml .csi | nindent 6 }}
{{- end }} {{- end }}
{{- range .Values.extraVolumeMounts }} {{- end }}
{{- range .Values.extraVolumeMounts }}
- name: {{ .name }} - name: {{ .name }}
{{- if .existingClaim }} {{- if .existingClaim }}
persistentVolumeClaim: persistentVolumeClaim:
@ -1099,16 +1108,16 @@ volumes:
{{- else if .csi }} {{- else if .csi }}
csi: csi:
data: data:
{{ toYaml .data | nindent 6 }} {{- toYaml .data | nindent 8 }}
{{- else }} {{- else }}
emptyDir: {} emptyDir: {}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- range .Values.extraEmptyDirMounts }} {{- range .Values.extraEmptyDirMounts }}
- name: {{ .name }} - name: {{ .name }}
emptyDir: {} emptyDir: {}
{{- end -}} {{- end }}
{{- if .Values.extraContainerVolumes }} {{- with .Values.extraContainerVolumes }}
{{ tpl (toYaml .Values.extraContainerVolumes) . | indent 2 }} {{- tpl (toYaml .) $root | nindent 2 }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -4,21 +4,21 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
name: {{ template "grafana.fullname" . }}-clusterrole name: {{ include "grafana.fullname" . }}-clusterrole
{{- if or .Values.sidecar.dashboards.enabled (or .Values.rbac.extraClusterRoleRules (or .Values.sidecar.datasources.enabled .Values.sidecar.plugins.enabled)) }} {{- if or .Values.sidecar.dashboards.enabled (or .Values.rbac.extraClusterRoleRules (or .Values.sidecar.datasources.enabled .Values.sidecar.plugins.enabled)) }}
rules: rules:
{{- if or .Values.sidecar.dashboards.enabled (or .Values.sidecar.datasources.enabled .Values.sidecar.plugins.enabled) }} {{- if or .Values.sidecar.dashboards.enabled (or .Values.sidecar.datasources.enabled .Values.sidecar.plugins.enabled) }}
- apiGroups: [""] # "" indicates the core API group - apiGroups: [""] # "" indicates the core API group
resources: ["configmaps", "secrets"] resources: ["configmaps", "secrets"]
verbs: ["get", "watch", "list"] verbs: ["get", "watch", "list"]
{{- end}} {{- end}}
{{- with .Values.rbac.extraClusterRoleRules }} {{- with .Values.rbac.extraClusterRoleRules }}
{{ toYaml . | indent 0 }} {{- toYaml . | nindent 2 }}
{{- end}} {{- end}}
{{- else }} {{- else }}
rules: [] rules: []
{{- end}} {{- end}}

View File

@ -2,23 +2,23 @@
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: {{ template "grafana.fullname" . }}-clusterrolebinding name: {{ include "grafana.fullname" . }}-clusterrolebinding
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: {{ template "grafana.serviceAccountName" . }} name: {{ include "grafana.serviceAccountName" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
{{- if (not .Values.rbac.useExistingRole) }} {{- if .Values.rbac.useExistingRole }}
name: {{ template "grafana.fullname" . }}-clusterrole
{{- else }}
name: {{ .Values.rbac.useExistingRole }} name: {{ .Values.rbac.useExistingRole }}
{{- end }} {{- else }}
name: {{ include "grafana.fullname" . }}-clusterrole
{{- end }}
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
{{- end -}} {{- end }}

View File

@ -4,26 +4,26 @@ kind: ConfigMap
metadata: metadata:
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
name: {{ template "grafana.fullname" . }}-config-dashboards name: {{ include "grafana.fullname" . }}-config-dashboards
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
data: data:
provider.yaml: |- provider.yaml: |-
apiVersion: 1 apiVersion: 1
providers: providers:
- name: '{{ .Values.sidecar.dashboards.provider.name }}' - name: '{{ .Values.sidecar.dashboards.provider.name }}'
orgId: {{ .Values.sidecar.dashboards.provider.orgid }} orgId: {{ .Values.sidecar.dashboards.provider.orgid }}
{{- if not .Values.sidecar.dashboards.provider.foldersFromFilesStructure }} {{- if not .Values.sidecar.dashboards.provider.foldersFromFilesStructure }}
folder: '{{ .Values.sidecar.dashboards.provider.folder }}' folder: '{{ .Values.sidecar.dashboards.provider.folder }}'
{{- end}} {{- end }}
type: {{ .Values.sidecar.dashboards.provider.type }} type: {{ .Values.sidecar.dashboards.provider.type }}
disableDeletion: {{ .Values.sidecar.dashboards.provider.disableDelete }} disableDeletion: {{ .Values.sidecar.dashboards.provider.disableDelete }}
allowUiUpdates: {{ .Values.sidecar.dashboards.provider.allowUiUpdates }} allowUiUpdates: {{ .Values.sidecar.dashboards.provider.allowUiUpdates }}
updateIntervalSeconds: {{ .Values.sidecar.dashboards.provider.updateIntervalSeconds | default 30 }} updateIntervalSeconds: {{ .Values.sidecar.dashboards.provider.updateIntervalSeconds | default 30 }}
options: options:
foldersFromFilesStructure: {{ .Values.sidecar.dashboards.provider.foldersFromFilesStructure }} foldersFromFilesStructure: {{ .Values.sidecar.dashboards.provider.foldersFromFilesStructure }}
path: {{ .Values.sidecar.dashboards.folder }}{{- with .Values.sidecar.dashboards.defaultFolderName }}/{{ . }}{{- end }} path: {{ .Values.sidecar.dashboards.folder }}{{- with .Values.sidecar.dashboards.defaultFolderName }}/{{ . }}{{- end }}
{{- end}} {{- end }}

View File

@ -1,21 +1,22 @@
{{- if .Values.createConfigmap }} {{- if .Values.createConfigmap }}
{{- $root := . -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
data: data:
{{- if .Values.plugins }} {{- with .Values.plugins }}
plugins: {{ join "," .Values.plugins }} plugins: {{ join "," . }}
{{- end }} {{- end }}
grafana.ini: | grafana.ini: |
{{- range $elem, $elemVal := index .Values "grafana.ini" }} {{- range $elem, $elemVal := index .Values "grafana.ini" }}
{{- if not (kindIs "map" $elemVal) }} {{- if not (kindIs "map" $elemVal) }}
{{- if kindIs "invalid" $elemVal }} {{- if kindIs "invalid" $elemVal }}
{{ $elem }} = {{ $elem }} =
@ -25,8 +26,8 @@ data:
{{ $elem }} = {{ $elemVal }} {{ $elem }} = {{ $elemVal }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- range $key, $value := index .Values "grafana.ini" }} {{- range $key, $value := index .Values "grafana.ini" }}
{{- if kindIs "map" $value }} {{- if kindIs "map" $value }}
[{{ $key }}] [{{ $key }}]
{{- range $elem, $elemVal := $value }} {{- range $elem, $elemVal := $value }}
@ -39,37 +40,27 @@ data:
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.datasources }}
{{ $root := . }}
{{- range $key, $value := .Values.datasources }} {{- range $key, $value := .Values.datasources }}
{{ $key }}: | {{- $key | nindent 2 }}: |
{{ tpl (toYaml $value | indent 4) $root }} {{- tpl (toYaml $value | nindent 4) $root }}
{{- end -}} {{- end }}
{{- end -}}
{{- if .Values.notifiers }}
{{- range $key, $value := .Values.notifiers }} {{- range $key, $value := .Values.notifiers }}
{{ $key }}: | {{- $key | nindent 2 }}: |
{{ toYaml $value | indent 4 }} {{- toYaml $value | nindent 4 }}
{{- end -}} {{- end }}
{{- end -}}
{{- if .Values.alerting }}
{{ $root := . }}
{{- range $key, $value := .Values.alerting }} {{- range $key, $value := .Values.alerting }}
{{ $key }}: | {{- $key | nindent 2 }}: |
{{ tpl (toYaml $value | indent 4) $root }} {{- tpl (toYaml $value | nindent 4) $root }}
{{- end -}} {{- end }}
{{- end -}}
{{- if .Values.dashboardProviders }}
{{- range $key, $value := .Values.dashboardProviders }} {{- range $key, $value := .Values.dashboardProviders }}
{{ $key }}: | {{- $key | nindent 2 }}: |
{{ toYaml $value | indent 4 }} {{- toYaml $value | nindent 4 }}
{{- end -}} {{- end }}
{{- end -}}
{{- if .Values.dashboards }} {{- if .Values.dashboards }}
download_dashboards.sh: | download_dashboards.sh: |
@ -101,34 +92,34 @@ data:
-H "PRIVATE-TOKEN: {{ $value.gitlabToken }}" \ -H "PRIVATE-TOKEN: {{ $value.gitlabToken }}" \
{{- end }} {{- end }}
-H "Content-Type: application/json;charset=UTF-8" \ -H "Content-Type: application/json;charset=UTF-8" \
{{- end -}} {{- end }}
{{- $dpPath := "" -}} {{- $dpPath := "" -}}
{{- range $kd := (index $dashboardProviders "dashboardproviders.yaml").providers -}} {{- range $kd := (index $dashboardProviders "dashboardproviders.yaml").providers }}
{{- if eq $kd.name $provider -}} {{- if eq $kd.name $provider }}
{{- $dpPath = $kd.options.path -}} {{- $dpPath = $kd.options.path }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{- if $value.url }} {{- if $value.url }}
"{{ $value.url }}" \ "{{ $value.url }}" \
{{- else }} {{- else }}
"https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download" \ "https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download" \
{{- end -}} {{- end }}
{{- if $value.datasource }} {{- if $value.datasource }}
{{- if kindIs "string" $value.datasource }} {{- if kindIs "string" $value.datasource }}
| sed '/-- .* --/! s/"datasource":.*,/"datasource": "{{ $value.datasource }}",/g' \ | sed '/-- .* --/! s/"datasource":.*,/"datasource": "{{ $value.datasource }}",/g' \
{{- end -}} {{- end }}
{{- if kindIs "slice" $value.datasource -}} {{- if kindIs "slice" $value.datasource }}
{{- range $value.datasource }} {{- range $value.datasource }}
| sed '/-- .* --/! s/${{"{"}}{{ .name }}}/{{ .value }}/g' \ | sed '/-- .* --/! s/${{"{"}}{{ .name }}}/{{ .value }}/g' \
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{- if $value.b64content }} {{- if $value.b64content }}
| base64 -d \ | base64 -d \
{{- end }} {{- end }}
> "{{- if $dpPath -}}{{ $dpPath }}{{- else -}}/var/lib/grafana/dashboards/{{ $provider }}{{- end -}}/{{ $key }}.json" > "{{- if $dpPath -}}{{ $dpPath }}{{- else -}}/var/lib/grafana/dashboards/{{ $provider }}{{- end -}}/{{ $key }}.json"
{{ end }} {{ end }}
{{- end -}} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -4,8 +4,8 @@
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: {{ template "grafana.fullname" $ }}-dashboards-{{ $provider }} name: {{ include "grafana.fullname" $ }}-dashboards-{{ $provider }}
namespace: {{ template "grafana.namespace" $ }} namespace: {{ include "grafana.namespace" $ }}
labels: labels:
{{- include "grafana.labels" $ | nindent 4 }} {{- include "grafana.labels" $ | nindent 4 }}
dashboard-provider: {{ $provider }} dashboard-provider: {{ $provider }}
@ -15,14 +15,14 @@ data:
{{- range $key, $value := $dashboards }} {{- range $key, $value := $dashboards }}
{{- if (or (hasKey $value "json") (hasKey $value "file")) }} {{- if (or (hasKey $value "json") (hasKey $value "file")) }}
{{- $dashboardFound = true }} {{- $dashboardFound = true }}
{{ print $key | indent 2 }}.json: {{- print $key | nindent 2 }}.json:
{{- if hasKey $value "json" }} {{- if hasKey $value "json" }}
|- |-
{{ $value.json | indent 6 }} {{- $value.json | nindent 6 }}
{{- end }} {{- end }}
{{- if hasKey $value "file" }} {{- if hasKey $value "file" }}
{{ toYaml ( $files.Get $value.file ) | indent 4}} {{- toYaml ( $files.Get $value.file ) | nindent 4}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if not $dashboardFound }} {{- if not $dashboardFound }}

View File

@ -1,18 +1,18 @@
{{ if (and (not .Values.useStatefulSet) (or (not .Values.persistence.enabled) (eq .Values.persistence.type "pvc"))) }} {{- if (and (not .Values.useStatefulSet) (or (not .Values.persistence.enabled) (eq .Values.persistence.type "pvc"))) }}
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- if .Values.labels }} {{- with .Values.labels }}
{{ toYaml .Values.labels | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
{{- if and (not .Values.autoscaling.enabled) (.Values.replicas) }} {{- if and (not .Values.autoscaling.enabled) (.Values.replicas) }}
replicas: {{ .Values.replicas }} replicas: {{ .Values.replicas }}
@ -21,30 +21,30 @@ spec:
selector: selector:
matchLabels: matchLabels:
{{- include "grafana.selectorLabels" . | nindent 6 }} {{- include "grafana.selectorLabels" . | nindent 6 }}
{{- with .Values.deploymentStrategy }} {{- with .Values.deploymentStrategy }}
strategy: strategy:
{{ toYaml . | trim | indent 4 }} {{- toYaml . | trim | nindent 4 }}
{{- end }} {{- end }}
template: template:
metadata: metadata:
labels: labels:
{{- include "grafana.selectorLabels" . | nindent 8 }} {{- include "grafana.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }} {{- with .Values.podLabels }}
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
annotations: annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/dashboards-json-config: {{ include (print $.Template.BasePath "/dashboards-json-configmap.yaml") . | sha256sum }} checksum/dashboards-json-config: {{ include (print $.Template.BasePath "/dashboards-json-configmap.yaml") . | sha256sum }}
checksum/sc-dashboard-provider-config: {{ include (print $.Template.BasePath "/configmap-dashboard-provider.yaml") . | sha256sum }} checksum/sc-dashboard-provider-config: {{ include (print $.Template.BasePath "/configmap-dashboard-provider.yaml") . | sha256sum }}
{{- if and (or (and (not .Values.admin.existingSecret) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD__FILE) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD)) (and .Values.ldap.enabled (not .Values.ldap.existingSecret))) (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) }} {{- if and (or (and (not .Values.admin.existingSecret) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD__FILE) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD)) (and .Values.ldap.enabled (not .Values.ldap.existingSecret))) (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- end }} {{- end }}
{{- if .Values.envRenderSecret }} {{- if .Values.envRenderSecret }}
checksum/secret-env: {{ include (print $.Template.BasePath "/secret-env.yaml") . | sha256sum }} checksum/secret-env: {{ include (print $.Template.BasePath "/secret-env.yaml") . | sha256sum }}
{{- end }} {{- end }}
{{- with .Values.podAnnotations }} {{- with .Values.podAnnotations }}
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
{{- include "grafana.pod" . | indent 6 }} {{- include "grafana.pod" . | nindent 6 }}
{{- end }} {{- end }}

View File

@ -1,15 +1,16 @@
{{- if or .Values.headlessService (and .Values.persistence.enabled (not .Values.persistence.existingClaim) (eq .Values.persistence.type "statefulset"))}} {{- $sts := list "sts" "StatefulSet" -}}
{{- if or .Values.headlessService (and .Values.persistence.enabled (not .Values.persistence.existingClaim) (has .Values.persistence.type $sts)) }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "grafana.fullname" . }}-headless name: {{ include "grafana.fullname" . }}-headless
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
clusterIP: None clusterIP: None
selector: selector:

View File

@ -1,21 +1,26 @@
{{- $sts := list "sts" "StatefulSet" -}}
{{- if .Values.autoscaling.enabled }} {{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1 apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler kind: HorizontalPodAutoscaler
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
app.kubernetes.io/name: {{ template "grafana.name" . }} app.kubernetes.io/name: {{ include "grafana.name" . }}
helm.sh/chart: {{ template "grafana.chart" . }} helm.sh/chart: {{ include "grafana.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
spec: spec:
scaleTargetRef: scaleTargetRef:
apiVersion: apps/v1 apiVersion: apps/v1
{{- if has .Values.persistence.type $sts }}
kind: StatefulSet
{{- else }}
kind: Deployment kind: Deployment
name: {{ template "grafana.fullname" . }} {{- end }}
name: {{ include "grafana.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }} minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics: metrics:
{{ toYaml .Values.autoscaling.metrics | indent 4 }} {{- toYaml .Values.autoscaling.metrics | nindent 4 }}
{{- end }} {{- end }}

View File

@ -1,65 +1,65 @@
{{ if .Values.imageRenderer.enabled }} {{ if .Values.imageRenderer.enabled }}
{{- $root := . -}}
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: {{ template "grafana.fullname" . }}-image-renderer name: {{ include "grafana.fullname" . }}-image-renderer
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.imageRenderer.labels" . | nindent 4 }} {{- include "grafana.imageRenderer.labels" . | nindent 4 }}
{{- if .Values.imageRenderer.labels }} {{- with .Values.imageRenderer.labels }}
{{ toYaml .Values.imageRenderer.labels | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.imageRenderer.annotations }} {{- with .Values.imageRenderer.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
replicas: {{ .Values.imageRenderer.replicas }} replicas: {{ .Values.imageRenderer.replicas }}
revisionHistoryLimit: {{ .Values.imageRenderer.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.imageRenderer.revisionHistoryLimit }}
selector: selector:
matchLabels: matchLabels:
{{- include "grafana.imageRenderer.selectorLabels" . | nindent 6 }} {{- include "grafana.imageRenderer.selectorLabels" . | nindent 6 }}
{{- with .Values.imageRenderer.deploymentStrategy }}
{{- with .Values.imageRenderer.deploymentStrategy }}
strategy: strategy:
{{ toYaml . | trim | indent 4 }} {{- toYaml . | trim | nindent 4 }}
{{- end }} {{- end }}
template: template:
metadata: metadata:
labels: labels:
{{- include "grafana.imageRenderer.selectorLabels" . | nindent 8 }} {{- include "grafana.imageRenderer.selectorLabels" . | nindent 8 }}
{{- with .Values.imageRenderer.podLabels }} {{- with .Values.imageRenderer.podLabels }}
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
annotations: annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- with .Values.imageRenderer.podAnnotations }} {{- with .Values.imageRenderer.podAnnotations }}
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
{{- with .Values.imageRenderer.schedulerName }}
{{- if .Values.imageRenderer.schedulerName }} schedulerName: "{{ . }}"
schedulerName: "{{ .Values.imageRenderer.schedulerName }}"
{{- end }} {{- end }}
{{- if .Values.imageRenderer.serviceAccountName }} {{- with .Values.imageRenderer.serviceAccountName }}
serviceAccountName: "{{ .Values.imageRenderer.serviceAccountName }}" serviceAccountName: "{{ . }}"
{{- end }} {{- end }}
{{- if .Values.imageRenderer.securityContext }} {{- with .Values.imageRenderer.securityContext }}
securityContext: securityContext:
{{- toYaml .Values.imageRenderer.securityContext | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.imageRenderer.hostAliases }} {{- with .Values.imageRenderer.hostAliases }}
hostAliases: hostAliases:
{{- toYaml .Values.imageRenderer.hostAliases | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.imageRenderer.priorityClassName }} {{- with .Values.imageRenderer.priorityClassName }}
priorityClassName: {{ .Values.imageRenderer.priorityClassName }} priorityClassName: {{ . }}
{{- end }} {{- end }}
{{- if .Values.imageRenderer.image.pullSecrets }} {{- with .Values.imageRenderer.image.pullSecrets }}
imagePullSecrets: imagePullSecrets:
{{- $root := . }} {{- range . }}
{{- range .Values.imageRenderer.image.pullSecrets }}
- name: {{ tpl . $root }} - name: {{ tpl . $root }}
{{- end}} {{- end}}
{{- end }} {{- end }}
containers: containers:
- name: {{ .Chart.Name }}-image-renderer - name: {{ .Chart.Name }}-image-renderer
@ -69,12 +69,12 @@ spec:
image: "{{ .Values.imageRenderer.image.repository }}:{{ .Values.imageRenderer.image.tag }}" image: "{{ .Values.imageRenderer.image.repository }}:{{ .Values.imageRenderer.image.tag }}"
{{- end }} {{- end }}
imagePullPolicy: {{ .Values.imageRenderer.image.pullPolicy }} imagePullPolicy: {{ .Values.imageRenderer.image.pullPolicy }}
{{- if .Values.imageRenderer.command }} {{- if .Values.imageRenderer.command }}
command: command:
{{- range .Values.imageRenderer.command }} {{- range .Values.imageRenderer.command }}
- {{ . }} - {{ . }}
{{- end }} {{- end }}
{{- end}} {{- end}}
ports: ports:
- name: {{ .Values.imageRenderer.service.portName }} - name: {{ .Values.imageRenderer.service.portName }}
containerPort: {{ .Values.imageRenderer.service.targetPort }} containerPort: {{ .Values.imageRenderer.service.targetPort }}
@ -90,30 +90,28 @@ spec:
- name: {{ $key | quote }} - name: {{ $key | quote }}
value: {{ $value | quote }} value: {{ $value | quote }}
{{- end }} {{- end }}
{{- with .Values.imageRenderer.containerSecurityContext }}
securityContext: securityContext:
capabilities: {{- toYaml . | nindent 12 }}
drop: ['all'] {{- end }}
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
volumeMounts: volumeMounts:
- mountPath: /tmp - mountPath: /tmp
name: image-renderer-tmpfs name: image-renderer-tmpfs
{{- with .Values.imageRenderer.resources }} {{- with .Values.imageRenderer.resources }}
resources: resources:
{{ toYaml . | indent 12 }} {{- toYaml . | nindent 12 }}
{{- end }} {{- end }}
{{- with .Values.imageRenderer.nodeSelector }} {{- with .Values.imageRenderer.nodeSelector }}
nodeSelector: nodeSelector:
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- $root := . }}
{{- with .Values.imageRenderer.affinity }} {{- with .Values.imageRenderer.affinity }}
affinity: affinity:
{{ tpl (toYaml .) $root | indent 8 }} {{- tpl (toYaml .) $root | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.imageRenderer.tolerations }} {{- with .Values.imageRenderer.tolerations }}
tolerations: tolerations:
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
volumes: volumes:
- name: image-renderer-tmpfs - name: image-renderer-tmpfs

View File

@ -1,18 +1,18 @@
{{- if and (.Values.imageRenderer.enabled) (.Values.imageRenderer.networkPolicy.limitIngress) }} {{- if and .Values.imageRenderer.enabled .Values.imageRenderer.networkPolicy.limitIngress }}
--- ---
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: NetworkPolicy kind: NetworkPolicy
metadata: metadata:
name: {{ template "grafana.fullname" . }}-image-renderer-ingress name: {{ include "grafana.fullname" . }}-image-renderer-ingress
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
annotations: annotations:
comment: Limit image-renderer ingress traffic from grafana comment: Limit image-renderer ingress traffic from grafana
spec: spec:
podSelector: podSelector:
matchLabels: matchLabels:
{{- include "grafana.imageRenderer.selectorLabels" . | nindent 6 }} {{- include "grafana.imageRenderer.selectorLabels" . | nindent 6 }}
{{- if .Values.imageRenderer.podLabels }} {{- with .Values.imageRenderer.podLabels }}
{{ toYaml .Values.imageRenderer.podLabels | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
policyTypes: policyTypes:
@ -24,30 +24,30 @@ spec:
from: from:
- namespaceSelector: - namespaceSelector:
matchLabels: matchLabels:
name: {{ template "grafana.namespace" . }} name: {{ include "grafana.namespace" . }}
podSelector: - podSelector:
matchLabels: matchLabels:
{{- include "grafana.selectorLabels" . | nindent 14 }} {{- include "grafana.selectorLabels" . | nindent 14 }}
{{- if .Values.podLabels }} {{- with .Values.podLabels }}
{{ toYaml .Values.podLabels | nindent 14 }} {{- toYaml . | nindent 14 }}
{{- end }} {{- end }}
{{ end }} {{- end }}
{{- if and (.Values.imageRenderer.enabled) (.Values.imageRenderer.networkPolicy.limitEgress) }} {{- if and .Values.imageRenderer.enabled .Values.imageRenderer.networkPolicy.limitEgress }}
--- ---
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: NetworkPolicy kind: NetworkPolicy
metadata: metadata:
name: {{ template "grafana.fullname" . }}-image-renderer-egress name: {{ include "grafana.fullname" . }}-image-renderer-egress
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
annotations: annotations:
comment: Limit image-renderer egress traffic to grafana comment: Limit image-renderer egress traffic to grafana
spec: spec:
podSelector: podSelector:
matchLabels: matchLabels:
{{- include "grafana.imageRenderer.selectorLabels" . | nindent 6 }} {{- include "grafana.imageRenderer.selectorLabels" . | nindent 6 }}
{{- if .Values.imageRenderer.podLabels }} {{- with .Values.imageRenderer.podLabels }}
{{ toYaml .Values.imageRenderer.podLabels | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
policyTypes: policyTypes:
@ -67,7 +67,7 @@ spec:
- podSelector: - podSelector:
matchLabels: matchLabels:
{{- include "grafana.selectorLabels" . | nindent 14 }} {{- include "grafana.selectorLabels" . | nindent 14 }}
{{- if .Values.podLabels }} {{- with .Values.podLabels }}
{{ toYaml .Values.podLabels | nindent 14 }} {{- toYaml . | nindent 14 }}
{{- end }} {{- end }}
{{ end }} {{- end }}

View File

@ -1,33 +1,31 @@
{{ if .Values.imageRenderer.enabled }} {{- if and .Values.imageRenderer.enabled .Values.imageRenderer.service.enabled }}
{{ if .Values.imageRenderer.service.enabled }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "grafana.fullname" . }}-image-renderer name: {{ include "grafana.fullname" . }}-image-renderer
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.imageRenderer.labels" . | nindent 4 }} {{- include "grafana.imageRenderer.labels" . | nindent 4 }}
{{- if .Values.imageRenderer.service.labels }} {{- with .Values.imageRenderer.service.labels }}
{{ toYaml .Values.imageRenderer.service.labels | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.imageRenderer.service.annotations }} {{- with .Values.imageRenderer.service.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
type: ClusterIP type: ClusterIP
{{- if .Values.imageRenderer.service.clusterIP }} {{- with .Values.imageRenderer.service.clusterIP }}
clusterIP: {{ .Values.imageRenderer.service.clusterIP }} clusterIP: {{ . }}
{{end}} {{- end }}
ports: ports:
- name: {{ .Values.imageRenderer.service.portName }} - name: {{ .Values.imageRenderer.service.portName }}
port: {{ .Values.imageRenderer.service.port }} port: {{ .Values.imageRenderer.service.port }}
protocol: TCP protocol: TCP
targetPort: {{ .Values.imageRenderer.service.targetPort }} targetPort: {{ .Values.imageRenderer.service.targetPort }}
{{- if .Values.imageRenderer.appProtocol }} {{- with .Values.imageRenderer.appProtocol }}
appProtocol: {{ .Values.imageRenderer.appProtocol }} appProtocol: {{ . }}
{{- end }} {{- end }}
selector: selector:
{{- include "grafana.imageRenderer.selectorLabels" . | nindent 4 }} {{- include "grafana.imageRenderer.selectorLabels" . | nindent 4 }}
{{ end }} {{- end }}
{{ end }}

View File

@ -11,15 +11,15 @@ apiVersion: {{ include "grafana.ingress.apiVersion" . }}
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ $fullName }} name: {{ $fullName }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- if .Values.ingress.labels }} {{- with .Values.ingress.labels }}
{{ toYaml .Values.ingress.labels | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- if .Values.ingress.annotations }} {{- with .Values.ingress.annotations }}
annotations: annotations:
{{- range $key, $value := .Values.ingress.annotations }} {{- range $key, $value := . }}
{{ $key }}: {{ tpl $value $ | quote }} {{ $key }}: {{ tpl $value $ | quote }}
{{- end }} {{- end }}
{{- end }} {{- end }}
@ -27,19 +27,19 @@ spec:
{{- if and $ingressSupportsIngressClassName .Values.ingress.ingressClassName }} {{- if and $ingressSupportsIngressClassName .Values.ingress.ingressClassName }}
ingressClassName: {{ .Values.ingress.ingressClassName }} ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end -}} {{- end -}}
{{- if .Values.ingress.tls }} {{- with .Values.ingress.tls }}
tls: tls:
{{ tpl (toYaml .Values.ingress.tls) $ | indent 4 }} {{- tpl (toYaml .) $ | nindent 4 }}
{{- end }} {{- end }}
rules: rules:
{{- if .Values.ingress.hosts }} {{- if .Values.ingress.hosts }}
{{- range .Values.ingress.hosts }} {{- range .Values.ingress.hosts }}
- host: {{ tpl . $}} - host: {{ tpl . $ }}
http: http:
paths: paths:
{{- if $extraPaths }} {{- with $extraPaths }}
{{ toYaml $extraPaths | indent 10 }} {{- toYaml . | nindent 10 }}
{{- end }} {{- end }}
- path: {{ $ingressPath }} - path: {{ $ingressPath }}
{{- if $ingressSupportsPathType }} {{- if $ingressSupportsPathType }}
pathType: {{ $ingressPathType }} pathType: {{ $ingressPathType }}
@ -68,8 +68,8 @@ spec:
serviceName: {{ $fullName }} serviceName: {{ $fullName }}
servicePort: {{ $servicePort }} servicePort: {{ $servicePort }}
{{- end }} {{- end }}
{{- if $ingressPath }} {{- with $ingressPath }}
path: {{ $ingressPath }} path: {{ . }}
{{- end }} {{- end }}
{{- if $ingressSupportsPathType }} {{- if $ingressSupportsPathType }}
pathType: {{ $ingressPathType }} pathType: {{ $ingressPathType }}

View File

@ -2,12 +2,12 @@
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: NetworkPolicy kind: NetworkPolicy
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.labels }} {{- with .Values.labels }}
{{ toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
@ -23,7 +23,7 @@ spec:
{{- end }} {{- end }}
podSelector: podSelector:
matchLabels: matchLabels:
{{- include "grafana.selectorLabels" . | nindent 6 }} {{- include "grafana.selectorLabels" . | nindent 6 }}
{{- if .Values.networkPolicy.egress.enabled }} {{- if .Values.networkPolicy.egress.enabled }}
egress: egress:
@ -38,7 +38,7 @@ spec:
from: from:
- podSelector: - podSelector:
matchLabels: matchLabels:
{{ template "grafana.fullname" . }}-client: "true" {{ include "grafana.fullname" . }}-client: "true"
{{- with .Values.networkPolicy.explicitNamespacesSelector }} {{- with .Values.networkPolicy.explicitNamespacesSelector }}
- namespaceSelector: - namespaceSelector:
{{- toYaml . | nindent 12 }} {{- toYaml . | nindent 12 }}

View File

@ -2,20 +2,20 @@
apiVersion: {{ include "grafana.podDisruptionBudget.apiVersion" . }} apiVersion: {{ include "grafana.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget kind: PodDisruptionBudget
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- if .Values.labels }} {{- with .Values.labels }}
{{ toYaml .Values.labels | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
{{- if .Values.podDisruptionBudget.minAvailable }} {{- with .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} minAvailable: {{ . }}
{{- end }} {{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }} {{- with .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} maxUnavailable: {{ . }}
{{- end }} {{- end }}
selector: selector:
matchLabels: matchLabels:
{{- include "grafana.selectorLabels" . | nindent 6 }} {{- include "grafana.selectorLabels" . | nindent 6 }}

View File

@ -1,9 +1,8 @@
{{- if .Values.rbac.pspEnabled }} {{- if and .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodSecurityPolicy kind: PodSecurityPolicy
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
annotations: annotations:
@ -48,4 +47,3 @@ spec:
max: 65535 max: 65535
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
{{- end }} {{- end }}
{{- end }}

View File

@ -2,17 +2,20 @@
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.persistence.extraPvcLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.persistence.annotations }} {{- with .Values.persistence.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.persistence.finalizers }} {{- with .Values.persistence.finalizers }}
finalizers: finalizers:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
accessModes: accessModes:
@ -22,12 +25,12 @@ spec:
resources: resources:
requests: requests:
storage: {{ .Values.persistence.size | quote }} storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClassName }} {{- with .Values.persistence.storageClassName }}
storageClassName: {{ .Values.persistence.storageClassName }} storageClassName: {{ . }}
{{- end -}} {{- end }}
{{- with .Values.persistence.selectorLabels }} {{- with .Values.persistence.selectorLabels }}
selector: selector:
matchLabels: matchLabels:
{{ toYaml . | indent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
{{- end -}} {{- end }}

View File

@ -1,31 +1,31 @@
{{- if and .Values.rbac.create (not .Values.rbac.useExistingRole) -}} {{- if and .Values.rbac.create (not .Values.rbac.useExistingRole) -}}
apiVersion: {{ template "grafana.rbac.apiVersion" . }} apiVersion: {{ include "grafana.rbac.apiVersion" . }}
kind: Role kind: Role
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- if or .Values.rbac.pspEnabled (and .Values.rbac.namespaced (or .Values.sidecar.dashboards.enabled (or .Values.sidecar.datasources.enabled (or .Values.sidecar.plugins.enabled .Values.rbac.extraRoleRules)))) }} {{- if or .Values.rbac.pspEnabled (and .Values.rbac.namespaced (or .Values.sidecar.dashboards.enabled .Values.sidecar.datasources.enabled .Values.sidecar.plugins.enabled .Values.rbac.extraRoleRules)) }}
rules: rules:
{{- if .Values.rbac.pspEnabled }} {{- if .Values.rbac.pspEnabled }}
- apiGroups: ['extensions'] - apiGroups: ['extensions']
resources: ['podsecuritypolicies'] resources: ['podsecuritypolicies']
verbs: ['use'] verbs: ['use']
resourceNames: [{{ template "grafana.fullname" . }}] resourceNames: [{{ include "grafana.fullname" . }}]
{{- end }} {{- end }}
{{- if and .Values.rbac.namespaced (or .Values.sidecar.dashboards.enabled (or .Values.sidecar.datasources.enabled .Values.sidecar.plugins.enabled)) }} {{- if and .Values.rbac.namespaced (or .Values.sidecar.dashboards.enabled .Values.sidecar.datasources.enabled .Values.sidecar.plugins.enabled) }}
- apiGroups: [""] # "" indicates the core API group - apiGroups: [""] # "" indicates the core API group
resources: ["configmaps", "secrets"] resources: ["configmaps", "secrets"]
verbs: ["get", "watch", "list"] verbs: ["get", "watch", "list"]
{{- end }} {{- end }}
{{- with .Values.rbac.extraRoleRules }} {{- with .Values.rbac.extraRoleRules }}
{{ toYaml . | indent 0 }} {{- toYaml . | nindent 2 }}
{{- end}} {{- end}}
{{- else }} {{- else }}
rules: [] rules: []
{{- end }} {{- end }}

View File

@ -1,25 +1,25 @@
{{- if .Values.rbac.create -}} {{- if .Values.rbac.create }}
apiVersion: {{ template "grafana.rbac.apiVersion" . }} apiVersion: {{ include "grafana.rbac.apiVersion" . }}
kind: RoleBinding kind: RoleBinding
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
roleRef: roleRef:
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
kind: Role kind: Role
{{- if (not .Values.rbac.useExistingRole) }} {{- if .Values.rbac.useExistingRole }}
name: {{ template "grafana.fullname" . }}
{{- else }}
name: {{ .Values.rbac.useExistingRole }} name: {{ .Values.rbac.useExistingRole }}
{{- end }} {{- else }}
name: {{ include "grafana.fullname" . }}
{{- end }}
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: {{ template "grafana.serviceAccountName" . }} name: {{ include "grafana.serviceAccountName" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
{{- end -}} {{- end }}

View File

@ -2,13 +2,13 @@
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ template "grafana.fullname" . }}-env name: {{ include "grafana.fullname" . }}-env
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
type: Opaque type: Opaque
data: data:
{{- range $key, $val := .Values.envRenderSecret }} {{- range $key, $val := .Values.envRenderSecret }}
{{ $key }}: {{ $val | b64enc | quote }} {{ $key }}: {{ $val | b64enc | quote }}
{{- end -}} {{- end }}
{{- end }} {{- end }}

View File

@ -2,14 +2,14 @@
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
type: Opaque type: Opaque
data: data:
{{- if and (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) (not .Values.admin.existingSecret) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD__FILE) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD) }} {{- if and (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) (not .Values.admin.existingSecret) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD__FILE) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD) }}
@ -17,7 +17,7 @@ data:
{{- if .Values.adminPassword }} {{- if .Values.adminPassword }}
admin-password: {{ .Values.adminPassword | b64enc | quote }} admin-password: {{ .Values.adminPassword | b64enc | quote }}
{{- else }} {{- else }}
admin-password: {{ template "grafana.password" . }} admin-password: {{ include "grafana.password" . }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if not .Values.ldap.existingSecret }} {{- if not .Values.ldap.existingSecret }}

View File

@ -1,55 +1,55 @@
{{ if .Values.service.enabled }} {{- if .Values.service.enabled }}
{{- $root := . }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- if .Values.service.labels }} {{- with .Values.service.labels }}
{{ toYaml .Values.service.labels | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- $root := . }} {{- with .Values.service.annotations }}
{{- with .Values.service.annotations }}
annotations: annotations:
{{ tpl (toYaml . | indent 4) $root }} {{- tpl (toYaml . | nindent 4) $root }}
{{- end }}
spec:
{{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }}
type: ClusterIP
{{- if .Values.service.clusterIP }}
clusterIP: {{ .Values.service.clusterIP }}
{{end}}
{{- else if eq .Values.service.type "LoadBalancer" }}
type: {{ .Values.service.type }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }} {{- end }}
{{- if .Values.service.loadBalancerSourceRanges }} spec:
loadBalancerSourceRanges: {{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }}
{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} type: ClusterIP
{{- end -}} {{- with .Values.service.clusterIP }}
{{- else }} clusterIP: {{ . }}
{{- end }}
{{- else if eq .Values.service.type "LoadBalancer" }}
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
{{- end }} {{- with .Values.service.loadBalancerIP }}
{{- if .Values.service.externalIPs }} loadBalancerIP: {{ . }}
{{- end }}
{{- with .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- else }}
type: {{ .Values.service.type }}
{{- end }}
{{- with .Values.service.externalIPs }}
externalIPs: externalIPs:
{{ toYaml .Values.service.externalIPs | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
ports: ports:
- name: {{ .Values.service.portName }} - name: {{ .Values.service.portName }}
port: {{ .Values.service.port }} port: {{ .Values.service.port }}
protocol: TCP protocol: TCP
targetPort: {{ .Values.service.targetPort }} targetPort: {{ .Values.service.targetPort }}
{{- if .Values.service.appProtocol }} {{- with .Values.service.appProtocol }}
appProtocol: {{ .Values.service.appProtocol }} appProtocol: {{ . }}
{{- end }} {{- end }}
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
nodePort: {{.Values.service.nodePort}} nodePort: {{ .Values.service.nodePort }}
{{ end }} {{- end }}
{{- if .Values.extraExposePorts }} {{- with .Values.extraExposePorts }}
{{- tpl (toYaml .Values.extraExposePorts) . | nindent 4 }} {{- tpl (toYaml . | nindent 4) $root }}
{{- end }} {{- end }}
selector: selector:
{{- include "grafana.selectorLabels" . | nindent 4 }} {{- include "grafana.selectorLabels" . | nindent 4 }}
{{ end }} {{- end }}

View File

@ -1,14 +1,17 @@
{{- if .Values.serviceAccount.create }} {{- if .Values.serviceAccount.create }}
{{- $root := . -}}
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- $root := . }} {{- with .Values.serviceAccount.labels }}
{{- with .Values.serviceAccount.annotations }} {{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.annotations }}
annotations: annotations:
{{ tpl (toYaml . | indent 4) $root }} {{- tpl (toYaml . | nindent 4) $root }}
{{- end }} {{- end }}
name: {{ template "grafana.serviceAccountName" . }} name: {{ include "grafana.serviceAccountName" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
{{- end }} {{- end }}

View File

@ -3,16 +3,16 @@
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor kind: ServiceMonitor
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
{{- if .Values.serviceMonitor.namespace }} {{- if .Values.serviceMonitor.namespace }}
namespace: {{ tpl .Values.serviceMonitor.namespace . }} namespace: {{ tpl .Values.serviceMonitor.namespace . }}
{{- else }} {{- else }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
{{- end }} {{- end }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.labels }} {{- with .Values.serviceMonitor.labels }}
{{- toYaml .Values.serviceMonitor.labels | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
endpoints: endpoints:
@ -26,19 +26,19 @@ spec:
honorLabels: true honorLabels: true
path: {{ .Values.serviceMonitor.path }} path: {{ .Values.serviceMonitor.path }}
scheme: {{ .Values.serviceMonitor.scheme }} scheme: {{ .Values.serviceMonitor.scheme }}
{{- if .Values.serviceMonitor.tlsConfig }} {{- with .Values.serviceMonitor.tlsConfig }}
tlsConfig: tlsConfig:
{{- toYaml .Values.serviceMonitor.tlsConfig | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
{{- if .Values.serviceMonitor.relabelings }} {{- with .Values.serviceMonitor.relabelings }}
relabelings: relabelings:
{{- toYaml .Values.serviceMonitor.relabelings | nindent 4 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}
jobLabel: "{{ .Release.Name }}" jobLabel: "{{ .Release.Name }}"
selector: selector:
matchLabels: matchLabels:
{{- include "grafana.selectorLabels" . | nindent 8 }} {{- include "grafana.selectorLabels" . | nindent 6 }}
namespaceSelector: namespaceSelector:
matchNames: matchNames:
- {{ template "grafana.namespace" . }} - {{ include "grafana.namespace" . }}
{{- end }} {{- end }}

View File

@ -1,38 +1,39 @@
{{- if (or (.Values.useStatefulSet) (and .Values.persistence.enabled (not .Values.persistence.existingClaim) (eq .Values.persistence.type "statefulset")))}} {{- $sts := list "sts" "StatefulSet" -}}
{{- if (or (.Values.useStatefulSet) (and .Values.persistence.enabled (not .Values.persistence.existingClaim) (has .Values.persistence.type $sts)))}}
apiVersion: apps/v1 apiVersion: apps/v1
kind: StatefulSet kind: StatefulSet
metadata: metadata:
name: {{ template "grafana.fullname" . }} name: {{ include "grafana.fullname" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
{{- with .Values.annotations }} {{- with .Values.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
replicas: {{ .Values.replicas }} replicas: {{ .Values.replicas }}
selector: selector:
matchLabels: matchLabels:
{{- include "grafana.selectorLabels" . | nindent 6 }} {{- include "grafana.selectorLabels" . | nindent 6 }}
serviceName: {{ template "grafana.fullname" . }}-headless serviceName: {{ include "grafana.fullname" . }}-headless
template: template:
metadata: metadata:
labels: labels:
{{- include "grafana.selectorLabels" . | nindent 8 }} {{- include "grafana.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }} {{- with .Values.podLabels }}
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
annotations: annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/dashboards-json-config: {{ include (print $.Template.BasePath "/dashboards-json-configmap.yaml") . | sha256sum }} checksum/dashboards-json-config: {{ include (print $.Template.BasePath "/dashboards-json-configmap.yaml") . | sha256sum }}
checksum/sc-dashboard-provider-config: {{ include (print $.Template.BasePath "/configmap-dashboard-provider.yaml") . | sha256sum }} checksum/sc-dashboard-provider-config: {{ include (print $.Template.BasePath "/configmap-dashboard-provider.yaml") . | sha256sum }}
{{- if and (or (and (not .Values.admin.existingSecret) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD__FILE) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD)) (and .Values.ldap.enabled (not .Values.ldap.existingSecret))) (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) }} {{- if and (or (and (not .Values.admin.existingSecret) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD__FILE) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD)) (and .Values.ldap.enabled (not .Values.ldap.existingSecret))) (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- end }} {{- end }}
{{- with .Values.podAnnotations }} {{- with .Values.podAnnotations }}
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
{{- include "grafana.pod" . | nindent 6 }} {{- include "grafana.pod" . | nindent 6 }}
{{- if .Values.persistence.enabled}} {{- if .Values.persistence.enabled}}
@ -48,7 +49,7 @@ spec:
{{- with .Values.persistence.selectorLabels }} {{- with .Values.persistence.selectorLabels }}
selector: selector:
matchLabels: matchLabels:
{{ toYaml . | indent 10 }} {{- toYaml . | nindent 10 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -2,14 +2,17 @@
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: {{ template "grafana.fullname" . }}-test name: {{ include "grafana.fullname" . }}-test
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
annotations:
"helm.sh/hook": test-success
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
data: data:
run.sh: |- run.sh: |-
@test "Test Health" { @test "Test Health" {
url="http://{{ template "grafana.fullname" . }}/api/health" url="http://{{ include "grafana.fullname" . }}/api/health"
code=$(wget --server-response --spider --timeout 90 --tries 10 ${url} 2>&1 | awk '/^ HTTP/{print $2}') code=$(wget --server-response --spider --timeout 90 --tries 10 ${url} 2>&1 | awk '/^ HTTP/{print $2}')
[ "$code" == "200" ] [ "$code" == "200" ]

View File

@ -1,9 +1,11 @@
{{- if and .Values.testFramework.enabled .Values.rbac.pspEnabled }} {{- if and .Values.testFramework.enabled .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodSecurityPolicy kind: PodSecurityPolicy
metadata: metadata:
name: {{ template "grafana.fullname" . }}-test name: {{ include "grafana.fullname" . }}-test
annotations:
"helm.sh/hook": test-success
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
spec: spec:
@ -21,11 +23,10 @@ spec:
runAsUser: runAsUser:
rule: RunAsAny rule: RunAsAny
volumes: volumes:
- configMap - configMap
- downwardAPI - downwardAPI
- emptyDir - emptyDir
- projected - projected
- csi - csi
- secret - secret
{{- end }}
{{- end }} {{- end }}

View File

@ -1,14 +1,17 @@
{{- if and .Values.testFramework.enabled .Values.rbac.pspEnabled -}} {{- if and .Values.testFramework.enabled .Values.rbac.pspEnabled }}
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: Role kind: Role
metadata: metadata:
name: {{ template "grafana.fullname" . }}-test name: {{ include "grafana.fullname" . }}-test
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
annotations:
"helm.sh/hook": test-success
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
rules: rules:
- apiGroups: ['policy'] - apiGroups: ['policy']
resources: ['podsecuritypolicies'] resources: ['podsecuritypolicies']
verbs: ['use'] verbs: ['use']
resourceNames: [{{ template "grafana.fullname" . }}-test] resourceNames: [{{ include "grafana.fullname" . }}-test]
{{- end }} {{- end }}

View File

@ -1,17 +1,20 @@
{{- if and .Values.testFramework.enabled .Values.rbac.pspEnabled -}} {{- if and .Values.testFramework.enabled .Values.rbac.pspEnabled }}
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding kind: RoleBinding
metadata: metadata:
name: {{ template "grafana.fullname" . }}-test name: {{ include "grafana.fullname" . }}-test
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
annotations:
"helm.sh/hook": test-success
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
roleRef: roleRef:
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
kind: Role kind: Role
name: {{ template "grafana.fullname" . }}-test name: {{ include "grafana.fullname" . }}-test
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: {{ template "grafana.serviceAccountNameTest" . }} name: {{ include "grafana.serviceAccountNameTest" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
{{- end }} {{- end }}

View File

@ -4,6 +4,9 @@ kind: ServiceAccount
metadata: metadata:
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
name: {{ template "grafana.serviceAccountNameTest" . }} name: {{ include "grafana.serviceAccountNameTest" . }}
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
annotations:
"helm.sh/hook": test-success
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
{{- end }} {{- end }}

View File

@ -1,38 +1,36 @@
{{- if .Values.testFramework.enabled }} {{- if .Values.testFramework.enabled }}
{{- $root := . }}
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: {{ template "grafana.fullname" . }}-test name: {{ include "grafana.fullname" . }}-test
labels: labels:
{{- include "grafana.labels" . | nindent 4 }} {{- include "grafana.labels" . | nindent 4 }}
annotations: annotations:
"helm.sh/hook": test-success "helm.sh/hook": test-success
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded" "helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
namespace: {{ template "grafana.namespace" . }} namespace: {{ include "grafana.namespace" . }}
spec: spec:
serviceAccountName: {{ template "grafana.serviceAccountNameTest" . }} serviceAccountName: {{ include "grafana.serviceAccountNameTest" . }}
{{- if .Values.testFramework.securityContext }} {{- with .Values.testFramework.securityContext }}
securityContext: {{ toYaml .Values.testFramework.securityContext | nindent 4 }} securityContext:
{{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- $root := . }} {{- if or .Values.image.pullSecrets .Values.global.imagePullSecrets }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets: imagePullSecrets:
{{- range .Values.image.pullSecrets }} {{- include "grafana.imagePullSecrets" (dict "root" $root "imagePullSecrets" .Values.image.pullSecrets) | nindent 4 }}
- name: {{ tpl . $root }}
{{- end}}
{{- end }} {{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- $root := . }}
{{- with .Values.affinity }} {{- with .Values.affinity }}
affinity: affinity:
{{ tpl (toYaml .) $root | indent 4 }} {{- tpl (toYaml .) $root | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.tolerations }} {{- with .Values.tolerations }}
tolerations: tolerations:
{{ toYaml . | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
containers: containers:
- name: {{ .Release.Name }}-test - name: {{ .Release.Name }}-test
@ -44,8 +42,8 @@ spec:
name: tests name: tests
readOnly: true readOnly: true
volumes: volumes:
- name: tests - name: tests
configMap: configMap:
name: {{ template "grafana.fullname" . }}-test name: {{ include "grafana.fullname" . }}-test
restartPolicy: Never restartPolicy: Never
{{- end }} {{- end }}

View File

@ -1,3 +1,18 @@
global:
# To help compatibility with other charts which use global.imagePullSecrets.
# Allow either an array of {name: pullSecret} maps (k8s-style), or an array of strings (more common helm-style).
# Can be tempalted.
# global:
# imagePullSecrets:
# - name: pullSecret1
# - name: pullSecret2
# or
# global:
# imagePullSecrets:
# - pullSecret1
# - pullSecret2
imagePullSecrets: []
rbac: rbac:
create: true create: true
## Use an existing ClusterRole/Role (depending on rbac.namespaced false/true) ## Use an existing ClusterRole/Role (depending on rbac.namespaced false/true)
@ -17,6 +32,8 @@ serviceAccount:
create: true create: true
name: name:
nameTest: nameTest:
## ServiceAccount labels.
labels: {}
## Service account annotations. Can be templated. ## Service account annotations. Can be templated.
# annotations: # annotations:
# eks.amazonaws.com/role-arn: arn:aws:iam::123456789000:role/iam-role-name-here # eks.amazonaws.com/role-arn: arn:aws:iam::123456789000:role/iam-role-name-here
@ -99,8 +116,7 @@ securityContext:
runAsGroup: 472 runAsGroup: 472
fsGroup: 472 fsGroup: 472
containerSecurityContext: containerSecurityContext: {}
{}
# Enable creating the grafana configmap # Enable creating the grafana configmap
createConfigmap: true createConfigmap: true
@ -137,6 +153,11 @@ downloadDashboards:
envFromSecret: "" envFromSecret: ""
resources: {} resources: {}
securityContext: {} securityContext: {}
envValueFrom: {}
# ENV_NAME:
# configMapKeyRef:
# name: configmap-name
# key: value_key
## Pod Annotations ## Pod Annotations
# podAnnotations: {} # podAnnotations: {}
@ -307,6 +328,8 @@ persistence:
# subPath: "" # subPath: ""
## Name of an existing PVC. Can be templated. ## Name of an existing PVC. Can be templated.
# existingClaim: # existingClaim:
## Extra labels to apply to a PVC.
extraPvcLabels: {}
## If persistence is not enabled, this allows to mount the ## If persistence is not enabled, this allows to mount the
## local storage in-memory to improve performance ## local storage in-memory to improve performance
@ -321,7 +344,7 @@ persistence:
initChownData: initChownData:
## If false, data ownership will not be reset at startup ## If false, data ownership will not be reset at startup
## This allows the prometheus-server to be run with an arbitrary user ## This allows the grafana-server to be run with an arbitrary user
## ##
enabled: true enabled: true
@ -343,6 +366,9 @@ initChownData:
# requests: # requests:
# cpu: 100m # cpu: 100m
# memory: 128Mi # memory: 128Mi
securityContext:
runAsNonRoot: false
runAsUser: 0
# Administrator credentials when not using an existing secret (see below) # Administrator credentials when not using an existing secret (see below)
@ -363,11 +389,6 @@ admin:
# - "sh" # - "sh"
# - "/run.sh" # - "/run.sh"
## Use an alternate scheduler, e.g. "stork".
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
##
# schedulerName:
## Extra environment variables that will be pass onto deployment pods ## Extra environment variables that will be pass onto deployment pods
## ##
## to provide grafana with access to CloudWatch on AWS EKS: ## to provide grafana with access to CloudWatch on AWS EKS:
@ -581,7 +602,7 @@ alerting: {}
# component: Grafana # component: Grafana
# group: app-stack # group: app-stack
# summary: | # summary: |
# {{ `{{ template "default.message" . }}` }} # {{ `{{ include "default.message" . }}` }}
## Configure notifiers ## Configure notifiers
## ref: http://docs.grafana.org/administration/provisioning/#alert-notification-channels ## ref: http://docs.grafana.org/administration/provisioning/#alert-notification-channels
@ -987,6 +1008,7 @@ revisionHistoryLimit: 10
## Add a seperate remote image renderer deployment/service ## Add a seperate remote image renderer deployment/service
imageRenderer: imageRenderer:
deploymentStrategy: {}
# Enable the image-renderer deployment & service # Enable the image-renderer deployment & service
enabled: false enabled: false
replicas: 1 replicas: 1
@ -1009,6 +1031,12 @@ imageRenderer:
serviceAccountName: "" serviceAccountName: ""
# image-renderer deployment securityContext # image-renderer deployment securityContext
securityContext: {} securityContext: {}
# image-renderer deployment container securityContext
containerSecurityContext:
capabilities:
drop: ['ALL']
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
# image-renderer deployment Host Aliases # image-renderer deployment Host Aliases
hostAliases: [] hostAliases: []
# image-renderer deployment priority class # image-renderer deployment priority class
@ -1058,6 +1086,11 @@ imageRenderer:
## ##
affinity: {} affinity: {}
## Use an alternate scheduler, e.g. "stork".
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
##
# schedulerName: "default-scheduler"
networkPolicy: networkPolicy:
## @param networkPolicy.enabled Enable creation of NetworkPolicy resources. Only Ingress traffic is filtered for now. ## @param networkPolicy.enabled Enable creation of NetworkPolicy resources. Only Ingress traffic is filtered for now.
## ##

View File

@ -1,5 +1,5 @@
apiVersion: v2 apiVersion: v2
appVersion: 2.6.0 appVersion: 2.7.0
description: Install kube-state-metrics to generate and expose cluster-level metrics description: Install kube-state-metrics to generate and expose cluster-level metrics
home: https://github.com/kubernetes/kube-state-metrics/ home: https://github.com/kubernetes/kube-state-metrics/
keywords: keywords:
@ -12,10 +12,10 @@ maintainers:
name: tariq1890 name: tariq1890
- email: manuel@rueg.eu - email: manuel@rueg.eu
name: mrueg name: mrueg
- email: davidcalvertfr@gmail.com - email: david@0xdc.me
name: dotdc name: dotdc
name: kube-state-metrics name: kube-state-metrics
sources: sources:
- https://github.com/kubernetes/kube-state-metrics/ - https://github.com/kubernetes/kube-state-metrics/
type: application type: application
version: 4.20.2 version: 4.24.0

View File

@ -80,3 +80,22 @@ Selector labels
app.kubernetes.io/name: {{ include "kube-state-metrics.name" . }} app.kubernetes.io/name: {{ include "kube-state-metrics.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }} {{- end }}
{{/* Sets default scrape limits for servicemonitor */}}
{{- define "servicemonitor.scrapeLimits" -}}
{{- with .sampleLimit }}
sampleLimit: {{ . }}
{{- end }}
{{- with .targetLimit }}
targetLimit: {{ . }}
{{- end }}
{{- with .labelLimit }}
labelLimit: {{ . }}
{{- end }}
{{- with .labelNameLengthLimit }}
labelNameLengthLimit: {{ . }}
{{- end }}
{{- with .labelValueLengthLimit }}
labelValueLengthLimit: {{ . }}
{{- end }}
{{- end -}}

View File

@ -1,4 +1,4 @@
{{- if .Values.podSecurityPolicy.enabled }} {{- if and .Values.podSecurityPolicy.enabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodSecurityPolicy kind: PodSecurityPolicy
metadata: metadata:

View File

@ -1,4 +1,4 @@
{{- if and .Values.podSecurityPolicy.enabled .Values.rbac.create -}} {{- if and .Values.podSecurityPolicy.enabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole kind: ClusterRole
metadata: metadata:

View File

@ -1,4 +1,4 @@
{{- if and .Values.podSecurityPolicy.enabled .Values.rbac.create -}} {{- if and .Values.podSecurityPolicy.enabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
metadata: metadata:

View File

@ -69,6 +69,12 @@ rules:
- jobs - jobs
verbs: ["list", "watch"] verbs: ["list", "watch"]
{{ end -}} {{ end -}}
{{ if has "leases" $.Values.collectors }}
- apiGroups: ["coordination.k8s.io"]
resources:
- leases
verbs: ["list", "watch"]
{{ end -}}
{{ if has "limitranges" $.Values.collectors }} {{ if has "limitranges" $.Values.collectors }}
- apiGroups: [""] - apiGroups: [""]
resources: resources:

View File

@ -34,7 +34,15 @@ spec:
{{- if .Values.service.loadBalancerIP }} {{- if .Values.service.loadBalancerIP }}
loadBalancerIP: "{{ .Values.service.loadBalancerIP }}" loadBalancerIP: "{{ .Values.service.loadBalancerIP }}"
{{- end }} {{- end }}
{{- if .Values.service.clusterIP }} {{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- range $cidr := .Values.service.loadBalancerSourceRanges }}
- {{ $cidr }}
{{- end }}
{{- end }}
{{- if .Values.autosharding.enabled }}
clusterIP: None
{{- else if .Values.service.clusterIP }}
clusterIP: "{{ .Values.service.clusterIP }}" clusterIP: "{{ .Values.service.clusterIP }}"
{{- end }} {{- end }}
selector: selector:

View File

@ -11,11 +11,12 @@ metadata:
{{- end }} {{- end }}
spec: spec:
jobLabel: {{ default "app.kubernetes.io/name" .Values.prometheus.monitor.jobLabel }} jobLabel: {{ default "app.kubernetes.io/name" .Values.prometheus.monitor.jobLabel }}
{{- include "servicemonitor.scrapeLimits" .Values.prometheus.monitor | indent 2 }}
selector: selector:
matchLabels: matchLabels:
{{- if .Values.prometheus.monitor.selectorOverride -}} {{- with .Values.prometheus.monitor.selectorOverride }}
{{ toYaml .Values.prometheus.monitor.selectorOverride | nindent 6 }} {{- toYaml . | nindent 6 }}
{{ else }} {{- else }}
{{- include "kube-state-metrics.selectorLabels" . | indent 6 }} {{- include "kube-state-metrics.selectorLabels" . | indent 6 }}
{{- end }} {{- end }}
endpoints: endpoints:

View File

@ -2,7 +2,7 @@
prometheusScrape: true prometheusScrape: true
image: image:
repository: registry.k8s.io/kube-state-metrics/kube-state-metrics repository: registry.k8s.io/kube-state-metrics/kube-state-metrics
tag: v2.6.0 tag: v2.7.0
sha: "" sha: ""
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
@ -29,6 +29,8 @@ service:
type: ClusterIP type: ClusterIP
nodePort: 0 nodePort: 0
loadBalancerIP: "" loadBalancerIP: ""
# Only allow access to the loadBalancerIP from these IPs
loadBalancerSourceRanges: []
clusterIP: "" clusterIP: ""
annotations: {} annotations: {}
@ -79,6 +81,25 @@ prometheus:
namespace: "" namespace: ""
jobLabel: "" jobLabel: ""
interval: "" interval: ""
## SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
##
sampleLimit: 0
## TargetLimit defines a limit on the number of scraped targets that will be accepted.
##
targetLimit: 0
## Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.
##
labelLimit: 0
## Per-scrape limit on length of labels name that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.
##
labelNameLengthLimit: 0
## Per-scrape limit on length of labels value that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.
##
labelValueLengthLimit: 0
scrapeTimeout: "" scrapeTimeout: ""
proxyUrl: "" proxyUrl: ""
selectorOverride: {} selectorOverride: {}
@ -184,6 +205,7 @@ collectors:
- horizontalpodautoscalers - horizontalpodautoscalers
- ingresses - ingresses
- jobs - jobs
- leases
- limitranges - limitranges
- mutatingwebhookconfigurations - mutatingwebhookconfigurations
- namespaces - namespaces

View File

@ -1,5 +1,5 @@
apiVersion: v2 apiVersion: v2
appVersion: 1.3.1 appVersion: 1.5.0
description: A Helm chart for prometheus node-exporter description: A Helm chart for prometheus node-exporter
home: https://github.com/prometheus/node_exporter/ home: https://github.com/prometheus/node_exporter/
keywords: keywords:
@ -15,4 +15,4 @@ name: prometheus-node-exporter
sources: sources:
- https://github.com/prometheus/node_exporter/ - https://github.com/prometheus/node_exporter/
type: application type: application
version: 4.3.0 version: 4.8.0

View File

@ -3,8 +3,8 @@
Expand the name of the chart. Expand the name of the chart.
*/}} */}}
{{- define "prometheus-node-exporter.name" -}} {{- define "prometheus-node-exporter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end -}} {{- end }}
{{/* {{/*
Create a default fully qualified app name. Create a default fully qualified app name.
@ -12,30 +12,39 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
If release name contains chart name it will be used as a full name. If release name contains chart name it will be used as a full name.
*/}} */}}
{{- define "prometheus-node-exporter.fullname" -}} {{- define "prometheus-node-exporter.fullname" -}}
{{- if .Values.fullnameOverride -}} {{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else -}} {{- else }}
{{- $name := default .Chart.Name .Values.nameOverride -}} {{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name -}} {{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} {{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else -}} {{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* Generate basic labels */}} {{/*
{{- define "prometheus-node-exporter.labels" }} Create chart name and version as used by the chart label.
helm.sh/chart: {{ template "prometheus-node-exporter.chart" . }} */}}
{{- define "prometheus-node-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "prometheus-node-exporter.labels" -}}
helm.sh/chart: {{ include "prometheus-node-exporter.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: metrics app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: {{ template "prometheus-node-exporter.name" . }} app.kubernetes.io/part-of: {{ include "prometheus-node-exporter.name" . }}
{{- include "prometheus-node-exporter.selectorLabels" . }} {{ include "prometheus-node-exporter.selectorLabels" . }}
{{- if .Chart.AppVersion }} {{- with .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/version: {{ . | quote }}
{{- end }} {{- end }}
{{- if .Values.podLabels}} {{- with .Values.podLabels }}
{{ toYaml .Values.podLabels }} {{ toYaml . }}
{{- end }} {{- end }}
{{- if .Values.releaseLabel }} {{- if .Values.releaseLabel }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
@ -45,37 +54,30 @@ release: {{ .Release.Name }}
{{/* {{/*
Selector labels Selector labels
*/}} */}}
{{- define "prometheus-node-exporter.selectorLabels" }} {{- define "prometheus-node-exporter.selectorLabels" -}}
app.kubernetes.io/name: {{ include "prometheus-node-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/name: {{ template "prometheus-node-exporter.name" . }}
{{- end }} {{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "prometheus-node-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/* {{/*
Create the name of the service account to use Create the name of the service account to use
*/}} */}}
{{- define "prometheus-node-exporter.serviceAccountName" -}} {{- define "prometheus-node-exporter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}} {{- if .Values.serviceAccount.create }}
{{ default (include "prometheus-node-exporter.fullname" .) .Values.serviceAccount.name }} {{- default (include "prometheus-node-exporter.fullname" .) .Values.serviceAccount.name }}
{{- else -}} {{- else }}
{{ default "default" .Values.serviceAccount.name }} {{- default "default" .Values.serviceAccount.name }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* {{/*
The image to use The image to use
*/}} */}}
{{- define "prometheus-node-exporter.image" -}} {{- define "prometheus-node-exporter.image" -}}
{{- if .Values.image.sha -}} {{- if .Values.image.sha }}
{{- printf "%s:%s@%s" .Values.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.image.tag) .Values.image.sha }} {{- printf "%s:%s@%s" .Values.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.image.tag) .Values.image.sha }}
{{- else -}} {{- else }}
{{- printf "%s:%s" .Values.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.image.tag) }} {{- printf "%s:%s" .Values.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.image.tag) }}
{{- end }} {{- end }}
{{- end }} {{- end }}
@ -84,24 +86,43 @@ The image to use
Allow the release namespace to be overridden for multi-namespace deployments in combined charts Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}} */}}
{{- define "prometheus-node-exporter.namespace" -}} {{- define "prometheus-node-exporter.namespace" -}}
{{- if .Values.namespaceOverride -}} {{- if .Values.namespaceOverride }}
{{- .Values.namespaceOverride -}} {{- .Values.namespaceOverride }}
{{- else -}} {{- else }}
{{- .Release.Namespace -}} {{- .Release.Namespace }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* {{/*
Create the namespace name of the service monitor Create the namespace name of the service monitor
*/}} */}}
{{- define "prometheus-node-exporter.monitor-namespace" -}} {{- define "prometheus-node-exporter.monitor-namespace" -}}
{{- if .Values.namespaceOverride -}} {{- if .Values.namespaceOverride }}
{{- .Values.namespaceOverride -}} {{- .Values.namespaceOverride }}
{{- else -}} {{- else }}
{{- if .Values.prometheus.monitor.namespace -}} {{- if .Values.prometheus.monitor.namespace }}
{{- .Values.prometheus.monitor.namespace -}} {{- .Values.prometheus.monitor.namespace }}
{{- else -}} {{- else }}
{{- .Release.Namespace -}} {{- .Release.Namespace }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{- end -}} {{- end }}
{{/* Sets default scrape limits for servicemonitor */}}
{{- define "servicemonitor.scrapeLimits" -}}
{{- with .sampleLimit }}
sampleLimit: {{ . }}
{{- end }}
{{- with .targetLimit }}
targetLimit: {{ . }}
{{- end }}
{{- with .labelLimit }}
labelLimit: {{ . }}
{{- end }}
{{- with .labelNameLengthLimit }}
labelNameLengthLimit: {{ . }}
{{- end }}
{{- with .labelValueLengthLimit }}
labelValueLengthLimit: {{ . }}
{{- end }}
{{- end }}

View File

@ -1,38 +1,44 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: DaemonSet kind: DaemonSet
metadata: metadata:
name: {{ template "prometheus-node-exporter.fullname" . }} name: {{ include "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }} namespace: {{ include "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }} labels:
{{- include "prometheus-node-exporter.labels" . | nindent 4 }}
{{- with .Values.daemonsetAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
selector: selector:
matchLabels: matchLabels:
{{- include "prometheus-node-exporter.selectorLabels" . | indent 6 }} {{- include "prometheus-node-exporter.selectorLabels" . | nindent 6 }}
{{- if .Values.updateStrategy }} {{- with .Values.updateStrategy }}
updateStrategy: updateStrategy:
{{ toYaml .Values.updateStrategy | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
template: template:
metadata: metadata:
labels: {{ include "prometheus-node-exporter.labels" . | indent 8 }} {{- with .Values.podAnnotations }}
{{- if .Values.podAnnotations }}
annotations: annotations:
{{- toYaml .Values.podAnnotations | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
labels:
{{- include "prometheus-node-exporter.labels" . | nindent 8 }}
spec: spec:
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
serviceAccountName: {{ template "prometheus-node-exporter.serviceAccountName" . }} {{- with .Values.securityContext }}
{{- if .Values.securityContext }}
securityContext: securityContext:
{{ toYaml .Values.securityContext | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
{{- if .Values.extraInitContainers }}
initContainers:
{{ toYaml .Values.extraInitContainers | nindent 6 }}
{{- end }} {{- end }}
{{- with .Values.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- with .Values.extraInitContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "prometheus-node-exporter.serviceAccountName" . }}
containers: containers:
- name: node-exporter - name: node-exporter
image: {{ include "prometheus-node-exporter.image" . }} image: {{ include "prometheus-node-exporter.image" . }}
@ -44,26 +50,27 @@ spec:
- --path.rootfs=/host/root - --path.rootfs=/host/root
{{- end }} {{- end }}
- --web.listen-address=[$(HOST_IP)]:{{ .Values.service.port }} - --web.listen-address=[$(HOST_IP)]:{{ .Values.service.port }}
{{- if .Values.extraArgs }} {{- with .Values.extraArgs }}
{{ toYaml .Values.extraArgs | indent 12 }} {{- toYaml . | nindent 12 }}
{{- end }} {{- end }}
{{- with .Values.containerSecurityContext }} {{- with .Values.containerSecurityContext }}
securityContext: {{ toYaml . | nindent 12 }} securityContext:
{{- toYaml . | nindent 12 }}
{{- end }} {{- end }}
env: env:
- name: HOST_IP - name: HOST_IP
{{- if .Values.service.listenOnAllInterfaces }} {{- if .Values.service.listenOnAllInterfaces }}
value: 0.0.0.0 value: 0.0.0.0
{{- else }} {{- else }}
valueFrom: valueFrom:
fieldRef: fieldRef:
apiVersion: v1 apiVersion: v1
fieldPath: status.hostIP fieldPath: status.hostIP
{{- end }}
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }} {{- end }}
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
ports: ports:
- name: {{ .Values.service.portName }} - name: {{ .Values.service.portName }}
containerPort: {{ .Values.service.port }} containerPort: {{ .Values.service.port }}
@ -98,8 +105,10 @@ spec:
periodSeconds: {{ .Values.readinessProbe.periodSeconds }} periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }} successThreshold: {{ .Values.readinessProbe.successThreshold }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
{{- with .Values.resources }}
resources: resources:
{{ toYaml .Values.resources | indent 12 }} {{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts: volumeMounts:
- name: proc - name: proc
mountPath: /host/proc mountPath: /host/proc
@ -115,37 +124,29 @@ spec:
{{- end }} {{- end }}
readOnly: true readOnly: true
{{- end }} {{- end }}
{{- if .Values.extraHostVolumeMounts }}
{{- range $_, $mount := .Values.extraHostVolumeMounts }} {{- range $_, $mount := .Values.extraHostVolumeMounts }}
- name: {{ $mount.name }} - name: {{ $mount.name }}
mountPath: {{ $mount.mountPath }} mountPath: {{ $mount.mountPath }}
readOnly: {{ $mount.readOnly }} readOnly: {{ $mount.readOnly }}
{{- if $mount.mountPropagation }} {{- with $mount.mountPropagation }}
mountPropagation: {{ $mount.mountPropagation }} mountPropagation: {{ . }}
{{- end }}
{{- end }} {{- end }}
{{- end }}
{{- end }}
{{- if .Values.sidecarVolumeMount }}
{{- range $_, $mount := .Values.sidecarVolumeMount }} {{- range $_, $mount := .Values.sidecarVolumeMount }}
- name: {{ $mount.name }} - name: {{ $mount.name }}
mountPath: {{ $mount.mountPath }} mountPath: {{ $mount.mountPath }}
readOnly: true readOnly: true
{{- end }} {{- end }}
{{- end }}
{{- if .Values.configmaps }}
{{- range $_, $mount := .Values.configmaps }} {{- range $_, $mount := .Values.configmaps }}
- name: {{ $mount.name }} - name: {{ $mount.name }}
mountPath: {{ $mount.mountPath }} mountPath: {{ $mount.mountPath }}
{{- end }} {{- end }}
{{- if .Values.secrets }}
{{- range $_, $mount := .Values.secrets }} {{- range $_, $mount := .Values.secrets }}
- name: {{ .name }} - name: {{ .name }}
mountPath: {{ .mountPath }} mountPath: {{ .mountPath }}
{{- end }} {{- end }}
{{- end }} {{- with .Values.sidecars }}
{{- end }} {{- toYaml . | nindent 8 }}
{{- if .Values.sidecars }}
{{ toYaml .Values.sidecars | indent 8 }}
{{- if or .Values.sidecarVolumeMount .Values.sidecarHostVolumeMounts }} {{- if or .Values.sidecarVolumeMount .Values.sidecarHostVolumeMounts }}
volumeMounts: volumeMounts:
{{- range $_, $mount := .Values.sidecarVolumeMount }} {{- range $_, $mount := .Values.sidecarVolumeMount }}
@ -162,29 +163,29 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.imagePullSecrets }} {{- with .Values.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }} {{ toYaml . | nindent 8 }}
{{- end }} {{- end }}
hostNetwork: {{ .Values.hostNetwork }} hostNetwork: {{ .Values.hostNetwork }}
hostPID: {{ .Values.hostPID }} hostPID: {{ .Values.hostPID }}
{{- if .Values.affinity }} {{- with .Values.affinity }}
affinity: affinity:
{{ toYaml .Values.affinity | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.dnsConfig }} {{- with .Values.dnsConfig }}
dnsConfig: dnsConfig:
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.tolerations }} {{- with .Values.tolerations }}
tolerations: tolerations:
{{ toYaml . | indent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
volumes: volumes:
- name: proc - name: proc
hostPath: hostPath:
@ -197,38 +198,28 @@ spec:
hostPath: hostPath:
path: / path: /
{{- end }} {{- end }}
{{- if .Values.extraHostVolumeMounts }}
{{- range $_, $mount := .Values.extraHostVolumeMounts }} {{- range $_, $mount := .Values.extraHostVolumeMounts }}
- name: {{ $mount.name }} - name: {{ $mount.name }}
hostPath: hostPath:
path: {{ $mount.hostPath }} path: {{ $mount.hostPath }}
{{- end }} {{- end }}
{{- end }}
{{- if .Values.sidecarVolumeMount }}
{{- range $_, $mount := .Values.sidecarVolumeMount }} {{- range $_, $mount := .Values.sidecarVolumeMount }}
- name: {{ $mount.name }} - name: {{ $mount.name }}
emptyDir: emptyDir:
medium: Memory medium: Memory
{{- end }} {{- end }}
{{- end }}
{{- if .Values.sidecarHostVolumeMounts }}
{{- range $_, $mount := .Values.sidecarHostVolumeMounts }} {{- range $_, $mount := .Values.sidecarHostVolumeMounts }}
- name: {{ $mount.name }} - name: {{ $mount.name }}
hostPath: hostPath:
path: {{ $mount.hostPath }} path: {{ $mount.hostPath }}
{{- end }} {{- end }}
{{- end }}
{{- if .Values.configmaps }}
{{- range $_, $mount := .Values.configmaps }} {{- range $_, $mount := .Values.configmaps }}
- name: {{ $mount.name }} - name: {{ $mount.name }}
configMap: configMap:
name: {{ $mount.name }} name: {{ $mount.name }}
{{- end }} {{- end }}
{{- end }}
{{- if .Values.secrets }}
{{- range $_, $mount := .Values.secrets }} {{- range $_, $mount := .Values.secrets }}
- name: {{ $mount.name }} - name: {{ $mount.name }}
secret: secret:
secretName: {{ $mount.name }} secretName: {{ $mount.name }}
{{- end }} {{- end }}
{{- end }}

View File

@ -2,9 +2,10 @@
apiVersion: v1 apiVersion: v1
kind: Endpoints kind: Endpoints
metadata: metadata:
name: {{ template "prometheus-node-exporter.fullname" . }} name: {{ include "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }} namespace: {{ include "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }} labels:
{{- include "prometheus-node-exporter.labels" . | nindent 4 }}
subsets: subsets:
- addresses: - addresses:
{{- range .Values.endpoints }} {{- range .Values.endpoints }}

View File

@ -1,15 +1,14 @@
{{- if .Values.rbac.create }} {{- if and .Values.rbac.create .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
{{- if .Values.rbac.pspEnabled }}
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: psp-{{ template "prometheus-node-exporter.fullname" . }} name: psp-{{ include "prometheus-node-exporter.fullname" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }} labels:
{{- include "prometheus-node-exporter.labels" . | nindent 4 }}
rules: rules:
- apiGroups: ['extensions'] - apiGroups: ['extensions']
resources: ['podsecuritypolicies'] resources: ['podsecuritypolicies']
verbs: ['use'] verbs: ['use']
resourceNames: resourceNames:
- {{ template "prometheus-node-exporter.fullname" . }} - {{ include "prometheus-node-exporter.fullname" . }}
{{- end }}
{{- end }} {{- end }}

View File

@ -1,17 +1,16 @@
{{- if .Values.rbac.create }} {{- if and .Values.rbac.create .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
{{- if .Values.rbac.pspEnabled }}
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
metadata: metadata:
name: psp-{{ template "prometheus-node-exporter.fullname" . }} name: psp-{{ include "prometheus-node-exporter.fullname" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }} labels:
{{- include "prometheus-node-exporter.labels" . | nindent 4 }}
roleRef: roleRef:
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
kind: ClusterRole kind: ClusterRole
name: psp-{{ template "prometheus-node-exporter.fullname" . }} name: psp-{{ include "prometheus-node-exporter.fullname" . }}
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: {{ template "prometheus-node-exporter.fullname" . }} name: {{ include "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }} namespace: {{ include "prometheus-node-exporter.namespace" . }}
{{- end }}
{{- end }} {{- end }}

View File

@ -1,15 +1,15 @@
{{- if .Values.rbac.create }} {{- if and .Values.rbac.create .Values.rbac.pspEnabled (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
{{- if .Values.rbac.pspEnabled }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodSecurityPolicy kind: PodSecurityPolicy
metadata: metadata:
name: {{ template "prometheus-node-exporter.fullname" . }} name: {{ include "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }} namespace: {{ include "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }} labels:
{{- if .Values.rbac.pspAnnotations }} {{- include "prometheus-node-exporter.labels" . | nindent 4 }}
{{- with .Values.rbac.pspAnnotations }}
annotations: annotations:
{{ toYaml .Values.rbac.pspAnnotations | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end}} {{- end }}
spec: spec:
privileged: false privileged: false
# Allow core volume types. # Allow core volume types.
@ -47,4 +47,3 @@ spec:
max: 65535 max: 65535
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
{{- end }} {{- end }}
{{- end }}

View File

@ -1,22 +1,23 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "prometheus-node-exporter.fullname" . }} name: {{ include "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }} namespace: {{ include "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }} labels:
{{- if .Values.service.annotations }} {{- include "prometheus-node-exporter.labels" $ | nindent 4 }}
{{- with .Values.service.annotations }}
annotations: annotations:
{{ toYaml .Values.service.annotations | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}
ports: ports:
- port: {{ .Values.service.port }} - port: {{ .Values.service.port }}
{{- if ( and (eq .Values.service.type "NodePort" ) (not (empty .Values.service.nodePort)) ) }} {{- if ( and (eq .Values.service.type "NodePort" ) (not (empty .Values.service.nodePort)) ) }}
nodePort: {{ .Values.service.nodePort }} nodePort: {{ .Values.service.nodePort }}
{{- end }} {{- end }}
targetPort: {{ .Values.service.targetPort }} targetPort: {{ .Values.service.targetPort }}
protocol: TCP protocol: TCP
name: {{ .Values.service.portName }} name: {{ .Values.service.portName }}
selector: selector:
{{- include "prometheus-node-exporter.selectorLabels" . | indent 4 }} {{- include "prometheus-node-exporter.selectorLabels" . | nindent 4 }}

View File

@ -1,14 +1,17 @@
{{- if .Values.rbac.create -}} {{- if and .Values.rbac.create .Values.serviceAccount.create -}}
{{- if .Values.serviceAccount.create -}}
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: {{ template "prometheus-node-exporter.serviceAccountName" . }} name: {{ include "prometheus-node-exporter.serviceAccountName" . }}
namespace: {{ template "prometheus-node-exporter.namespace" . }} namespace: {{ include "prometheus-node-exporter.namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }} labels:
{{- include "prometheus-node-exporter.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations: annotations:
{{ toYaml .Values.serviceAccount.annotations | indent 4 }} {{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
{{ toYaml .Values.serviceAccount.imagePullSecrets | indent 2 }} {{- toYaml . | nindent 2 }}
{{- end -}} {{- end }}
{{- end -}} {{- end -}}

View File

@ -2,50 +2,52 @@
apiVersion: {{ .Values.prometheus.monitor.apiVersion | default "monitoring.coreos.com/v1" }} apiVersion: {{ .Values.prometheus.monitor.apiVersion | default "monitoring.coreos.com/v1" }}
kind: ServiceMonitor kind: ServiceMonitor
metadata: metadata:
name: {{ template "prometheus-node-exporter.fullname" . }} name: {{ include "prometheus-node-exporter.fullname" . }}
namespace: {{ template "prometheus-node-exporter.monitor-namespace" . }} namespace: {{ include "prometheus-node-exporter.monitor-namespace" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }} labels:
{{- if .Values.prometheus.monitor.additionalLabels }} {{- include "prometheus-node-exporter.labels" . | nindent 4 }}
{{- toYaml .Values.prometheus.monitor.additionalLabels | nindent 4 }} {{- with .Values.prometheus.monitor.additionalLabels }}
{{- end }} {{- toYaml . | nindent 4 }}
{{- end }}
spec: spec:
jobLabel: {{ default "app.kubernetes.io/name" .Values.prometheus.monitor.jobLabel }} jobLabel: {{ default "app.kubernetes.io/name" .Values.prometheus.monitor.jobLabel }}
{{- include "servicemonitor.scrapeLimits" .Values.prometheus.monitor | nindent 2 }}
selector: selector:
matchLabels: matchLabels:
{{- if .Values.prometheus.monitor.selectorOverride }} {{- with .Values.prometheus.monitor.selectorOverride }}
{{ toYaml .Values.prometheus.monitor.selectorOverride | indent 6 }} {{- toYaml . | nindent 6 }}
{{ else }} {{- else }}
{{ include "prometheus-node-exporter.selectorLabels" . | indent 6 }} {{- include "prometheus-node-exporter.selectorLabels" . | nindent 6 }}
{{- end }} {{- end }}
endpoints: endpoints:
- port: {{ .Values.service.portName }} - port: {{ .Values.service.portName }}
scheme: {{ .Values.prometheus.monitor.scheme }} scheme: {{ .Values.prometheus.monitor.scheme }}
{{- with .Values.prometheus.monitor.basicAuth }} {{- with .Values.prometheus.monitor.basicAuth }}
basicAuth: basicAuth:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.prometheus.monitor.bearerTokenFile }} {{- with .Values.prometheus.monitor.bearerTokenFile }}
bearerTokenFile: {{ . }} bearerTokenFile: {{ . }}
{{- end }} {{- end }}
{{- with .Values.prometheus.monitor.tlsConfig }} {{- with .Values.prometheus.monitor.tlsConfig }}
tlsConfig: tlsConfig:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.prometheus.monitor.proxyUrl }} {{- with .Values.prometheus.monitor.proxyUrl }}
proxyUrl: {{ . }} proxyUrl: {{ . }}
{{- end }} {{- end }}
{{- with .Values.prometheus.monitor.interval }} {{- with .Values.prometheus.monitor.interval }}
interval: {{ . }} interval: {{ . }}
{{- end }} {{- end }}
{{- with .Values.prometheus.monitor.scrapeTimeout }} {{- with .Values.prometheus.monitor.scrapeTimeout }}
scrapeTimeout: {{ . }} scrapeTimeout: {{ . }}
{{- end }} {{- end }}
{{- with .Values.prometheus.monitor.relabelings }} {{- with .Values.prometheus.monitor.relabelings }}
relabelings: relabelings:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.prometheus.monitor.metricRelabelings }} {{- with .Values.prometheus.monitor.metricRelabelings }}
metricRelabelings: metricRelabelings:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -0,0 +1,34 @@
{{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1") (.Values.verticalPodAutoscaler.enabled) }}
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: {{ include "prometheus-node-exporter.fullname" . }}
namespace: {{ include "prometheus-node-exporter.namespace" . }}
labels:
{{- include "prometheus-node-exporter.labels" . | nindent 4 }}
spec:
resourcePolicy:
containerPolicies:
- containerName: {{ include "prometheus-node-exporter.name" . }}
{{- with .Values.verticalPodAutoscaler.controlledResources }}
controlledResources: {{ . }}
{{- end }}
{{- with .Values.verticalPodAutoscaler.maxAllowed }}
maxAllowed:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.verticalPodAutoscaler.minAllowed }}
minAllowed:
{{- toYaml . | nindent 8 }}
{{- end }}
targetRef:
apiVersion: apps/v1
kind: DaemonSet
name: {{ include "prometheus-node-exporter.fullname" . }}
{{- if .Values.verticalPodAutoscaler.updatePolicy }}
updatePolicy:
{{- with .Values.verticalPodAutoscaler.updatePolicy.updateMode }}
updateMode: {{ . }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -54,6 +54,26 @@ prometheus:
## prometheus.monitor.apiVersion ApiVersion for the serviceMonitor Resource(defaults to "monitoring.coreos.com/v1") ## prometheus.monitor.apiVersion ApiVersion for the serviceMonitor Resource(defaults to "monitoring.coreos.com/v1")
apiVersion: "" apiVersion: ""
## SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
##
sampleLimit: 0
## TargetLimit defines a limit on the number of scraped targets that will be accepted.
##
targetLimit: 0
## Per-scrape limit on number of labels that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.
##
labelLimit: 0
## Per-scrape limit on length of labels name that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.
##
labelNameLengthLimit: 0
## Per-scrape limit on length of labels value that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer.
##
labelValueLengthLimit: 0
## Customize the updateStrategy if set ## Customize the updateStrategy if set
updateStrategy: updateStrategy:
type: RollingUpdate type: RollingUpdate
@ -142,6 +162,9 @@ podAnnotations:
# Extra labels to be added to node exporter pods # Extra labels to be added to node exporter pods
podLabels: {} podLabels: {}
# Annotations to be added to node exporter daemonset
daemonsetAnnotations: {}
## set to true to add the release label so scraping of the servicemonitor with kube-prometheus-stack works out of the box ## set to true to add the release label so scraping of the servicemonitor with kube-prometheus-stack works out of the box
releaseLabel: false releaseLabel: false
@ -246,3 +269,23 @@ readinessProbe:
periodSeconds: 10 periodSeconds: 10
successThreshold: 1 successThreshold: 1
timeoutSeconds: 1 timeoutSeconds: 1
# Enable vertical pod autoscaler support for prometheus-node-exporter
verticalPodAutoscaler:
enabled: false
# List of resources that the vertical pod autoscaler can control. Defaults to cpu and memory
controlledResources: []
# Define the max allowed resources for the pod
maxAllowed: {}
# cpu: 200m
# memory: 100Mi
# Define the min allowed resources for the pod
minAllowed: {}
# cpu: 200m
# memory: 100Mi
# updatePolicy:
# Specifies whether recommended updates are applied when a Pod is started and whether recommended updates
# are applied during the life of a Pod. Possible values are "Off", "Initial", "Recreate", and "Auto".
# updateMode: Auto

View File

@ -38,6 +38,11 @@ The longest name that gets created adds and extra 37 characters, so truncation s
{{- end }} {{- end }}
{{- end }} {{- end }}
{{/* Prometheus apiVersion for networkpolicy */}}
{{- define "kube-prometheus-stack.prometheus.networkPolicy.apiVersion" -}}
{{- print "networking.k8s.io/v1" -}}
{{- end }}
{{/* Alertmanager custom resource instance name */}} {{/* Alertmanager custom resource instance name */}}
{{- define "kube-prometheus-stack.alertmanager.crname" -}} {{- define "kube-prometheus-stack.alertmanager.crname" -}}
{{- if .Values.cleanPrometheusOperatorObjectNames }} {{- if .Values.cleanPrometheusOperatorObjectNames }}

View File

@ -13,14 +13,15 @@ metadata:
{{- end }} {{- end }}
spec: spec:
{{- if .Values.alertmanager.alertmanagerSpec.image }} {{- if .Values.alertmanager.alertmanagerSpec.image }}
{{- $registry := .Values.global.imageRegistry | default .Values.alertmanager.alertmanagerSpec.image.registry -}}
{{- if and .Values.alertmanager.alertmanagerSpec.image.tag .Values.alertmanager.alertmanagerSpec.image.sha }} {{- if and .Values.alertmanager.alertmanagerSpec.image.tag .Values.alertmanager.alertmanagerSpec.image.sha }}
image: "{{ .Values.alertmanager.alertmanagerSpec.image.repository }}:{{ .Values.alertmanager.alertmanagerSpec.image.tag }}@sha256:{{ .Values.alertmanager.alertmanagerSpec.image.sha }}" image: "{{ $registry }}/{{ .Values.alertmanager.alertmanagerSpec.image.repository }}:{{ .Values.alertmanager.alertmanagerSpec.image.tag }}@sha256:{{ .Values.alertmanager.alertmanagerSpec.image.sha }}"
{{- else if .Values.alertmanager.alertmanagerSpec.image.sha }} {{- else if .Values.alertmanager.alertmanagerSpec.image.sha }}
image: "{{ .Values.alertmanager.alertmanagerSpec.image.repository }}@sha256:{{ .Values.alertmanager.alertmanagerSpec.image.sha }}" image: "{{ $registry }}/{{ .Values.alertmanager.alertmanagerSpec.image.repository }}@sha256:{{ .Values.alertmanager.alertmanagerSpec.image.sha }}"
{{- else if .Values.alertmanager.alertmanagerSpec.image.tag }} {{- else if .Values.alertmanager.alertmanagerSpec.image.tag }}
image: "{{ .Values.alertmanager.alertmanagerSpec.image.repository }}:{{ .Values.alertmanager.alertmanagerSpec.image.tag }}" image: "{{ $registry }}/{{ .Values.alertmanager.alertmanagerSpec.image.repository }}:{{ .Values.alertmanager.alertmanagerSpec.image.tag }}"
{{- else }} {{- else }}
image: "{{ .Values.alertmanager.alertmanagerSpec.image.repository }}" image: "{{ $registry }}/{{ .Values.alertmanager.alertmanagerSpec.image.repository }}"
{{- end }} {{- end }}
version: {{ .Values.alertmanager.alertmanagerSpec.image.tag }} version: {{ .Values.alertmanager.alertmanagerSpec.image.tag }}
{{- if .Values.alertmanager.alertmanagerSpec.image.sha }} {{- if .Values.alertmanager.alertmanagerSpec.image.sha }}

View File

@ -18,6 +18,7 @@ spec:
- {{ printf "%s" (include "kube-prometheus-stack.namespace" .) | quote }} - {{ printf "%s" (include "kube-prometheus-stack.namespace" .) | quote }}
endpoints: endpoints:
- port: {{ .Values.alertmanager.alertmanagerSpec.portName }} - port: {{ .Values.alertmanager.alertmanagerSpec.portName }}
enableHttp2: {{ .Values.alertmanager.serviceMonitor.enableHttp2 }}
{{- if .Values.alertmanager.serviceMonitor.interval }} {{- if .Values.alertmanager.serviceMonitor.interval }}
interval: {{ .Values.alertmanager.serviceMonitor.interval }} interval: {{ .Values.alertmanager.serviceMonitor.interval }}
{{- end }} {{- end }}
@ -27,9 +28,6 @@ spec:
{{- if .Values.alertmanager.serviceMonitor.scheme }} {{- if .Values.alertmanager.serviceMonitor.scheme }}
scheme: {{ .Values.alertmanager.serviceMonitor.scheme }} scheme: {{ .Values.alertmanager.serviceMonitor.scheme }}
{{- end }} {{- end }}
{{- if .Values.alertmanager.serviceMonitor.enableHttp2 }}
enableHttp2: {{ .Values.alertmanager.serviceMonitor.enableHttp2 }}
{{- end }}
{{- if .Values.alertmanager.serviceMonitor.bearerTokenFile }} {{- if .Values.alertmanager.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ .Values.alertmanager.serviceMonitor.bearerTokenFile }} bearerTokenFile: {{ .Values.alertmanager.serviceMonitor.bearerTokenFile }}
{{- end }} {{- end }}

View File

@ -0,0 +1,614 @@
{{- /*
Generated from 'alertmanager-overview' from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/grafana-dashboardDefinitions.yaml
Do not change in-place! In order to change this file first read following link:
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack
*/ -}}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if and (or .Values.grafana.enabled .Values.grafana.forceDeployDashboards) (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.grafana.defaultDashboardsEnabled }}
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ template "kube-prometheus-stack-grafana.namespace" . }}
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" $) "alertmanager-overview" | trunc 63 | trimSuffix "-" }}
annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: {{ ternary $.Values.grafana.sidecar.dashboards.labelValue "1" (not (empty $.Values.grafana.sidecar.dashboards.labelValue)) | quote }}
{{- end }}
app: {{ template "kube-prometheus-stack.name" $ }}-grafana
{{ include "kube-prometheus-stack.labels" $ | indent 4 }}
data:
alertmanager-overview.json: |-
{
"__inputs": [
],
"__requires": [
],
"annotations": {
"list": [
]
},
"editable": false,
"gnetId": null,
"graphTooltip": 1,
"hideControls": false,
"id": null,
"links": [
],
"refresh": "30s",
"rows": [
{
"collapse": false,
"collapsed": false,
"panels": [
{
"aliasColors": {
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"description": "current set of alerts stored in the Alertmanager",
"fill": 1,
"fillGradient": 0,
"gridPos": {
},
"id": 2,
"legend": {
"alignAsTable": false,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": false,
"show": false,
"sideWidth": null,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [
],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"repeat": null,
"seriesOverrides": [
],
"spaceLength": 10,
"span": 6,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "sum(alertmanager_alerts{namespace=~\"$namespace\",service=~\"$service\"}) by (namespace,service,instance)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{`{{`}}instance{{`}}`}}",
"refId": "A"
}
],
"thresholds": [
],
"timeFrom": null,
"timeShift": null,
"title": "Alerts",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": [
]
},
"yaxes": [
{
"format": "none",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "none",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"description": "rate of successful and invalid alerts received by the Alertmanager",
"fill": 1,
"fillGradient": 0,
"gridPos": {
},
"id": 3,
"legend": {
"alignAsTable": false,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": false,
"show": false,
"sideWidth": null,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [
],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"repeat": null,
"seriesOverrides": [
],
"spaceLength": 10,
"span": 6,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "sum(rate(alertmanager_alerts_received_total{namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval])) by (namespace,service,instance)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{`{{`}}instance{{`}}`}} Received",
"refId": "A"
},
{
"expr": "sum(rate(alertmanager_alerts_invalid_total{namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval])) by (namespace,service,instance)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{`{{`}}instance{{`}}`}} Invalid",
"refId": "B"
}
],
"thresholds": [
],
"timeFrom": null,
"timeShift": null,
"title": "Alerts receive rate",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": [
]
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": true,
"title": "Alerts",
"titleSize": "h6",
"type": "row"
},
{
"collapse": false,
"collapsed": false,
"panels": [
{
"aliasColors": {
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"description": "rate of successful and invalid notifications sent by the Alertmanager",
"fill": 1,
"fillGradient": 0,
"gridPos": {
},
"id": 4,
"legend": {
"alignAsTable": false,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": false,
"show": false,
"sideWidth": null,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [
],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"repeat": "integration",
"seriesOverrides": [
],
"spaceLength": 10,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "sum(rate(alertmanager_notifications_total{namespace=~\"$namespace\",service=~\"$service\", integration=\"$integration\"}[$__rate_interval])) by (integration,namespace,service,instance)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{`{{`}}instance{{`}}`}} Total",
"refId": "A"
},
{
"expr": "sum(rate(alertmanager_notifications_failed_total{namespace=~\"$namespace\",service=~\"$service\", integration=\"$integration\"}[$__rate_interval])) by (integration,namespace,service,instance)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{`{{`}}instance{{`}}`}} Failed",
"refId": "B"
}
],
"thresholds": [
],
"timeFrom": null,
"timeShift": null,
"title": "$integration: Notifications Send Rate",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": [
]
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"description": "latency of notifications sent by the Alertmanager",
"fill": 1,
"fillGradient": 0,
"gridPos": {
},
"id": 5,
"legend": {
"alignAsTable": false,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": false,
"show": false,
"sideWidth": null,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [
],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"repeat": "integration",
"seriesOverrides": [
],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "histogram_quantile(0.99,\n sum(rate(alertmanager_notification_latency_seconds_bucket{namespace=~\"$namespace\",service=~\"$service\", integration=\"$integration\"}[$__rate_interval])) by (le,namespace,service,instance)\n) \n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{`{{`}}instance{{`}}`}} 99th Percentile",
"refId": "A"
},
{
"expr": "histogram_quantile(0.50,\n sum(rate(alertmanager_notification_latency_seconds_bucket{namespace=~\"$namespace\",service=~\"$service\", integration=\"$integration\"}[$__rate_interval])) by (le,namespace,service,instance)\n) \n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{`{{`}}instance{{`}}`}} Median",
"refId": "B"
},
{
"expr": "sum(rate(alertmanager_notification_latency_seconds_sum{namespace=~\"$namespace\",service=~\"$service\", integration=\"$integration\"}[$__rate_interval])) by (namespace,service,instance)\n/\nsum(rate(alertmanager_notification_latency_seconds_count{namespace=~\"$namespace\",service=~\"$service\", integration=\"$integration\"}[$__rate_interval])) by (namespace,service,instance)\n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{`{{`}}instance{{`}}`}} Average",
"refId": "C"
}
],
"thresholds": [
],
"timeFrom": null,
"timeShift": null,
"title": "$integration: Notification Duration",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": [
]
},
"yaxes": [
{
"format": "s",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "s",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": true,
"title": "Notifications",
"titleSize": "h6",
"type": "row"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [
"alertmanager-mixin"
],
"templating": {
"list": [
{
"current": {
"text": "Prometheus",
"value": "Prometheus"
},
"hide": 0,
"label": "Data Source",
"name": "datasource",
"options": [
],
"query": "prometheus",
"refresh": 1,
"regex": "",
"type": "datasource"
},
{
"allValue": null,
"current": {
"text": "",
"value": ""
},
"datasource": "$datasource",
"hide": 0,
"includeAll": false,
"label": "namespace",
"multi": false,
"name": "namespace",
"options": [
],
"query": "label_values(alertmanager_alerts, namespace)",
"refresh": 2,
"regex": "",
"sort": 1,
"tagValuesQuery": "",
"tags": [
],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
"text": "",
"value": ""
},
"datasource": "$datasource",
"hide": 0,
"includeAll": false,
"label": "service",
"multi": false,
"name": "service",
"options": [
],
"query": "label_values(alertmanager_alerts, service)",
"refresh": 2,
"regex": "",
"sort": 1,
"tagValuesQuery": "",
"tags": [
],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
"text": "all",
"value": "$__all"
},
"datasource": "$datasource",
"hide": 2,
"includeAll": true,
"label": null,
"multi": false,
"name": "integration",
"options": [
],
"query": "label_values(alertmanager_notifications_total{integration=~\".*\"}, integration)",
"refresh": 2,
"regex": "",
"sort": 1,
"tagValuesQuery": "",
"tags": [
],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "{{ .Values.grafana.defaultDashboardsTimezone }}",
"title": "Alertmanager / Overview",
"uid": "alertmanager-overview",
"version": 0
}
{{- end }}

View File

@ -0,0 +1,636 @@
{{- /*
Generated from 'grafana-overview' from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/grafana-dashboardDefinitions.yaml
Do not change in-place! In order to change this file first read following link:
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack
*/ -}}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if and (or .Values.grafana.enabled .Values.grafana.forceDeployDashboards) (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.grafana.defaultDashboardsEnabled }}
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ template "kube-prometheus-stack-grafana.namespace" . }}
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" $) "grafana-overview" | trunc 63 | trimSuffix "-" }}
annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: {{ ternary $.Values.grafana.sidecar.dashboards.labelValue "1" (not (empty $.Values.grafana.sidecar.dashboards.labelValue)) | quote }}
{{- end }}
app: {{ template "kube-prometheus-stack.name" $ }}-grafana
{{ include "kube-prometheus-stack.labels" $ | indent 4 }}
data:
grafana-overview.json: |-
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [
],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 3085,
"iteration": 1631554945276,
"links": [
],
"panels": [
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"mappings": [
],
"noValue": "0",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
]
},
"gridPos": {
"h": 5,
"w": 6,
"x": 0,
"y": 0
},
"id": 6,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"text": {
},
"textMode": "auto"
},
"pluginVersion": "8.1.3",
"targets": [
{
"expr": "grafana_alerting_result_total{job=~\"$job\", instance=~\"$instance\", state=\"alerting\"}",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Firing Alerts",
"type": "stat"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"mappings": [
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
]
},
"gridPos": {
"h": 5,
"w": 6,
"x": 6,
"y": 0
},
"id": 8,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"text": {
},
"textMode": "auto"
},
"pluginVersion": "8.1.3",
"targets": [
{
"expr": "sum(grafana_stat_totals_dashboard{job=~\"$job\", instance=~\"$instance\"})",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Dashboards",
"type": "stat"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"custom": {
"align": null,
"displayMode": "auto"
},
"mappings": [
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
]
},
"gridPos": {
"h": 5,
"w": 12,
"x": 12,
"y": 0
},
"id": 10,
"options": {
"showHeader": true
},
"pluginVersion": "8.1.3",
"targets": [
{
"expr": "grafana_build_info{job=~\"$job\", instance=~\"$instance\"}",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Build Info",
"transformations": [
{
"id": "labelsToFields",
"options": {
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Value": true,
"branch": true,
"container": true,
"goversion": true,
"namespace": true,
"pod": true,
"revision": true
},
"indexByName": {
"Time": 7,
"Value": 11,
"branch": 4,
"container": 8,
"edition": 2,
"goversion": 6,
"instance": 1,
"job": 0,
"namespace": 9,
"pod": 10,
"revision": 5,
"version": 3
},
"renameByName": {
}
}
}
],
"type": "table"
},
{
"aliasColors": {
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"links": [
]
},
"overrides": [
]
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 5
},
"hiddenSeries": false,
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.3",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [
],
"spaceLength": 10,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "sum by (status_code) (irate(grafana_http_request_duration_seconds_count{job=~\"$job\", instance=~\"$instance\"}[1m])) ",
"interval": "",
"legendFormat": "{{`{{`}}status_code{{`}}`}}",
"refId": "A"
}
],
"thresholds": [
],
"timeFrom": null,
"timeRegions": [
],
"timeShift": null,
"title": "RPS",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": [
]
},
"yaxes": [
{
"$$hashKey": "object:157",
"format": "reqps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:158",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": false
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"links": [
]
},
"overrides": [
]
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 5
},
"hiddenSeries": false,
"id": 4,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.1.3",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [
],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "histogram_quantile(0.99, sum(irate(grafana_http_request_duration_seconds_bucket{instance=~\"$instance\", job=~\"$job\"}[$__rate_interval])) by (le)) * 1",
"interval": "",
"legendFormat": "99th Percentile",
"refId": "A"
},
{
"exemplar": true,
"expr": "histogram_quantile(0.50, sum(irate(grafana_http_request_duration_seconds_bucket{instance=~\"$instance\", job=~\"$job\"}[$__rate_interval])) by (le)) * 1",
"interval": "",
"legendFormat": "50th Percentile",
"refId": "B"
},
{
"exemplar": true,
"expr": "sum(irate(grafana_http_request_duration_seconds_sum{instance=~\"$instance\", job=~\"$job\"}[$__rate_interval])) * 1 / sum(irate(grafana_http_request_duration_seconds_count{instance=~\"$instance\", job=~\"$job\"}[$__rate_interval]))",
"interval": "",
"legendFormat": "Average",
"refId": "C"
}
],
"thresholds": [
],
"timeFrom": null,
"timeRegions": [
],
"timeShift": null,
"title": "Request Latency",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": [
]
},
"yaxes": [
{
"$$hashKey": "object:210",
"format": "ms",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:211",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"schemaVersion": 30,
"style": "dark",
"tags": [
],
"templating": {
"list": [
{
"current": {
"selected": true,
"text": "dev-cortex",
"value": "dev-cortex"
},
"description": null,
"error": null,
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "datasource",
"options": [
],
"query": "prometheus",
"queryValue": "",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
},
{
"allValue": ".*",
"current": {
"selected": false,
"text": [
"default/grafana"
],
"value": [
"default/grafana"
]
},
"datasource": "$datasource",
"definition": "label_values(grafana_build_info, job)",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "job",
"options": [
],
"query": {
"query": "label_values(grafana_build_info, job)",
"refId": "Billing Admin-job-Variable-Query"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": ".*",
"current": {
"selected": false,
"text": "All",
"value": "$__all"
},
"datasource": "$datasource",
"definition": "label_values(grafana_build_info, instance)",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "instance",
"options": [
],
"query": {
"query": "label_values(grafana_build_info, instance)",
"refId": "Billing Admin-instance-Variable-Query"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "{{ .Values.grafana.defaultDashboardsTimezone }}",
"title": "Grafana Overview",
"uid": "6be0s85Mk",
"version": 2
}
{{- end }}

View File

@ -0,0 +1,587 @@
{{- /*
Generated from 'persistentvolumesusage' from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/grafana-dashboardDefinitions.yaml
Do not change in-place! In order to change this file first read following link:
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack
*/ -}}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if and (or .Values.grafana.enabled .Values.grafana.forceDeployDashboards) (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.grafana.defaultDashboardsEnabled }}
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ template "kube-prometheus-stack-grafana.namespace" . }}
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" $) "persistentvolumesusage" | trunc 63 | trimSuffix "-" }}
annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
labels:
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: {{ ternary $.Values.grafana.sidecar.dashboards.labelValue "1" (not (empty $.Values.grafana.sidecar.dashboards.labelValue)) | quote }}
{{- end }}
app: {{ template "kube-prometheus-stack.name" $ }}-grafana
{{ include "kube-prometheus-stack.labels" $ | indent 4 }}
data:
persistentvolumesusage.json: |-
{
"__inputs": [
],
"__requires": [
],
"annotations": {
"list": [
]
},
"editable": false,
"gnetId": null,
"graphTooltip": 0,
"hideControls": false,
"id": null,
"links": [
],
"refresh": "10s",
"rows": [
{
"collapse": false,
"collapsed": false,
"panels": [
{
"aliasColors": {
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fill": 1,
"fillGradient": 0,
"gridPos": {
},
"id": 2,
"interval": "1m",
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [
],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"repeat": null,
"seriesOverrides": [
],
"spaceLength": 10,
"span": 9,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "(\n sum without(instance, node) (topk(1, (kubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})))\n -\n sum without(instance, node) (topk(1, (kubelet_volume_stats_available_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})))\n)\n",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "Used Space",
"refId": "A"
},
{
"expr": "sum without(instance, node) (topk(1, (kubelet_volume_stats_available_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})))\n",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "Free Space",
"refId": "B"
}
],
"thresholds": [
],
"timeFrom": null,
"timeShift": null,
"title": "Volume Space Usage",
"tooltip": {
"shared": false,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": [
]
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": 0,
"show": true
},
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": 0,
"show": true
}
]
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "$datasource",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
},
"id": 3,
"interval": "1m",
"legend": {
"alignAsTable": true,
"rightSide": true
},
"links": [
],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "max without(instance,node) (\n(\n topk(1, kubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n -\n topk(1, kubelet_volume_stats_available_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n)\n/\ntopk(1, kubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n* 100)\n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"thresholds": "80, 90",
"title": "Volume Space Usage",
"tooltip": {
"shared": false
},
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6",
"type": "row"
},
{
"collapse": false,
"collapsed": false,
"panels": [
{
"aliasColors": {
},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fill": 1,
"fillGradient": 0,
"gridPos": {
},
"id": 4,
"interval": "1m",
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"sideWidth": null,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [
],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"repeat": null,
"seriesOverrides": [
],
"spaceLength": 10,
"span": 9,
"stack": true,
"steppedLine": false,
"targets": [
{
"expr": "sum without(instance, node) (topk(1, (kubelet_volume_stats_inodes_used{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})))\n",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "Used inodes",
"refId": "A"
},
{
"expr": "(\n sum without(instance, node) (topk(1, (kubelet_volume_stats_inodes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})))\n -\n sum without(instance, node) (topk(1, (kubelet_volume_stats_inodes_used{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})))\n)\n",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": " Free inodes",
"refId": "B"
}
],
"thresholds": [
],
"timeFrom": null,
"timeShift": null,
"title": "Volume inodes Usage",
"tooltip": {
"shared": false,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": [
]
},
"yaxes": [
{
"format": "none",
"label": null,
"logBase": 1,
"max": null,
"min": 0,
"show": true
},
{
"format": "none",
"label": null,
"logBase": 1,
"max": null,
"min": 0,
"show": true
}
]
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"datasource": "$datasource",
"format": "percent",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": true,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
},
"id": 5,
"interval": "1m",
"legend": {
"alignAsTable": true,
"rightSide": true
},
"links": [
],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 3,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"tableColumn": "",
"targets": [
{
"expr": "max without(instance,node) (\ntopk(1, kubelet_volume_stats_inodes_used{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n/\ntopk(1, kubelet_volume_stats_inodes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n* 100)\n",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"refId": "A"
}
],
"thresholds": "80, 90",
"title": "Volume inodes Usage",
"tooltip": {
"shared": false
},
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dashboard Row",
"titleSize": "h6",
"type": "row"
}
],
"schemaVersion": 14,
"style": "dark",
"tags": [
"kubernetes-mixin"
],
"templating": {
"list": [
{
"current": {
"text": "default",
"value": "default"
},
"hide": 0,
"label": "Data Source",
"name": "datasource",
"options": [
],
"query": "prometheus",
"refresh": 1,
"regex": "",
"type": "datasource"
},
{
"allValue": null,
"current": {
},
"datasource": "$datasource",
"hide": {{ if .Values.grafana.sidecar.dashboards.multicluster.global.enabled }}0{{ else }}2{{ end }},
"includeAll": false,
"label": "cluster",
"multi": false,
"name": "cluster",
"options": [
],
"query": "label_values(kubelet_volume_stats_capacity_bytes{job=\"kubelet\", metrics_path=\"/metrics\"}, cluster)",
"refresh": 2,
"regex": "",
"sort": 1,
"tagValuesQuery": "",
"tags": [
],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
},
"datasource": "$datasource",
"hide": 0,
"includeAll": false,
"label": "Namespace",
"multi": false,
"name": "namespace",
"options": [
],
"query": "label_values(kubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\"}, namespace)",
"refresh": 2,
"regex": "",
"sort": 1,
"tagValuesQuery": "",
"tags": [
],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {
},
"datasource": "$datasource",
"hide": 0,
"includeAll": false,
"label": "PersistentVolumeClaim",
"multi": false,
"name": "volume",
"options": [
],
"query": "label_values(kubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\"}, persistentvolumeclaim)",
"refresh": 2,
"regex": "",
"sort": 1,
"tagValuesQuery": "",
"tags": [
],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-7d",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "{{ .Values.grafana.defaultDashboardsTimezone }}",
"title": "Kubernetes / Persistent Volumes",
"uid": "919b92a8e8041bd567af9edab12c840c",
"version": 0
}
{{- end }}

View File

@ -18,7 +18,7 @@ rules:
verbs: verbs:
- get - get
- update - update
{{- if .Values.global.rbac.pspEnabled }} {{- if and (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") .Values.global.rbac.pspEnabled }}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if semverCompare "> 1.15.0-0" $kubeTargetVersion }} {{- if semverCompare "> 1.15.0-0" $kubeTargetVersion }}
- apiGroups: ['policy'] - apiGroups: ['policy']

View File

@ -34,10 +34,11 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: create - name: create
{{- $registry := .Values.global.imageRegistry | default .Values.prometheusOperator.admissionWebhooks.patch.image.registry -}}
{{- if .Values.prometheusOperator.admissionWebhooks.patch.image.sha }} {{- if .Values.prometheusOperator.admissionWebhooks.patch.image.sha }}
image: {{ .Values.prometheusOperator.admissionWebhooks.patch.image.repository }}:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.tag }}@sha256:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.sha }} image: {{ $registry }}/{{ .Values.prometheusOperator.admissionWebhooks.patch.image.repository }}:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.tag }}@sha256:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.sha }}
{{- else }} {{- else }}
image: {{ .Values.prometheusOperator.admissionWebhooks.patch.image.repository }}:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.tag }} image: {{ $registry }}/{{ .Values.prometheusOperator.admissionWebhooks.patch.image.repository }}:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.tag }}
{{- end }} {{- end }}
imagePullPolicy: {{ .Values.prometheusOperator.admissionWebhooks.patch.image.pullPolicy }} imagePullPolicy: {{ .Values.prometheusOperator.admissionWebhooks.patch.image.pullPolicy }}
args: args:

View File

@ -34,10 +34,11 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: patch - name: patch
{{- $registry := .Values.global.imageRegistry | default .Values.prometheusOperator.admissionWebhooks.patch.image.registry -}}
{{- if .Values.prometheusOperator.admissionWebhooks.patch.image.sha }} {{- if .Values.prometheusOperator.admissionWebhooks.patch.image.sha }}
image: {{ .Values.prometheusOperator.admissionWebhooks.patch.image.repository }}:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.tag }}@sha256:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.sha }} image: {{ $registry }}/{{ .Values.prometheusOperator.admissionWebhooks.patch.image.repository }}:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.tag }}@sha256:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.sha }}
{{- else }} {{- else }}
image: {{ .Values.prometheusOperator.admissionWebhooks.patch.image.repository }}:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.tag }} image: {{ $registry }}/{{ .Values.prometheusOperator.admissionWebhooks.patch.image.repository }}:{{ .Values.prometheusOperator.admissionWebhooks.patch.image.tag }}
{{- end }} {{- end }}
imagePullPolicy: {{ .Values.prometheusOperator.admissionWebhooks.patch.image.pullPolicy }} imagePullPolicy: {{ .Values.prometheusOperator.admissionWebhooks.patch.image.pullPolicy }}
args: args:

View File

@ -0,0 +1,29 @@
{{- if .Values.prometheusOperator.networkPolicy.enabled }}
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.admissionWebhooks.enabled .Values.prometheusOperator.admissionWebhooks.patch.enabled (not .Values.prometheusOperator.admissionWebhooks.certManager.enabled) }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ template "kube-prometheus-stack.fullname" . }}-admission-create
namespace: {{ template "kube-prometheus-stack.namespace" . }}
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
## Ensure this is run before the job
"helm.sh/hook-weight": "-5"
{{- with .Values.prometheusOperator.admissionWebhooks.annotations }}
{{ toYaml . | indent 4 }}
{{- end }}
labels:
app: {{ template "kube-prometheus-stack.name" $ }}-admission-create
{{- include "kube-prometheus-stack.labels" $ | indent 4 }}
spec:
podSelector:
matchLabels:
app: {{ template "kube-prometheus-stack.name" $ }}-admission-create
{{- include "kube-prometheus-stack.labels" $ | indent 6 }}
egress:
- {}
policyTypes:
- Egress
{{- end }}
{{- end }}

View File

@ -0,0 +1,29 @@
{{- if .Values.prometheusOperator.networkPolicy.enabled }}
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.admissionWebhooks.enabled .Values.prometheusOperator.admissionWebhooks.patch.enabled (not .Values.prometheusOperator.admissionWebhooks.certManager.enabled) }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ template "kube-prometheus-stack.fullname" . }}-admission-patch
namespace: {{ template "kube-prometheus-stack.namespace" . }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
## Ensure this is run before the job
"helm.sh/hook-weight": "-5"
{{- with .Values.prometheusOperator.admissionWebhooks.patch.annotations }}
{{ toYaml . | indent 4 }}
{{- end }}
labels:
app: {{ template "kube-prometheus-stack.name" $ }}-admission-patch
{{- include "kube-prometheus-stack.labels" $ | indent 4 }}
spec:
podSelector:
matchLabels:
app: {{ template "kube-prometheus-stack.name" $ }}-admission-patch
{{- include "kube-prometheus-stack.labels" $ | indent 6 }}
egress:
- {}
policyTypes:
- Egress
{{- end }}
{{- end }}

View File

@ -1,4 +1,4 @@
{{- if and .Values.prometheusOperator.enabled .Values.prometheusOperator.admissionWebhooks.enabled .Values.prometheusOperator.admissionWebhooks.patch.enabled .Values.global.rbac.create .Values.global.rbac.pspEnabled (not .Values.prometheusOperator.admissionWebhooks.certManager.enabled) }} {{- if and (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") .Values.prometheusOperator.enabled .Values.prometheusOperator.admissionWebhooks.enabled .Values.prometheusOperator.admissionWebhooks.patch.enabled .Values.global.rbac.create .Values.global.rbac.pspEnabled (not .Values.prometheusOperator.admissionWebhooks.certManager.enabled) }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodSecurityPolicy kind: PodSecurityPolicy
metadata: metadata:

View File

@ -36,6 +36,7 @@ webhooks:
{{- if and .Values.prometheusOperator.admissionWebhooks.caBundle (not .Values.prometheusOperator.admissionWebhooks.patch.enabled) (not .Values.prometheusOperator.admissionWebhooks.certManager.enabled) }} {{- if and .Values.prometheusOperator.admissionWebhooks.caBundle (not .Values.prometheusOperator.admissionWebhooks.patch.enabled) (not .Values.prometheusOperator.admissionWebhooks.certManager.enabled) }}
caBundle: {{ .Values.prometheusOperator.admissionWebhooks.caBundle }} caBundle: {{ .Values.prometheusOperator.admissionWebhooks.caBundle }}
{{- end }} {{- end }}
timeoutSeconds: {{ .Values.prometheusOperator.admissionWebhooks.timeoutSeconds }}
admissionReviewVersions: ["v1", "v1beta1"] admissionReviewVersions: ["v1", "v1beta1"]
sideEffects: None sideEffects: None
{{- end }} {{- end }}

View File

@ -40,10 +40,11 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: {{ template "kube-prometheus-stack.name" . }} - name: {{ template "kube-prometheus-stack.name" . }}
{{- $registry := .Values.global.imageRegistry | default .Values.prometheusOperator.image.registry -}}
{{- if .Values.prometheusOperator.image.sha }} {{- if .Values.prometheusOperator.image.sha }}
image: "{{ .Values.prometheusOperator.image.repository }}:{{ .Values.prometheusOperator.image.tag }}@sha256:{{ .Values.prometheusOperator.image.sha }}" image: "{{ $registry }}/{{ .Values.prometheusOperator.image.repository }}:{{ .Values.prometheusOperator.image.tag }}@sha256:{{ .Values.prometheusOperator.image.sha }}"
{{- else }} {{- else }}
image: "{{ .Values.prometheusOperator.image.repository }}:{{ .Values.prometheusOperator.image.tag }}" image: "{{ $registry }}/{{ .Values.prometheusOperator.image.repository }}:{{ .Values.prometheusOperator.image.tag }}"
{{- end }} {{- end }}
imagePullPolicy: "{{ .Values.prometheusOperator.image.pullPolicy }}" imagePullPolicy: "{{ .Values.prometheusOperator.image.pullPolicy }}"
args: args:
@ -73,15 +74,15 @@ spec:
{{- end }} {{- end }}
- --localhost=127.0.0.1 - --localhost=127.0.0.1
{{- if .Values.prometheusOperator.prometheusDefaultBaseImage }} {{- if .Values.prometheusOperator.prometheusDefaultBaseImage }}
- --prometheus-default-base-image={{ .Values.prometheusOperator.prometheusDefaultBaseImage }} - --prometheus-default-base-image={{ .Values.global.imageRegistry | default .Values.prometheusOperator.prometheusDefaultBaseImageRegistry }}/{{ .Values.prometheusOperator.prometheusDefaultBaseImage }}
{{- end }} {{- end }}
{{- if .Values.prometheusOperator.alertmanagerDefaultBaseImage }} {{- if .Values.prometheusOperator.alertmanagerDefaultBaseImage }}
- --alertmanager-default-base-image={{ .Values.prometheusOperator.alertmanagerDefaultBaseImage }} - --alertmanager-default-base-image={{ .Values.global.imageRegistry | default .Values.prometheusOperator.alertmanagerDefaultBaseImageRegistry }}/{{ .Values.prometheusOperator.alertmanagerDefaultBaseImage }}
{{- end }} {{- end }}
{{- if .Values.prometheusOperator.prometheusConfigReloader.image.sha }} {{- if .Values.prometheusOperator.prometheusConfigReloader.image.sha }}
- --prometheus-config-reloader={{ .Values.prometheusOperator.prometheusConfigReloader.image.repository }}:{{ .Values.prometheusOperator.prometheusConfigReloader.image.tag }}@sha256:{{ .Values.prometheusOperator.prometheusConfigReloader.image.sha }} - --prometheus-config-reloader={{ $registry }}/{{ .Values.prometheusOperator.prometheusConfigReloader.image.repository }}:{{ .Values.prometheusOperator.prometheusConfigReloader.image.tag }}@sha256:{{ .Values.prometheusOperator.prometheusConfigReloader.image.sha }}
{{- else }} {{- else }}
- --prometheus-config-reloader={{ .Values.prometheusOperator.prometheusConfigReloader.image.repository }}:{{ .Values.prometheusOperator.prometheusConfigReloader.image.tag }} - --prometheus-config-reloader={{ $registry }}/{{ .Values.prometheusOperator.prometheusConfigReloader.image.repository }}:{{ .Values.prometheusOperator.prometheusConfigReloader.image.tag }}
{{- end }} {{- end }}
- --config-reloader-cpu-request={{ .Values.prometheusOperator.prometheusConfigReloader.resources.requests.cpu }} - --config-reloader-cpu-request={{ .Values.prometheusOperator.prometheusConfigReloader.resources.requests.cpu }}
- --config-reloader-cpu-limit={{ .Values.prometheusOperator.prometheusConfigReloader.resources.limits.cpu }} - --config-reloader-cpu-limit={{ .Values.prometheusOperator.prometheusConfigReloader.resources.limits.cpu }}
@ -97,9 +98,9 @@ spec:
- --prometheus-instance-namespaces={{ .Values.prometheusOperator.prometheusInstanceNamespaces | join "," }} - --prometheus-instance-namespaces={{ .Values.prometheusOperator.prometheusInstanceNamespaces | join "," }}
{{- end }} {{- end }}
{{- if .Values.prometheusOperator.thanosImage.sha }} {{- if .Values.prometheusOperator.thanosImage.sha }}
- --thanos-default-base-image={{ .Values.prometheusOperator.thanosImage.repository }}:{{ .Values.prometheusOperator.thanosImage.tag }}@sha256:{{ .Values.prometheusOperator.thanosImage.sha }} - --thanos-default-base-image={{ $registry }}/{{ .Values.prometheusOperator.thanosImage.repository }}:{{ .Values.prometheusOperator.thanosImage.tag }}@sha256:{{ .Values.prometheusOperator.thanosImage.sha }}
{{- else }} {{- else }}
- --thanos-default-base-image={{ .Values.prometheusOperator.thanosImage.repository }}:{{ .Values.prometheusOperator.thanosImage.tag }} - --thanos-default-base-image={{ $registry }}/{{ .Values.prometheusOperator.thanosImage.repository }}:{{ .Values.prometheusOperator.thanosImage.tag }}
{{- end }} {{- end }}
{{- if .Values.prometheusOperator.thanosRulerInstanceNamespaces }} {{- if .Values.prometheusOperator.thanosRulerInstanceNamespaces }}
- --thanos-ruler-instance-namespaces={{ .Values.prometheusOperator.thanosRulerInstanceNamespaces | join "," }} - --thanos-ruler-instance-namespaces={{ .Values.prometheusOperator.thanosRulerInstanceNamespaces | join "," }}

Some files were not shown because too many files have changed in this diff Show More