@@ -12,6 +12,7 @@ import (
1212 "errors"
1313 "fmt"
1414 "io"
15+ "text/template"
1516 "time"
1617
1718 resourcesv1alpha1 "github.com/gardener/gardener/pkg/apis/resources/v1alpha1"
@@ -136,21 +137,13 @@ func (r *Reconciler) deployResource(ctx context.Context, res config.AdditionalSe
136137
137138 var values map [string ]interface {}
138139 if res .Helm .Values != nil && res .Helm .Values .Raw != nil {
139- if err := json .Unmarshal (res .Helm .Values .Raw , & values ); err != nil {
140- return fmt .Errorf ("failed to unmarshal helm values: %w" , err )
141- }
142- }
143-
144- if r .seedIngressDomain != "" {
145- if values == nil {
146- values = make (map [string ]interface {})
140+ raw , err := r .substituteTemplateVariables (res .Helm .Values .Raw )
141+ if err != nil {
142+ return fmt .Errorf ("failed to substitute template variables in helm values: %w" , err )
147143 }
148- ingestor , _ := values ["ingestor" ].(map [string ]interface {})
149- if ingestor == nil {
150- ingestor = make (map [string ]interface {})
151- values ["ingestor" ] = ingestor
144+ if err := json .Unmarshal (raw , & values ); err != nil {
145+ return fmt .Errorf ("failed to unmarshal helm values: %w" , err )
152146 }
153- ingestor ["ingressDomain" ] = "falco-splunk-ingestor." + r .seedIngressDomain
154147 }
155148
156149 release , err := r .renderer .RenderArchive (archive , res .Name , r .namespace , values )
@@ -186,6 +179,24 @@ func (r *Reconciler) managedResourceExists(ctx context.Context, mrName string) b
186179 return err == nil || ! apierrors .IsNotFound (err )
187180}
188181
182+ // substituteTemplateVariables replaces <<.VarName>> placeholders in raw JSON values
183+ // with runtime values (same pattern as global default destinations in falcovalues.go).
184+ func (r * Reconciler ) substituteTemplateVariables (raw []byte ) ([]byte , error ) {
185+ data := map [string ]string {
186+ "SeedIngressDomain" : r .seedIngressDomain ,
187+ }
188+
189+ tmpl , err := template .New ("" ).Delims ("<<" , ">>" ).Parse (string (raw ))
190+ if err != nil {
191+ return nil , fmt .Errorf ("failed to parse template: %w" , err )
192+ }
193+ var buf bytes.Buffer
194+ if err := tmpl .Execute (& buf , data ); err != nil {
195+ return nil , fmt .Errorf ("failed to execute template: %w" , err )
196+ }
197+ return buf .Bytes (), nil
198+ }
199+
189200// Cleanup removes ManagedResources that are labeled as additional but no longer in the config.
190201func (r * Reconciler ) Cleanup (ctx context.Context ) error {
191202 desiredNames := sets .New [string ]()
0 commit comments