Skip to content

Commit

Permalink
Merge pull request #578 from fluxcd/rel-base-path
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco authored Dec 10, 2020
2 parents adc3d17 + 7a5b9e2 commit be6fab7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,11 @@ func GenerateKustomizationYaml(dirPath string) error {

var resources []string
for _, file := range files {
resources = append(resources, strings.Replace(file, abs, ".", 1))
relP, err := filepath.Rel(abs, file)
if err != nil {
return err
}
resources = append(resources, relP)
}

kus.Resources = resources
Expand Down
16 changes: 16 additions & 0 deletions pkg/manifestgen/install/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ func build(base, output string) error {
return fmt.Errorf("%s not found", kfile)
}

// TODO(hidde): work around for a bug in kustomize causing it to
// not properly handle absolute paths on Windows.
// Convert the path to a relative path to the working directory
// as a temporary fix:
// https://github.com/kubernetes-sigs/kustomize/issues/2789
if filepath.IsAbs(base) {
wd, err := os.Getwd()
if err != nil {
return err
}
base, err = filepath.Rel(wd, base)
if err != nil {
return err
}
}

opt := krusty.MakeDefaultOptions()
k := krusty.MakeKustomizer(fs, opt)
m, err := k.Run(base)
Expand Down

0 comments on commit be6fab7

Please sign in to comment.