Skip to content

Commit 7d27de4

Browse files
committed
create crds dir if not exists
1 parent 29ecfed commit 7d27de4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/helm/chart.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ func overwriteTemplateFile(filename, chartDir string, crd bool, templates []helm
6666
var subdir string
6767
if strings.Contains(filename, "crd") && crd {
6868
subdir = "crds"
69+
// create "crds" if not exists
70+
if _, err := os.Stat(filepath.Join(chartDir, "crds")); os.IsNotExist(err) {
71+
err = os.MkdirAll(filepath.Join(chartDir, "crds"), 0750)
72+
if err != nil {
73+
return errors.Wrap(err, "unable create crds dir")
74+
}
75+
}
6976
} else {
7077
subdir = "templates"
7178
}

pkg/helm/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func createCommonFiles(chartDir, chartName string, crd bool) error {
160160
return errors.Wrap(err, "unable create chart/templates dir")
161161
}
162162
if crd {
163-
err := os.MkdirAll(filepath.Join(cDir, "crds"), 0750)
163+
err = os.MkdirAll(filepath.Join(cDir, "crds"), 0750)
164164
if err != nil {
165165
return errors.Wrap(err, "unable create crds dir")
166166
}

0 commit comments

Comments
 (0)