diff --git a/deploy/helm/elastic-agent/templates/agent/cluster-role-binding.yaml b/deploy/helm/elastic-agent/templates/agent/cluster-role-binding.yaml index c0eb1879b3d..7a1e5b24d07 100644 --- a/deploy/helm/elastic-agent/templates/agent/cluster-role-binding.yaml +++ b/deploy/helm/elastic-agent/templates/agent/cluster-role-binding.yaml @@ -3,7 +3,7 @@ {{- if or ($presetVal).clusterRole.create ($presetVal).clusterRole.name -}} {{- if or ($presetVal).serviceAccount.create ($presetVal).serviceAccount.name -}} {{/* cluster role binding is not namespace bound so let's try to give it a unique enough name */}} -{{- $clusterRoleName := printf "agent-%s-%s-%s" $presetName $.Release.Name $.Release.Namespace -}} +{{- $clusterRoleName := printf "agent-%s-%s-%s" $presetName $.Release.Name $.Release.Namespace }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: diff --git a/deploy/helm/elastic-agent/templates/agent/cluster-role.yaml b/deploy/helm/elastic-agent/templates/agent/cluster-role.yaml index 187d96f79d6..0374d7ddb10 100644 --- a/deploy/helm/elastic-agent/templates/agent/cluster-role.yaml +++ b/deploy/helm/elastic-agent/templates/agent/cluster-role.yaml @@ -2,7 +2,7 @@ {{- range $presetName, $presetVal := $.Values.agent.presets -}} {{- if eq $presetVal.clusterRole.create true -}} {{/* cluster role binding is not namespace bound so let's try to give it a unique enough name */}} -{{- $clusterRoleName := printf "agent-%s-%s-%s" $presetName $.Release.Name $.Release.Namespace -}} +{{- $clusterRoleName := printf "agent-%s-%s-%s" $presetName $.Release.Name $.Release.Namespace }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/deploy/helm/elastic-agent/templates/agent/eck/daemonset.yaml b/deploy/helm/elastic-agent/templates/agent/eck/daemonset.yaml index 6e86e9c9c6a..ed735fa1241 100644 --- a/deploy/helm/elastic-agent/templates/agent/eck/daemonset.yaml +++ b/deploy/helm/elastic-agent/templates/agent/eck/daemonset.yaml @@ -2,7 +2,7 @@ {{- range $presetName, $presetVal := $.Values.agent.presets -}} {{- if and (eq ($presetVal).mode "daemonset") (eq $.Values.agent.engine "eck") -}} {{- $agentName := include "elasticagent.preset.fullname" (list $ $presetName) -}} -{{- $podTemplateResource := include "elasticagent.engine.eck.podTemplate" (list $ $presetVal $agentName) | fromYaml -}} +{{- $podTemplateResource := include "elasticagent.engine.eck.podTemplate" (list $ $presetVal $agentName) | fromYaml }} apiVersion: agent.k8s.elastic.co/v1alpha1 kind: Agent metadata: diff --git a/deploy/helm/elastic-agent/templates/agent/eck/secret.yaml b/deploy/helm/elastic-agent/templates/agent/eck/secret.yaml index cf1f182ed12..164eecf25c9 100644 --- a/deploy/helm/elastic-agent/templates/agent/eck/secret.yaml +++ b/deploy/helm/elastic-agent/templates/agent/eck/secret.yaml @@ -1,7 +1,7 @@ {{- include "elasticagent.init" $ -}} {{- range $presetName, $presetVal := $.Values.agent.presets }} {{- if (eq $.Values.agent.engine "eck") -}} -{{- $agentName := include "elasticagent.preset.fullname" (list $ $presetName) -}} +{{- $agentName := include "elasticagent.preset.fullname" (list $ $presetName) }} apiVersion: v1 kind: Secret metadata: diff --git a/deploy/helm/elastic-agent/templates/agent/k8s/_secret.tpl b/deploy/helm/elastic-agent/templates/agent/k8s/_secret.tpl index 854bd5eea6a..16bcb210f84 100644 --- a/deploy/helm/elastic-agent/templates/agent/k8s/_secret.tpl +++ b/deploy/helm/elastic-agent/templates/agent/k8s/_secret.tpl @@ -17,7 +17,7 @@ {{- . | toYaml | nindent 6}} {{- end }} inputs: - {{- with ($presetVal)._inputs -}} + {{- with ($presetVal)._inputs }} {{- . | toYaml | nindent 6 }} {{- end }} {{- else }} diff --git a/deploy/helm/elastic-agent/templates/agent/k8s/secret.yaml b/deploy/helm/elastic-agent/templates/agent/k8s/secret.yaml index d207a5099d1..4831378f169 100644 --- a/deploy/helm/elastic-agent/templates/agent/k8s/secret.yaml +++ b/deploy/helm/elastic-agent/templates/agent/k8s/secret.yaml @@ -1,7 +1,7 @@ {{- include "elasticagent.init" $ -}} {{- range $presetName, $presetVal := $.Values.agent.presets }} {{- if (eq $.Values.agent.engine "k8s") -}} -{{- $agentName := include "elasticagent.preset.fullname" (list $ $presetName) -}} +{{- $agentName := include "elasticagent.preset.fullname" (list $ $presetName) }} apiVersion: v1 kind: Secret metadata: diff --git a/deploy/helm/elastic-agent/templates/agent/service-account.yaml b/deploy/helm/elastic-agent/templates/agent/service-account.yaml index 890fa719446..0c4a8365246 100644 --- a/deploy/helm/elastic-agent/templates/agent/service-account.yaml +++ b/deploy/helm/elastic-agent/templates/agent/service-account.yaml @@ -1,7 +1,7 @@ {{- include "elasticagent.init" $ -}} {{- range $presetName, $presetVal := $.Values.agent.presets -}} {{- if eq $presetVal.serviceAccount.create true -}} -{{- $agentName := include "elasticagent.preset.fullname" (list $ $presetName) -}} +{{- $agentName := include "elasticagent.preset.fullname" (list $ $presetName) }} apiVersion: v1 kind: ServiceAccount metadata: diff --git a/magefile.go b/magefile.go index c6baacf7c1e..7512386fb0e 100644 --- a/magefile.go +++ b/magefile.go @@ -3446,6 +3446,12 @@ func (Helm) RenderExamples() error { maps.Copy(helmValues, data) } + lintAction := action.NewLint() + lintResult := lintAction.Run([]string{helmChartPath}, helmValues) + if len(lintResult.Errors) > 0 { + return fmt.Errorf("failed to lint helm chart for example %s: %w", exampleFullPath, errors.Join(lintResult.Errors...)) + } + installAction := action.NewInstall(actionConfig) installAction.Namespace = "default" installAction.ReleaseName = "example"