Skip to content

Commit

Permalink
use an alias for cert-manager
Browse files Browse the repository at this point in the history
Signed-off-by: Zuhair AlSader <[email protected]>
  • Loading branch information
zalsader authored and arttor committed Mar 31, 2023
1 parent 2d1d959 commit 0126096
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/helm/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
15 changes: 9 additions & 6 deletions pkg/helm/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
Expand Down

0 comments on commit 0126096

Please sign in to comment.