Skip to content

Commit

Permalink
defaults and digs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaronoff97 committed May 3, 2024
1 parent d9a862b commit 6543884
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions charts/opentelemetry-kube-stack/templates/_config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ the config is written as YAML.
{{- define "opentelemetry-kube-stack.collector.applyKubernetesAttributesConfig" -}}
{{- $config := mustMergeOverwrite (include "opentelemetry-kube-stack.collector.kubernetesAttributesConfig" .collector | fromYaml) .collector.config }}
{{- if (has "k8sattributes" (dig "service" "pipelines" "logs" "processors" list $config)) }}
{{- $_ := set $config.service.pipelines.logs "processors" (prepend $config.service.pipelines.logs.processors "k8sattributes" | uniq) }}
{{- if and (dig "service" "pipelines" "logs" false $config) (not (has "k8sattributes" (dig "service" "pipelines" "logs" "processors" list $config))) }}
{{- $_ := set $config.service.pipelines.logs "processors" (prepend ($config.service.pipelines.logs.processors | default list) "k8sattributes" | uniq) }}
{{- end }}
{{- if (has "k8sattributes" (dig "service" "pipelines" "metrics" "processors" $config) }}
{{- $_ := set $config.service.pipelines.metrics "processors" (prepend $config.service.pipelines.metrics.processors "k8sattributes" | uniq) }}
{{- if and (dig "service" "pipelines" "metrics" false $config) (not (has "k8sattributes" (dig "service" "pipelines" "metrics" "processors" list $config))) }}
{{- $_ := set $config.service.pipelines.metrics "processors" (prepend ($config.service.pipelines.metrics.processors | default list) "k8sattributes" | uniq) }}
{{- end }}
{{- if (has "k8sattributes" (dig "service" "pipelines" "traces" "processors" $config) }}
{{- $_ := set $config.service.pipelines.traces "processors" (prepend $config.service.pipelines.traces.processors "k8sattributes" | uniq) }}
{{- if and (dig "service" "pipelines" "traces" false $config) (not (has "k8sattributes" (dig "service" "pipelines" "traces" "processors" list $config))) }}
{{- $_ := set $config.service.pipelines.traces "processors" (prepend ($config.service.pipelines.traces.processors | default list) "k8sattributes" | uniq) }}
{{- end }}
{{- $config | toYaml }}
{{- end }}
Expand Down Expand Up @@ -157,8 +157,8 @@ processors:
{{- define "opentelemetry-kube-stack.collector.applyHostMetricsConfig" -}}
{{- $config := mustMergeOverwrite (include "opentelemetry-kube-stack.collector.hostMetricsConfig" .collector | fromYaml) .collector.config }}
{{- if (has "hostmetrics" (dig "service" "pipelines" "metrics" "receivers" $config) }}
{{- $_ := set $config.service.pipelines.metrics "receivers" (append $config.service.pipelines.metrics.receivers "hostmetrics" | uniq) }}
{{- if and (dig "service" "pipelines" "metrics" false $config) (not (has "hostmetrics" (dig "service" "pipelines" "metrics" "receivers" list $config))) }}
{{- $_ := set $config.service.pipelines.metrics "receivers" (append ($config.service.pipelines.metrics.receivers | default list) "hostmetrics" | uniq) }}
{{- end }}
{{- $config | toYaml }}
{{- end }}
Expand Down Expand Up @@ -224,8 +224,8 @@ receivers:
{{- define "opentelemetry-kube-stack.collector.applyClusterMetricsConfig" -}}
{{- $config := mustMergeOverwrite (include "opentelemetry-kube-stack.collector.clusterMetricsConfig" .collector | fromYaml) .collector.config }}
{{- if (has "k8s_cluster" (dig "service" "pipelines" "metrics" "receivers" $config) }}
{{- $_ := set $config.service.pipelines.metrics "receivers" (append $config.service.pipelines.metrics.receivers "k8s_cluster" | uniq) }}
{{- if and (dig "service" "pipelines" "metrics" false $config) (not (has "k8s_cluster" (dig "service" "pipelines" "metrics" "receivers" list $config))) }}
{{- $_ := set $config.service.pipelines.metrics "receivers" (append ($config.service.pipelines.metrics.receivers | default list) "k8s_cluster" | uniq) }}
{{- end }}
{{- $config | toYaml }}
{{- end }}
Expand All @@ -241,8 +241,8 @@ receivers:
{{- define "opentelemetry-kube-stack.collector.applyKubeletMetricsConfig" -}}
{{- $config := mustMergeOverwrite (include "opentelemetry-kube-stack.collector.kubeletMetricsConfig" .collector | fromYaml) .collector.config }}
{{- if (has "kubeletstats" (dig "service" "pipelines" "metrics" "receivers" $config) }}
{{- $_ := set $config.service.pipelines.metrics "receivers" (append $config.service.pipelines.metrics.receivers "kubeletstats" | uniq) }}
{{- if and (dig "service" "pipelines" "metrics" false $config) (not (has "kubeletstats" (dig "service" "pipelines" "metrics" "receivers" list $config))) }}
{{- $_ := set $config.service.pipelines.metrics "receivers" (append ($config.service.pipelines.metrics.receivers | default list) "kubeletstats" | uniq) }}
{{- end }}
{{- $config | toYaml }}
{{- end }}
Expand Down Expand Up @@ -277,11 +277,11 @@ receivers:
{{- define "opentelemetry-kube-stack.collector.applyLogsCollectionConfig" -}}
{{- $config := mustMergeOverwrite (include "opentelemetry-kube-stack.collector.logsCollectionConfig" .collector | fromYaml) .collector.config }}
{{- if (has "filelog" (dig "service" "pipelines" "logs" "receivers" $config) }}
{{- $_ := set $config.service.pipelines.logs "receivers" (append $config.service.pipelines.logs.receivers "filelog" | uniq) }}
{{- if and (dig "service" "pipelines" "logs" false $config) (not (has "filelog" (dig "service" "pipelines" "logs" "receivers" list $config))) }}
{{- $_ := set $config.service.pipelines.logs "receivers" (append ($config.service.pipelines.logs.receivers | default list) "filelog" | uniq) }}
{{- end }}
{{- if .collector.presets.logsCollection.storeCheckpoints}}
{{- $_ := set $config.service "extensions" (append $config.service.extensions "file_storage" | uniq) }}
{{- $_ := set $config.service "extensions" (append ($config.service.extensions | default list) "file_storage" | uniq) }}
{{- end }}
{{- $config | toYaml }}
{{- end }}
Expand Down Expand Up @@ -397,8 +397,8 @@ receivers:
{{- define "opentelemetry-kube-stack.collector.applyKubernetesEventsConfig" -}}
{{- $config := mustMergeOverwrite (include "opentelemetry-kube-stack.collector.kubernetesEventsConfig" .collector | fromYaml) .collector.config }}
{{- if (has "k8sobjects" (dig "service" "pipelines" "logs" "receivers" $config) }}
{{- $_ := set $config.service.pipelines.logs "receivers" (append $config.service.pipelines.logs.receivers "k8sobjects" | uniq) }}
{{- if and (dig "service" "pipelines" "logs" false $config) (not (has "k8sobjects" (dig "service" "pipelines" "logs" "receivers" list $config))) }}
{{- $_ := set $config.service.pipelines.logs "receivers" (append ($config.service.pipelines.logs.receivers | default list) "k8sobjects" | uniq) }}
{{- end }}
{{- $config | toYaml }}
{{- end }}
Expand All @@ -416,14 +416,14 @@ receivers:
{{- define "opentelemetry-kube-stack.collector.applyBatchProcessorConfig" -}}
{{- $config := mustMergeOverwrite (include "opentelemetry-kube-stack.collector.batchProcessorConfig" .collector | fromYaml) .collector.config }}
{{- if (has "batch" (dig "service" "pipelines" "logs" "processors" $config) }}
{{- $_ := set $config.service.pipelines.logs "processors" (prepend $config.service.pipelines.logs.processors "batch" | uniq) }}
{{- if and (dig "service" "pipelines" "logs" false $config) (not (has "batch" (dig "service" "pipelines" "logs" "processors" list $config))) }}
{{- $_ := set $config.service.pipelines.logs "processors" (prepend ($config.service.pipelines.logs.processors | default list) "batch" | uniq) }}
{{- end }}
{{- if (has "batch" (dig "service" "pipelines" "metrics" "processors" $config) }}
{{- $_ := set $config.service.pipelines.metrics "processors" (prepend $config.service.pipelines.metrics.processors "batch" | uniq) }}
{{- if and (dig "service" "pipelines" "metrics" false $config) (not (has "batch" (dig "service" "pipelines" "metrics" "processors" list $config))) }}
{{- $_ := set $config.service.pipelines.metrics "processors" (prepend ($config.service.pipelines.metrics.processors | default list) "batch" | uniq) }}
{{- end }}
{{- if (has "batch" (dig "service" "pipelines" "traces" "processors" $config) }}
{{- $_ := set $config.service.pipelines.traces "processors" (prepend $config.service.pipelines.traces.processors "batch" | uniq) }}
{{- if and (dig "service" "pipelines" "traces" false $config) (not (has "batch" (dig "service" "pipelines" "traces" "processors" list $config))) }}
{{- $_ := set $config.service.pipelines.traces "processors" (prepend ($config.service.pipelines.traces.processors | default list) "batch" | uniq) }}
{{- end }}
{{- $config | toYaml }}
{{- end }}
Expand All @@ -438,14 +438,14 @@ processors:
{{- define "opentelemetry-kube-stack.collector.applyOTLPExporter" -}}
{{- $config := mustMergeOverwrite (include "opentelemetry-kube-stack.collector.otlpExporterConfig" .collector | fromYaml) .collector.config }}
{{- if (has "otlp" (dig "service" "pipelines" "logs" "exporters" $config) }}
{{- $_ := set $config.service.pipelines.logs "exporters" (prepend $config.service.pipelines.logs.exporters "otlp" | uniq) }}
{{- if and (dig "service" "pipelines" "logs" false $config) (not (has "otlp" (dig "service" "pipelines" "logs" "exporters" list $config))) }}
{{- $_ := set $config.service.pipelines.logs "exporters" (prepend ($config.service.pipelines.logs.exporters | default list) "otlp" | uniq) }}
{{- end }}
{{- if (has "otlp" (dig "service" "pipelines" "metrics" "exporters" $config) }}
{{- $_ := set $config.service.pipelines.metrics "exporters" (prepend $config.service.pipelines.metrics.exporters "otlp" | uniq) }}
{{- if and (dig "service" "pipelines" "metrics" false $config) (not (has "otlp" (dig "service" "pipelines" "metrics" "exporters" list $config))) }}
{{- $_ := set $config.service.pipelines.metrics "exporters" (prepend ($config.service.pipelines.metrics.exporters | default list) "otlp" | uniq) }}
{{- end }}
{{- if (has "otlp" (dig "service" "pipelines" "traces" "exporters" $config) }}
{{- $_ := set $config.service.pipelines.traces "exporters" (prepend $config.service.pipelines.traces.exporters "otlp" | uniq) }}
{{- if and (dig "service" "pipelines" "traces" false $config) (not (has "otlp" (dig "service" "pipelines" "traces" "exporters" list $config))) }}
{{- $_ := set $config.service.pipelines.traces "exporters" (prepend ($config.service.pipelines.traces.exporters | default list) "otlp" | uniq) }}
{{- end }}
{{- $config | toYaml }}
{{- end }}
Expand Down

0 comments on commit 6543884

Please sign in to comment.