Skip to content

Commit

Permalink
feat: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Azhovan committed Oct 10, 2023
1 parent ef4401e commit 01909fd
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions apptests/kustomize/kustomize.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package kustomize

import (
"os"

"github.com/drone/envsubst"
"sigs.k8s.io/kustomize/api/krusty"
"sigs.k8s.io/kustomize/api/resmap"
Expand All @@ -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

Expand All @@ -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
}
Expand Down

0 comments on commit 01909fd

Please sign in to comment.