[bitnami/prometheus-operator] Standarise prometheus operator persistence (#2254)

* [bitnami/prometheus-operator] Standarise persistence

Signed-off-by: Miguel A. Cabrera Minagorri <macabrera@bitnami.com>

* Modify kubeval options to support CRDs

* Delete accidental file

* [bitnami/prometheus-operator] Update components versions

Signed-off-by: Bitnami Containers <containers@bitnami.com>

Co-authored-by: Bitnami Containers <containers@bitnami.com>
This commit is contained in:
Miguel Ángel Cabrera Miñagorri
2020-04-08 14:00:50 +02:00
committed by GitHub
co-authored by Bitnami Containers
parent 771131bad9
commit 9be7f2eb88
9 changed files with 275 additions and 77 deletions
+9 -9
View File
@@ -2,18 +2,18 @@ apiVersion: v1
appVersion: 0.38.0
description: The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetes services and deployment and management of Prometheus instances.
name: prometheus-operator
version: 0.14.0
version: 0.15.0
keywords:
- prometheus
- alertmanager
- operator
- monitoring
- prometheus
- alertmanager
- operator
- monitoring
home: https://github.com/coreos/prometheus-operator/
icon: https://bitnami.com/assets/stacks/prometheus-operator/img/prometheus-operator-stack-220x234.png
sources:
- https://github.com/bitnami/bitnami-docker-prometheus-operator
- https://github.com/coreos/prometheus-operator/
- https://github.com/bitnami/bitnami-docker-prometheus-operator
- https://github.com/coreos/prometheus-operator/
maintainers:
- name: Bitnami
email: containers@bitnami.com
- name: Bitnami
email: containers@bitnami.com
engine: gotpl
+8
View File
@@ -209,6 +209,10 @@ The following table lists the configurable parameters of the Prometheus Operator
| `prometheus.remoteRead` | The remote_read spec configuration for Prometheus | `[]` |
| `prometheus.remoteWrite` | The remote_write spec configuration for Prometheus | `[]` |
| `prometheus.storageSpec` | Prometheus StorageSpec for persistent data | `{}` |
| `prometheus.persistence.enabled` | Use PVCs to persist data. If the storageSpec is provided this will not take effect. | `false` |
| `prometheus.persistence.storageClass` | Persistent Volume Storage Class | `generic` |
| `prometheus.persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` |
| `prometheus.persistence.size` | Persistent Volume Size | `8Gi` |
| `prometheus.priorityClassName` | Priority class assigned to the Pods | `` |
| `prometheus.containers` | Containers allows injecting additional containers | `[]` |
| `prometheus.additionalScrapeConfigsExternal` | Enable additional scrape configs that are managed externally to this chart | `false` See [docs](#additional-scrape-configurations) for details. |
@@ -279,6 +283,10 @@ The following table lists the configurable parameters of the Prometheus Operator
| `alertmanager.configMaps` | ConfigMaps that should be mounted into the Alertmanager Pods | `[]` |
| `alertmanager.retention` | Metrics retention days | `10d` |
| `alertmanager.storageSpec` | Alertmanager StorageSpec for persistent data | `{}` |
| `alertmanager.persistence.enabled` | Use PVCs to persist data. If the storageSpec is provided this will not take effect. | `false` |
| `alertmanager.persistence.storageClass` | Persistent Volume Storage Class | `generic` |
| `alertmanager.persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` |
| `alertmanager.persistence.size` | Persistent Volume Size | `8Gi` |
| `alertmanager.paused` | If true, the Operator won't process any Alertmanager configuration changes | `false` |
| `alertmanager.listenLocal` | ListenLocal makes the Alertmanager server listen on loopback | `false` |
| `alertmanager.containers` | Containers allows injecting additional containers | `[]` |
@@ -1,9 +1,9 @@
dependencies:
- name: node-exporter
repository: https://charts.bitnami.com/bitnami
version: 0.2.8
version: 0.2.10
- name: kube-state-metrics
repository: https://charts.bitnami.com/bitnami
version: 0.1.18
digest: sha256:71738d51f5ea724bb0a84265ab333e9df255963473d6325eaf9d574758d39874
generated: "2020-04-02T12:40:10.242621894Z"
digest: sha256:585fe8c5a1c2a4c279fb51ecb8558a7c50aae149722d3c1f1bd3ab005358c6e7
generated: "2020-04-08T11:12:42.704677542Z"
@@ -412,6 +412,76 @@ Return the appropriate apiVersion for PodSecurityPolicy.
{{- end -}}
{{- end -}}
{{/*
Return the proper Storage Class for Prometheus
*/}}
{{- define "prometheus-operator.prometheus.storageClass" -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
*/}}
{{- if .Values.global -}}
{{- if .Values.global.storageClass -}}
{{- if (eq "-" .Values.global.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.global.storageClass -}}
{{- end -}}
{{- else -}}
{{- if .Values.prometheus.persistence.storageClass -}}
{{- if (eq "-" .Values.prometheus.persistence.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.prometheus.persistence.storageClass -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- if .Values.prometheus.persistence.storageClass -}}
{{- if (eq "-" .Values.prometheus.persistence.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.prometheus.persistence.storageClass -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Return the proper Storage Class for alertmanager
*/}}
{{- define "prometheus-operator.alertmanager.storageClass" -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
*/}}
{{- if .Values.global -}}
{{- if .Values.global.storageClass -}}
{{- if (eq "-" .Values.global.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.global.storageClass -}}
{{- end -}}
{{- else -}}
{{- if .Values.alertmanager.persistence.storageClass -}}
{{- if (eq "-" .Values.alertmanager.persistence.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.alertmanager.persistence.storageClass -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- if .Values.alertmanager.persistence.storageClass -}}
{{- if (eq "-" .Values.alertmanager.persistence.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.alertmanager.persistence.storageClass -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Check if there are rolling tags in the images
*/}}
@@ -35,6 +35,20 @@ spec:
{{- end }}
{{- if .Values.alertmanager.storageSpec }}
storage: {{- include "prometheus-operator.tplValue" (dict "value" .Values.alertmanager.storageSpec "context" $) | nindent 4 }}
{{- else }}
{{- if .Values.alertmanager.persistence.enabled }}
storage:
volumeClaimTemplate:
spec:
accessModes:
{{- range .Values.alertmanager.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.alertmanager.persistence.size | quote }}
{{- include "prometheus-operator.alertmanager.storageClass" . }}
{{- end }}
{{- end }}
{{- if .Values.alertmanager.podMetadata }}
podMetadata: {{- include "prometheus-operator.tplValue" (dict "value" .Values.alertmanager.podMetadata "context" $) | nindent 4 }}
@@ -102,6 +102,20 @@ spec:
{{- end }}
{{- if .Values.prometheus.storageSpec }}
storage: {{- include "prometheus-operator.tplValue" (dict "value" .Values.prometheus.storageSpec "context" $) | nindent 4 }}
{{- else }}
{{- if .Values.prometheus.persistence.enabled }}
storage:
volumeClaimTemplate:
spec:
accessModes:
{{- range .Values.prometheus.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.prometheus.persistence.size | quote }}
{{- include "prometheus-operator.prometheus.storageClass" . }}
{{- end }}
{{- end }}
{{- if .Values.prometheus.podMetadata }}
podMetadata: {{- include "prometheus-operator.tplValue" (dict "value" .Values.prometheus.podMetadata "context" $) | nindent 4 }}
@@ -3,13 +3,13 @@
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
##
global:
# imageRegistry: myRegistryName
# imagePullSecrets:
# - myRegistryKeySecretName
# storageClass: myStorageClass
# imageRegistry: myRegistryName
# imagePullSecrets:
# - myRegistryKeySecretName
# storageClass: myStorageClass
labels: {}
# foo: bar
# foo: bar
## String to partially override prometheus.fullname template (will maintain the release name)
##
@@ -42,7 +42,7 @@ operator:
image:
registry: docker.io
repository: bitnami/prometheus-operator
tag: 0.38.0-debian-10-r16
tag: 0.38.0-debian-10-r22
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
@@ -208,7 +208,7 @@ operator:
image:
registry: docker.io
repository: bitnami/configmap-reload
tag: 0.3.0-debian-10-r64
tag: 0.3.0-debian-10-r70
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
@@ -218,15 +218,15 @@ operator:
prometheusConfigReloader:
image: {}
# registry:
# repository:
# tag:
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistryKeySecretName
# registry:
# repository:
# tag:
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistryKeySecretName
## Deploy a Prometheus instance
##
@@ -239,7 +239,7 @@ prometheus:
image:
registry: docker.io
repository: bitnami/prometheus
tag: 2.17.1-debian-10-r6
tag: 2.17.1-debian-10-r12
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
@@ -344,8 +344,8 @@ prometheus:
## The list of hostnames to be covered with this ingress record.
## Most likely this will be just one host, but in the event more hosts are needed, this is an array
hosts:
- name: prometheus.local
path: /
- name: prometheus.local
path: /
## The tls configuration for the ingress
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
@@ -353,6 +353,7 @@ prometheus:
## - hosts:
## - prometheus.local
## secretName: prometheus.local-tls
tls: {}
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
@@ -453,8 +454,8 @@ prometheus:
## If {}, select all ServiceMonitors
##
serviceMonitorSelector: {}
# matchLabels:
# foo: bar
# matchLabels:
# foo: bar
## Namespaces to be selected for ServiceMonitor discovery.
## See https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#namespaceselector for usage
@@ -474,7 +475,7 @@ prometheus:
## ref: https://prometheus.io/docs/prometheus/latest/storage/#compaction
##
disableCompaction: false
## Enable compression of the write-ahead log using Snappy.
##
walCompression: false
@@ -520,6 +521,28 @@ prometheus:
##
storageSpec: {}
## Prometheus persistence parameters
##
persistence:
## The storageSpec takes precedence before this persistence configuration.
## If you want to use this configuration make sure the storageSpec is not provided.
##
enabled: false
## Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner.
##
# storageClass: "-"
## Persistent Volume Access Mode
##
accessModes:
- ReadWriteOnce
## Persistent Volume Claim size
##
size: 8Gi
## Priority class assigned to the Pods
##
priorityClassName: ""
@@ -544,7 +567,7 @@ prometheus:
image:
registry: docker.io
repository: bitnami/thanos
tag: 0.11.0-scratch-r9
tag: 0.11.0-scratch-r14
## Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
@@ -602,7 +625,7 @@ alertmanager:
image:
registry: docker.io
repository: bitnami/alertmanager
tag: 0.20.0-debian-10-r64
tag: 0.20.0-debian-10-r70
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
@@ -709,8 +732,8 @@ alertmanager:
## The list of hostnames to be covered with this ingress record.
## Most likely this will be just one host, but in the event more hosts are needed, this is an array
hosts:
- name: alertmanager.local
path: /
- name: alertmanager.local
path: /
## The tls configuration for the ingress
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
@@ -718,6 +741,7 @@ alertmanager:
## - hosts:
## - alertmanager.local
## secretName: alertmanager.local-tls
tls: {}
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
@@ -762,11 +786,11 @@ alertmanager:
repeat_interval: 12h
receiver: 'null'
routes:
- match:
alertname: Watchdog
receiver: 'null'
- match:
alertname: Watchdog
receiver: 'null'
receivers:
- name: 'null'
- name: 'null'
## Desired number of Alertmanager nodes
##
@@ -780,7 +804,7 @@ alertmanager:
##
logFormat: logfmt
## Standard objects metadata.
## Standard objects metadata.
## ref: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
##
podMetadata: {}
@@ -802,6 +826,28 @@ alertmanager:
##
storageSpec: {}
## Alertmanager persistence parameters
##
persistence:
## The storageSpec takes precedence before this persistence configuration.
## If you want to use this configuration make sure the storageSpec is not provided.
##
enabled: false
## Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner.
##
# storageClass: "-"
## Persistent Volume Access Mode
##
accessModes:
- ReadWriteOnce
## Persistent Volume Claim size
##
size: 8Gi
## If true, the Operator won't process any Alertmanager configuration changes
##
paused: false
+78 -32
View File
@@ -3,13 +3,13 @@
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
##
global:
# imageRegistry: myRegistryName
# imagePullSecrets:
# - myRegistryKeySecretName
# storageClass: myStorageClass
# imageRegistry: myRegistryName
# imagePullSecrets:
# - myRegistryKeySecretName
# storageClass: myStorageClass
labels: {}
# foo: bar
# foo: bar
## String to partially override prometheus.fullname template (will maintain the release name)
##
@@ -42,7 +42,7 @@ operator:
image:
registry: docker.io
repository: bitnami/prometheus-operator
tag: 0.38.0-debian-10-r16
tag: 0.38.0-debian-10-r22
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
@@ -208,7 +208,7 @@ operator:
image:
registry: docker.io
repository: bitnami/configmap-reload
tag: 0.3.0-debian-10-r64
tag: 0.3.0-debian-10-r70
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
@@ -218,15 +218,15 @@ operator:
prometheusConfigReloader:
image: {}
# registry:
# repository:
# tag:
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistryKeySecretName
# registry:
# repository:
# tag:
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistryKeySecretName
## Deploy a Prometheus instance
##
@@ -239,7 +239,7 @@ prometheus:
image:
registry: docker.io
repository: bitnami/prometheus
tag: 2.17.1-debian-10-r6
tag: 2.17.1-debian-10-r12
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
@@ -344,8 +344,8 @@ prometheus:
## The list of hostnames to be covered with this ingress record.
## Most likely this will be just one host, but in the event more hosts are needed, this is an array
hosts:
- name: prometheus.local
path: /
- name: prometheus.local
path: /
## The tls configuration for the ingress
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
@@ -353,6 +353,7 @@ prometheus:
## - hosts:
## - prometheus.local
## secretName: prometheus.local-tls
tls: {}
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
@@ -453,8 +454,8 @@ prometheus:
## If {}, select all ServiceMonitors
##
serviceMonitorSelector: {}
# matchLabels:
# foo: bar
# matchLabels:
# foo: bar
## Namespaces to be selected for ServiceMonitor discovery.
## See https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#namespaceselector for usage
@@ -520,6 +521,28 @@ prometheus:
##
storageSpec: {}
## Prometheus persistence parameters
##
persistence:
## The storageSpec takes precedence before this persistence configuration.
## If you want to use this configuration make sure the storageSpec is not provided.
##
enabled: false
## Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner.
##
# storageClass: "-"
## Persistent Volume Access Mode
##
accessModes:
- ReadWriteOnce
## Persistent Volume Claim size
##
size: 8Gi
## Priority class assigned to the Pods
##
priorityClassName: ""
@@ -544,7 +567,7 @@ prometheus:
image:
registry: docker.io
repository: bitnami/thanos
tag: 0.11.0-scratch-r9
tag: 0.11.0-scratch-r14
## Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
@@ -554,10 +577,10 @@ prometheus:
##
# pullSecrets:
# - myRegistryKeySecretName
## Extra arguments passed to thanos sidecar 'args' section
##
extraArgs: []
extraArgs: []
# - --log.level=debug
# - --tsdb.path=/data/
@@ -608,7 +631,7 @@ alertmanager:
image:
registry: docker.io
repository: bitnami/alertmanager
tag: 0.20.0-debian-10-r64
tag: 0.20.0-debian-10-r70
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
@@ -715,8 +738,8 @@ alertmanager:
## The list of hostnames to be covered with this ingress record.
## Most likely this will be just one host, but in the event more hosts are needed, this is an array
hosts:
- name: alertmanager.local
path: /
- name: alertmanager.local
path: /
## The tls configuration for the ingress
## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
@@ -724,6 +747,7 @@ alertmanager:
## - hosts:
## - alertmanager.local
## secretName: alertmanager.local-tls
tls: {}
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
@@ -768,11 +792,11 @@ alertmanager:
repeat_interval: 12h
receiver: 'null'
routes:
- match:
alertname: Watchdog
receiver: 'null'
- match:
alertname: Watchdog
receiver: 'null'
receivers:
- name: 'null'
- name: 'null'
## Desired number of Alertmanager nodes
##
@@ -786,7 +810,7 @@ alertmanager:
##
logFormat: logfmt
## Standard objects metadata.
## Standard objects metadata.
## ref: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
##
podMetadata: {}
@@ -808,6 +832,28 @@ alertmanager:
##
storageSpec: {}
## Alertmanager persistence parameters
##
persistence:
## The storageSpec takes precedence before this persistence configuration.
## If you want to use this configuration make sure the storageSpec is not provided.
##
enabled: false
## Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner.
##
# storageClass: "-"
## Persistent Volume Access Mode
##
accessModes:
- ReadWriteOnce
## Persistent Volume Claim size
##
size: 8Gi
## If true, the Operator won't process any Alertmanager configuration changes
##
paused: false
+2 -2
View File
@@ -31,9 +31,9 @@ run_kubeval_chart() {
cmd_output_file=$(mktemp)
read -r -a opt_array <<< "$options_str"
# printf '\033[0;34m- Running helm template --values %s %s | kubeval %s \033[0m\n' "$values_file_display" "$chart_name" "${options_str}"
if ! helm template --values "$values_file" "$chart_path" | kubeval "${opt_array[@]}" > "$cmd_output_file" 2>&1; then
if ! helm template --values "$values_file" "$chart_path" | kubeval --ignore-missing-schemas "${opt_array[@]}" > "$cmd_output_file" 2>&1; then
cat "$cmd_output_file"
printf '\033[0;31m\U0001F6AB helm template --values %s %s | kubeval %s failed.\033[0m\n' "$values_file_display" "$chart_name" "${options_str}"
printf '\033[0;31m\U0001F6AB helm template --values %s %s | kubeval --ignore-missing-schemas %s failed.\033[0m\n' "$values_file_display" "$chart_name" "${options_str}"
test_failed=1
fi
rm "$cmd_output_file"