{{/*
Create a default fully qualified app name.
*/}}
{{- define "probers.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "probers.labels" -}}
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Sanitize Kubernetes label keys for Prometheus (kube-state-metrics compatibility).
Replaces characters like '.', '/', and '-' with '_'.
Example: app.kubernetes.io/name -> app_kubernetes_io_name
*/}}
{{- define "probers.sanitizePrometheusLabel" -}}
{{- . | replace "." "_" | replace "/" "_" | replace "-" "_" -}}
{{- end -}}