diff --git a/pkg/helm/chart.go b/pkg/helm/chart.go index afa9733..a12386c 100644 --- a/pkg/helm/chart.go +++ b/pkg/helm/chart.go @@ -103,12 +103,12 @@ func overwriteTemplateFile(filename, chartDir string, crd bool, templates []helm func overwriteValuesFile(chartDir string, values helmify.Values, certManagerAsSubchart bool) error { if certManagerAsSubchart { - _, err := values.Add(true, "cert-manager", "installCRDs") + _, err := values.Add(true, "certmanager", "installCRDs") if err != nil { return errors.Wrap(err, "unable to add cert-manager.installCRDs") } - _, err = values.Add(true, "cert-manager", "enabled") + _, err = values.Add(true, "certmanager", "enabled") if err != nil { return errors.Wrap(err, "unable to add cert-manager.enabled") } diff --git a/pkg/helm/init.go b/pkg/helm/init.go index 7cfbc07..d998044 100644 --- a/pkg/helm/init.go +++ b/pkg/helm/init.go @@ -124,6 +124,14 @@ version: 0.1.0 appVersion: "0.1.0" ` +const certManagerDependencies = ` +dependencies: + - name: cert-manager + repository: https://charts.jetstack.io + condition: certmanager.enabled + alias: certmanager +` + var chartName = regexp.MustCompile("^[a-zA-Z0-9._-]+$") const maxChartNameLength = 250 @@ -183,13 +191,8 @@ func createCommonFiles(chartDir, chartName string, crd bool, certManagerAsSubcha func chartYAML(appName string, certManagerAsSubchart bool) []byte { chartFile := defaultChartfile - annotatins := ` -dependencies: - - name: cert-manager - repository: https://charts.jetstack.io - condition: certManager.enabled` if certManagerAsSubchart { - chartFile += annotatins + chartFile += certManagerDependencies } return []byte(fmt.Sprintf(chartFile, appName)) }