Skip to content

Commit

Permalink
Make the variables loading function public
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed Dec 11, 2024
1 parent 84013d4 commit cf1915e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kustomize/kustomize_varsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit cf1915e

Please sign in to comment.