From cf1915ea856836e21edc9fb93c3101beb35da0e1 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Wed, 11 Dec 2024 19:24:59 +0200 Subject: [PATCH] Make the variables loading function public Signed-off-by: Stefan Prodan --- kustomize/kustomize_varsub.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kustomize/kustomize_varsub.go b/kustomize/kustomize_varsub.go index 429f2592..699565b7 100644 --- a/kustomize/kustomize_varsub.go +++ b/kustomize/kustomize_varsub.go @@ -102,7 +102,7 @@ func SubstituteVariables( // But if the user is using dryRun, he/she should know what he/she is doing, and we should comply. var vars map[string]string if !options.DryRun { - vars, err = loadVars(ctx, kubeClient, kustomization) + vars, err = LoadVariables(ctx, kubeClient, kustomization) if err != nil { return nil, err } @@ -137,7 +137,9 @@ func SubstituteVariables( return res, nil } -func loadVars(ctx context.Context, kubeClient client.Client, kustomization unstructured.Unstructured) (map[string]string, error) { +// LoadVariables reads the in-line variables set in the Flux Kustomization and merges them with +// the vars referred in ConfigMaps and Secrets data keys. +func LoadVariables(ctx context.Context, kubeClient client.Client, kustomization unstructured.Unstructured) (map[string]string, error) { vars := make(map[string]string) substituteFrom, err := getSubstituteFrom(kustomization) if err != nil {