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

chore: refactor promtail extraScrapeConfigs into scrapeConfigs #367

Merged
merged 6 commits into from
Apr 29, 2024
51 changes: 50 additions & 1 deletion src/promtail/values/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,49 @@ config:
- url: 'http://loki-gateway.loki.svc.cluster.local:80/loki/api/v1/push'

snippets:
extraScrapeConfigs: >
scrapeConfigs: |
# Upstream Defaults https://github.com/grafana/helm-charts/blob/main/charts/promtail/values.yaml
# See also https://github.com/grafana/loki/blob/master/production/ksonnet/promtail/scrape_config.libsonnet for reference
- job_name: kubernetes-pods
pipeline_stages:
{{- toYaml .Values.config.snippets.pipelineStages | nindent 4 }}
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels:
- __meta_kubernetes_pod_controller_name
regex: ([0-9a-z-.]+?)(-[0-9a-f]{8,10})?
action: replace
target_label: __tmp_controller_name
- source_labels:
- __meta_kubernetes_pod_label_app_kubernetes_io_name
- __meta_kubernetes_pod_label_app
- __tmp_controller_name
- __meta_kubernetes_pod_name
regex: ^;*([^;]+)(;.*)?$
action: replace
target_label: app
- source_labels:
- __meta_kubernetes_pod_label_app_kubernetes_io_instance
- __meta_kubernetes_pod_label_instance
regex: ^;*([^;]+)(;.*)?$
action: replace
target_label: instance
- source_labels:
- __meta_kubernetes_pod_label_app_kubernetes_io_component
- __meta_kubernetes_pod_label_component
regex: ^;*([^;]+)(;.*)?$
action: replace
target_label: component
{{- if .Values.config.snippets.addScrapeJobLabel }}
- replacement: kubernetes-pods
target_label: scrape_job
{{- end }}
{{- toYaml .Values.config.snippets.common | nindent 4 }}
{{- with .Values.config.snippets.extraRelabelConfigs }}
{{- toYaml . | nindent 4 }}
{{- end }}
# UDS CORE Defaults
- job_name: systemd-messages
static_configs:
- targets: [localhost]
Expand All @@ -21,6 +63,13 @@ config:
- source_labels:
- __journal_syslog_identifier
target_label: syslog_identifier
- job_name: kubernetes-logs
static_configs:
- targets: [localhost]
labels:
job: kubernetes-logs
host: "${NODE_HOSTNAME}"
__path__: /var/log/kubernetes/**/*.log

containerSecurityContext:
allowPrivilegeEscalation: false
Expand Down