commit f4bdb713c1e8e5640ae7263e6f9e6b9b839a4587 Author: Steven Fitzpatrick Date: Mon Sep 28 05:15:56 2020 +0000 Prometheus: Add configurable readiness/liveness Probes This change adds probes to the prometheus statefulset using the HTK probe generation functions Change-Id: I249d662dd0d23dd964f7118af94c733bbdc5db92 diff --git a/prometheus/Chart.yaml b/prometheus/Chart.yaml index f2e6e59..4906cde 100644 --- a/prometheus/Chart.yaml +++ b/prometheus/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v2.12.0 description: OpenStack-Helm Prometheus name: prometheus -version: 0.1.1 +version: 0.1.2 home: https://prometheus.io/ sources: - https://github.com/prometheus/prometheus diff --git a/prometheus/templates/statefulset.yaml b/prometheus/templates/statefulset.yaml index 52593f5..d6a8de9 100644 --- a/prometheus/templates/statefulset.yaml +++ b/prometheus/templates/statefulset.yaml @@ -12,6 +12,20 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "probeTemplate" }} +{{- $probePort := tuple "monitoring" "internal" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} +{{- $probeUser := .Values.endpoints.monitoring.auth.admin.username }} +{{- $probePass := .Values.endpoints.monitoring.auth.admin.password }} +{{- $authHeader := printf "%s:%s" $probeUser $probePass | b64enc }} +httpGet: + path: /status + port: {{ $probePort }} + httpHeaders: + - name: Authorization + value: Basic {{ $authHeader }} +{{- end }} + + {{- if .Values.manifests.statefulset_prometheus }} {{- $envAll := . }} @@ -171,12 +185,8 @@ spec: ports: - name: prom-metrics containerPort: {{ tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - readinessProbe: - httpGet: - path: /status - port: {{ tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - initialDelaySeconds: 30 - timeoutSeconds: 30 +{{ dict "envAll" . "component" "prometheus" "container" "prometheus" "type" "readiness" "probeTemplate" (include "probeTemplate" . | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} +{{ dict "envAll" . "component" "prometheus" "container" "prometheus" "type" "liveness" "probeTemplate" (include "probeTemplate" . | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }} env: {{- if .Values.pod.env.prometheus }} {{ include "helm-toolkit.utils.to_k8s_env_vars" .Values.pod.env.prometheus | indent 12 }} diff --git a/prometheus/values.yaml b/prometheus/values.yaml index 74c5c3b..ad8f5c8 100644 --- a/prometheus/values.yaml +++ b/prometheus/values.yaml @@ -110,7 +110,19 @@ pod: limits: memory: "1024Mi" cpu: "2000m" - + probes: + prometheus: + prometheus: + readiness: + enabled: true + params: + initialDelaySeconds: 30 + timeoutSeconds: 30 + liveness: + enabled: false + params: + initialDelaySeconds: 120 + timeoutSeconds: 30 endpoints: cluster_domain_suffix: cluster.local local_image_registry: