Prometheus: Add configurable readiness/liveness Probes

This change adds probes to the prometheus statefulset using the HTK
probe generation functions

Change-Id: I249d662dd0d23dd964f7118af94c733bbdc5db92
This commit is contained in:
Steven Fitzpatrick 2020-09-28 05:15:56 +00:00
parent f7ed96c701
commit f4bdb713c1
3 changed files with 30 additions and 8 deletions

View File

@ -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

View File

@ -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 }}

View File

@ -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: