diff --git a/apptests/kustomize/kustomize.go b/apptests/kustomize/kustomize.go index a49ef3e9b6..4d59b49686 100644 --- a/apptests/kustomize/kustomize.go +++ b/apptests/kustomize/kustomize.go @@ -1,8 +1,6 @@ package kustomize import ( - "os" - "github.com/drone/envsubst" "sigs.k8s.io/kustomize/api/krusty" "sigs.k8s.io/kustomize/api/resmap" @@ -28,10 +26,6 @@ func New(dir string, subs map[string]string) *Kustomize { // Build runs the kustomization process on the directory and substitutes the // environment variables in the resources. func (k *Kustomize) Build() error { - for k, v := range k.substitutes { - os.Setenv(k, v) - } - opts := krusty.MakeDefaultOptions() opts.Reorder = krusty.ReorderOptionLegacy @@ -49,7 +43,9 @@ func (k *Kustomize) Build() error { return err } - out, err := envsubst.EvalEnv(string(yaml)) + out, err := envsubst.Eval(string(yaml), func(s string) string { + return k.substitutes[s] + }) if err != nil { return err }