Skip to content

Commit

Permalink
Prometheus: Add configurable readiness/liveness Probes
Browse files Browse the repository at this point in the history
This change adds probes to the prometheus statefulset using the HTK
probe generation functions

Change-Id: I249d662dd0d23dd964f7118af94c733bbdc5db92
  • Loading branch information
StevTheDev committed Oct 5, 2020
1 parent f7ed96c commit f4bdb71
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion prometheus/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 16 additions & 6 deletions prometheus/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 := . }}

Expand Down Expand Up @@ -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 }}
Expand Down
14 changes: 13 additions & 1 deletion prometheus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f4bdb71

Please sign in to comment.