Skip to content
Merged
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
10 changes: 5 additions & 5 deletions deploy/helm/elastic-agent/templates/agent/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ Initialise input templates if we are not deploying as managed
{{- $customInputPresetName := ($customInputVal).preset -}}
{{- $presetVal := get $.Values.agent.presets $customInputPresetName -}}
{{- $_ := required (printf "preset with name \"%s\" of customInput \"%s\" not defined" $customInputPresetName $customInputName) $customInputVal -}}
{{- $customInputOuput := ($customInputVal).use_output -}}
{{- include "elasticagent.preset.mutate.outputs.byname" (list $ $presetVal $customInputOuput) -}}
{{- $customInputOutput := ($customInputVal).use_output -}}
{{- include "elasticagent.preset.mutate.outputs.byname" (list $ $presetVal $customInputOutput) -}}
{{- include "elasticagent.preset.mutate.inputs" (list $ $presetVal (list $customInputVal)) -}}
{{- end -}}
{{- end -}}
Expand Down Expand Up @@ -429,9 +429,9 @@ app.kubernetes.io/version: {{ .Values.agent.version}}
{{- $ := index . 0 -}}
{{- $preset := index . 1 -}}
{{- $outputName := index . 2 -}}
{{- $ouputVal := get $.Values.outputs $outputName }}
{{- $_ := required (printf "output \"%s\" is not defined" $outputName) $ouputVal -}}
{{- $outputCopy := deepCopy $ouputVal -}}
{{- $outputVal := get $.Values.outputs $outputName }}
{{- $_ := required (printf "output \"%s\" is not defined" $outputName) $outputVal -}}
{{- $outputCopy := deepCopy $outputVal -}}
{{- $presetOutputs := dig "outputs" (dict) $preset -}}
{{- if not (hasKey $presetOutputs $outputName) -}}
{{- $_ := set $presetOutputs $outputName $outputCopy}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ spec:
configRef:
secretName: {{ $agentName }}
{{- with ($presetVal).outputs }}
{{- $eckOuputs := list }}
{{- $eckOutputs := list }}
{{- range $outputName, $outputVal := . -}}
{{- if eq ($outputVal).type "ESECKRef" -}}
{{- $eckOuputs = append $eckOuputs (include "elasticagent.output.ESECKRef.preset.config" (list $ $outputName $outputVal) | fromYaml) -}}
{{- $eckOutputs = append $eckOutputs (include "elasticagent.output.ESECKRef.preset.config" (list $ $outputName $outputVal) | fromYaml) -}}
{{- end -}}
{{- end -}}
{{- if gt (len $eckOuputs) 0 }}
{{- if gt (len $eckOutputs) 0 }}
elasticsearchRefs:
{{- $eckOuputs | toYaml | nindent 4 -}}
{{- $eckOutputs | toYaml | nindent 4 -}}
{{- end -}}
{{- end }}
daemonSet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ spec:
configRef:
secretName: {{ $agentName }}
{{- with ($presetVal).outputs }}
{{- $eckOuputs := list }}
{{- $eckOutputs := list }}
{{- range $outputName, $outputVal := . -}}
{{- if eq ($outputVal).type "ESECKRef" -}}
{{- $eckOuputs = append $eckOuputs (include "elasticagent.output.ESECKRef.preset.config" (list $ $outputName $outputVal) | fromYaml) -}}
{{- $eckOutputs = append $eckOutputs (include "elasticagent.output.ESECKRef.preset.config" (list $ $outputName $outputVal) | fromYaml) -}}
{{- end -}}
{{- end -}}
{{- if gt (len $eckOuputs) 0 }}
{{- if gt (len $eckOutputs) 0 }}
elasticsearchRefs:
{{- $eckOuputs | toYaml | nindent 4 -}}
{{- $eckOutputs | toYaml | nindent 4 -}}
{{- end -}}
{{- end }}
deployment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ spec:
configRef:
secretName: {{ $agentName }}
{{- with ($presetVal).outputs }}
{{- $eckOuputs := list }}
{{- $eckOutputs := list }}
{{- range $outputName, $outputVal := . -}}
{{- if eq ($outputVal).type "ESECKRef" -}}
{{- $eckOuputs = append $eckOuputs (include "elasticagent.output.ESECKRef.preset.config" (list $ $outputName $outputVal) | fromYaml) -}}
{{- $eckOutputs = append $eckOutputs (include "elasticagent.output.ESECKRef.preset.config" (list $ $outputName $outputVal) | fromYaml) -}}
{{- end -}}
{{- end -}}
{{- if gt (len $eckOuputs) 0 }}
{{- if gt (len $eckOutputs) 0 }}
elasticsearchRefs:
{{- $eckOuputs | toYaml | nindent 4 -}}
{{- $eckOutputs | toYaml | nindent 4 -}}
{{- end -}}
{{- end }}
statefulSet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ env:
value: "/usr/share/elastic-agent/state"
{{- if eq $.Values.agent.fleet.enabled false -}}
{{- $outputName := $.Values.kubernetes.output -}}
{{- $ouputVal := get $.Values.outputs $.Values.kubernetes.output }}
{{- (include (printf "elasticagent.output.%s.preset.envvars" ($ouputVal).type) (list $ $outputName $ouputVal)) | nindent 2 }}
{{- $outputVal := get $.Values.outputs $.Values.kubernetes.output }}
{{- (include (printf "elasticagent.output.%s.preset.envvars" ($outputVal).type) (list $ $outputName $outputVal)) | nindent 2 }}
{{- else -}}
{{- with ($fleetMutations).extraEnvs -}}
{{- . | toYaml | nindent 2 }}
Expand Down Expand Up @@ -125,9 +125,9 @@ providers:
{{- $agentName := index . 1 -}}
{{- $streams := index . 2 -}}
{{- $outputName := $.Values.kubernetes.output -}}
{{- $ouputVal := get $.Values.outputs $outputName }}
{{- $outputVal := get $.Values.outputs $outputName }}
{{- $presetVal := dict }}
{{- $_ := set $presetVal "outputs" (dict $outputName $ouputVal) }}
{{- $_ := set $presetVal "outputs" (dict $outputName $outputVal) }}
{{- with (include "elasticagent.presets.ksm.sidecar.providers" $ | fromYaml).providers }}
{{- $_ := set $presetVal "providers" . }}
{{- end }}
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/agent/application/monitoring/v1_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const (
)

var (
errNoOuputPresent = errors.New("outputs not part of the config")
errNoOutputPresent = errors.New("outputs not part of the config")
supportedMetricsComponents = []string{"filebeat", "metricbeat", "apm-server", "auditbeat", "cloudbeat", "fleet-server", "heartbeat", "osquerybeat", "packetbeat", "pf-elastic-collector", "pf-elastic-symbolizer"}
supportedBeatsComponents = []string{"filebeat", "metricbeat", "apm-server", "fleet-server", "auditbeat", "cloudbeat", "heartbeat", "osquerybeat", "packetbeat", "pf-elastic-collector", "pf-elastic-symbolizer"}
)
Expand Down Expand Up @@ -220,9 +220,9 @@ func (b *BeatsMonitor) MonitoringConfig(

componentInfos := b.getComponentInfos(components, componentIDPidMap)

if err := b.injectMonitoringOutput(policy, cfg, monitoringOutputName); err != nil && !errors.Is(err, errNoOuputPresent) {
if err := b.injectMonitoringOutput(policy, cfg, monitoringOutputName); err != nil && !errors.Is(err, errNoOutputPresent) {
return nil, errors.New(err, "failed to inject monitoring output")
} else if errors.Is(err, errNoOuputPresent) {
} else if errors.Is(err, errNoOutputPresent) {
// nothing to inject, no monitoring output
return nil, nil
}
Expand Down Expand Up @@ -376,7 +376,7 @@ func (b *BeatsMonitor) initInputs(cfg map[string]interface{}) {
func (b *BeatsMonitor) injectMonitoringOutput(source, dest map[string]interface{}, monitoringOutputName string) error {
outputsNode, found := source[outputsKey]
if !found {
return errNoOuputPresent
return errNoOutputPresent
}

outputs, ok := outputsNode.(map[string]interface{})
Expand Down
Loading