|
18 | 18 | {{- $destinationConfigComponents := "" }} |
19 | 19 | {{- range $metricsDestinationName := $metricsDestinationNames }} |
20 | 20 | {{- $dest := include "destination.getDestinationByName" (deepCopy $ | merge (dict "destination" $metricsDestinationName )) | fromYaml }} |
21 | | - {{- if eq $dest.type "prometheus" -}} |
22 | | - {{- $defaultValues := "destinations/prometheus-values.yaml" | $.Files.Get | fromYaml }} |
23 | | - {{- $destWithDefaults := mergeOverwrite (deepCopy $defaultValues) $dest }} |
24 | | - {{- $destinationTarget := include "destinations.prometheus.alloy.otlp.metrics.target" $destWithDefaults }} |
25 | | - {{- $destinationTargets = append $destinationTargets (printf "%s" $destinationTarget) }} |
26 | | - {{- else }} |
27 | | - {{- $defaultValues := "destinations/otlp-values.yaml" | $.Files.Get | fromYaml }} |
28 | | - {{- $destWithDefaults := mergeOverwrite (deepCopy $defaultValues) $dest }} |
29 | | - {{- $destinationTarget := include "destinations.otlp.alloy.exporter.target" $destWithDefaults }} |
30 | | - {{- $destinationTargets = append $destinationTargets (printf "%s" $destinationTarget) }} |
31 | | - {{- end }} |
32 | 21 | {{- $destinationConfigComponents = cat $destinationConfigComponents (printf "\n\n// Destination: %s (%s)" $dest.name $dest.type) }} |
33 | | - {{- if eq (include "secrets.usesKubernetesSecret" $dest) "true" }} |
34 | | - {{- $destinationConfigComponents = cat $destinationConfigComponents (include "secret.alloy" (deepCopy $ | merge (dict "object" $dest)) | nindent 0) }} |
35 | | - {{- end }} |
36 | 22 | {{- if eq $dest.type "prometheus" -}} |
37 | 23 | {{- $defaultValues := "destinations/prometheus-values.yaml" | $.Files.Get | fromYaml }} |
38 | 24 | {{- $destWithDefaults := mergeOverwrite (deepCopy $defaultValues) $dest }} |
39 | 25 | {{- $destWithDefaults = set $destWithDefaults "extraLabelsFrom" (dict "collector_id" "env(\"POD_NAME\")") }} |
| 26 | + |
| 27 | + {{- $destinationTarget := include "destinations.prometheus.alloy.otlp.metrics.target" $destWithDefaults }} |
| 28 | + {{- $destinationTargets = append $destinationTargets (printf "%s" $destinationTarget) }} |
| 29 | + |
40 | 30 | {{- $destinationConfigComponents = cat $destinationConfigComponents ((include "destinations.prometheus.alloy" (deepCopy $ | merge (dict "destination" $destWithDefaults))) | trim | nindent 0) }} |
| 31 | + {{- if eq (include "secrets.usesKubernetesSecret" $destWithDefaults) "true" }} |
| 32 | + {{- $destinationConfigComponents = cat $destinationConfigComponents (include "secret.alloy" (deepCopy $ | merge (dict "object" $destWithDefaults)) | nindent 0) }} |
| 33 | + {{- end }} |
41 | 34 | {{- else -}} |
42 | 35 | {{- $defaultValues := "destinations/otlp-values.yaml" | $.Files.Get | fromYaml }} |
43 | 36 | {{- $destWithDefaults := mergeOverwrite (deepCopy $defaultValues) $dest }} |
| 37 | + |
| 38 | + {{- $destinationTarget := include "destinations.otlp.alloy.exporter.target" $destWithDefaults }} |
| 39 | + {{- $destinationTargets = append $destinationTargets (printf "%s" $destinationTarget) }} |
| 40 | + |
44 | 41 | {{- $destinationConfigComponents = cat $destinationConfigComponents ((include "destinations.otlp.alloy.exporter" $destWithDefaults) | trim | nindent 0) }} |
| 42 | + {{- if eq (include "secrets.usesKubernetesSecret" $destWithDefaults) "true" }} |
| 43 | + {{- $destinationConfigComponents = cat $destinationConfigComponents (include "secret.alloy" (deepCopy $ | merge (dict "object" $destWithDefaults)) | nindent 0) }} |
| 44 | + {{- end }} |
45 | 45 | {{- end }} |
46 | 46 | {{- end }} |
47 | 47 |
|
|
0 commit comments