Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

charts: add support for podmonitor #162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions charts/atlas-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ spec:
containers:
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.podMonitor.enabled }}
ports:
- name: metrics
containerPort: 8080
{{- end }}
livenessProbe:
httpGet:
path: /healthz
Expand Down
54 changes: 54 additions & 0 deletions charts/atlas-operator/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{{- if .Values.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
labels:
{{- include "atlas-operator.labels" . | nindent 4 }}
{{- with .Values.podMonitor.labels }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
name: {{ include "atlas-operator.fullname" . }}
namespace: {{ default .Release.Namespace .Values.podMonitor.namespace }}
spec:
podMetricsEndpoints:
- port: metrics
{{- with .Values.podMonitor.path }}
path: {{ . }}
{{- end }}
{{- with .Values.podMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.podMonitor.scheme }}
scheme: {{ . }}
{{- end }}
{{- with .Values.podMonitor.bearerTokenSecret }}
bearerTokenSecret: {{ . }}
{{- end }}
{{- with .Values.podMonitor.tlsConfig }}
tlsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
honorLabels: {{ .Values.podMonitor.honorLabels }}
{{- with .Values.podMonitor.metricRelabelings }}
metricRelabelings:
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with .Values.podMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podMonitor.podTargetLabels }}
podTargetLabels:
{{- toYaml . | nindent 4 }}
{{- end }}
jobLabel: {{ default "app.kubernetes.io/name" .Values.podMonitor.jobLabel }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "atlas-operator.selectorLabels" . | nindent 6 }}
{{- end }}
33 changes: 33 additions & 0 deletions charts/atlas-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,36 @@ extraVolumeMounts: []
# mountPath: /extra-volume
# readOnly: true

# -- PodMonitor defines monitoring for a set of pods.
# ref. https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.PodMonitor
podMonitor:
enabled: false
# Namespace in which to deploy the PodMonitor. Defaults to the release namespace.
namespace: ""
# Additional labels to be defined on a PodMonitor object, e.g. setting a label to match podMonitorSelector if one is used in Prometheus
labels: {}
# release: kube-prometheus-stack
# PodTargetLabels defines the labels which are transferred from the associated Kubernetes Pod object.
podTargetLabels: []
# The label to use to retrieve the job name from. Defaults to app.kubernetes.io/name.
jobLabel: ""

# HTTP scheme to use for scraping.
scheme: "http"
# HTTP path from which to scrape for metrics.
path: "/metrics"
# Secret to mount to read bearer token for scraping targets.
bearerTokenSecret: {}
# TLS configuration to use when scraping the target.
tlsConfig: {}
# Interval at which Prometheus scrapes the metrics from the target.
interval: ""
# Timeout after which Prometheus considers the scrape to be failed.
scrapeTimeout: ""
# When true, honorLabels preserves the metric’s labels when they collide with the target’s labels.
honorLabels: true

# relabelings configures the relabeling rules to apply the target’s metadata labels
relabelings: []
# metricRelabelings configures the relabeling rules to apply to the samples before ingestion.
metricRelabelings: []