UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit 53f6bdd7 authored by Ryan Garcia's avatar Ryan Garcia :dizzy:
Browse files

Merge branch '1310-adjust-vault-monitoring-to-utilize-additionalscrapeconfig' into 'master'

Resolve "Adjust Vault Monitoring to utilize AdditionalScrapeConfig rather than ServiceMonitor"

Closes #1310

See merge request platform-one/big-bang/bigbang!2106
parents c8b69db7 a6947fca
No related branches found
No related tags found
1 merge request!2106Resolve "Adjust Vault Monitoring to utilize AdditionalScrapeConfig rather than ServiceMonitor"
Pipeline #999644 passed with warnings
{{- if .Values.monitoring.enabled }}
{{- include "values-secret" (dict "root" $ "package" .Values.monitoring "name" "monitoring" "defaults" (include "bigbang.defaults.monitoring" .)) }}
{{- include "values-secret" (dict "root" $ "package" (dict "values" (fromYaml (include "bigbang.overlays.monitoring" .))) "name" "monitoring" "defaults" (include "bigbang.defaults.monitoring" .)) }}
{{- end }}
{{- define "bigbang.defaults.monitoring" -}}
......@@ -122,6 +122,24 @@ prometheus:
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.addons.vault.enabled }}
additionalScrapeConfigs:
- job_name: vault
metrics_path: /v1/sys/metrics
params:
format: ['prometheus']
scheme: https
authorization:
credentials_file: /vault/secrets/token
{{- $vaultHosts := (dig "istio" "vault" "hosts" dict .Values.addons.vault.values) }}
{{- if $vaultHosts }}
static_configs:
- targets: [{{ tpl ($vaultHosts | first) $ }}]
{{- else }}
static_configs:
- targets: [vault.{{ .Values.domain }}]
{{- end }}
{{- end }}
{{- if $istioInjection }}
# Add volume/mount for Istio certs for mTLS scraping
volumes:
......@@ -379,3 +397,27 @@ prometheusOperator:
{{ include "istioAnnotation" . }}
{{- end }}
{{- end }}
{{- /* This function merges defaults in lists from above into overlays */ -}}
{{- /* The end user will not have to replicate additionalScrapeConfigs from above when providing an overlay */ -}}
{{- /* There is a hidden flag `skipOverlayMerge` that can be added to any additionalScrapeConfigs to ignore the defaults */ -}}
{{- define "bigbang.overlays.monitoring" }}
{{- $defaults := fromYaml (include "bigbang.defaults.monitoring" .) }}
{{- $overlays := dig "values" dict .Values.monitoring }}
{{- range $prometheusConfig, $default := $defaults.prometheus }}
{{- $overlay := (dig "prometheus" $prometheusConfig dict $overlays) }}
# Only continue if an overlay matches a default constriant and hidden "skipOverlayMerge" is not set
{{- if and $overlay (not $overlay.skipOverlayMerge) }}
# Add any default additionalScrapeConfigs to overlay
{{- if and (dig "additionalScrapeConfigs" list $default) (dig "additionalScrapeConfigs" list $overlay) }}
{{ $_ := set $overlay "additionalScrapeConfigs" (concat $default.additionalScrapeConfigs $overlay.additionalScrapeConfigs) }}
{{- end }}
{{- end }}
{{- end }}
{{ toYaml $overlays }}
{{- end }}
......@@ -614,7 +614,7 @@ monitoring:
git:
repo: https://repo1.dso.mil/platform-one/big-bang/apps/core/monitoring.git
path: "./chart"
tag: "40.0.0-bb.0"
tag: "40.0.0-bb.1"
# -- Flux reconciliation overrides specifically for the Monitoring Package
flux:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment