Skip to content

Commit

Permalink
Use rel filepath in auto generated kustomization
Browse files Browse the repository at this point in the history
This works around another bug on Windows platforms that would cause the
kustomize-controller to choke on the kustomization.yaml generated by the
bootstrap command due to the filepath being in a Windows format.

By using `filepath.Rel`, the output is _just_ the filename for files
relative to the bootstrap path, which is at the moment sufficient to
make it work.

Signed-off-by: Hidde Beydals <hello@hidde.co>
  • Loading branch information
hiddeco committed Dec 10, 2020
1 parent ee1f708 commit 3c624e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,16 @@ 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
kd, err := yaml.Marshal(kus)
fmt.Printf("%s", kd)
if err != nil {
return err
}
Expand Down

0 comments on commit 3c624e2

Please sign in to comment.