Skip to content

Commit

Permalink
Support no-hooks flag
Browse files Browse the repository at this point in the history
Fixes #97

Signed-off-by: Bastian Hofmann <[email protected]>
  • Loading branch information
bashofmann committed Apr 12, 2022
1 parent 35a9a60 commit 754187d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/apis/helm.cattle.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type HelmChartSpec struct {
JobImage string `json:"jobImage,omitempty"`
Timeout *metav1.Duration `json:"timeout,omitempty"`
FailurePolicy string `json:"failurePolicy,omitempty"`
NoHooks bool `json:"noHooks,omitempty"`
}

type HelmChartStatus struct {
Expand Down
3 changes: 3 additions & 0 deletions pkg/helm/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ func args(chart *helmv1.HelmChart) []string {
if spec.Version != "" {
args = append(args, "--version", spec.Version)
}
if spec.NoHooks {
args = append(args, "--no-hooks")
}

for _, k := range keys(spec.Set) {
val := spec.Set[k]
Expand Down
15 changes: 15 additions & 0 deletions pkg/helm/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ func TestInstallArgs(t *testing.T) {
stringArgs)
}

func TestInstallArgsWithNoHooks(t *testing.T) {
assert := assert.New(t)
chart := NewChart()
chart.Spec.NoHooks = true
stringArgs := strings.Join(args(chart), " ")
assert.Equal("install "+
"--no-hooks "+
"--set-string acme.dnsProvider.name=cloudflare "+
"--set-string global.clusterCIDR=10.42.0.0/16\\,fd42::/48 "+
"--set-string global.systemDefaultRegistry= "+
"--set rbac.enabled=true "+
"--set ssl.enabled=false",
stringArgs)
}

func TestDeleteArgs(t *testing.T) {
assert := assert.New(t)
chart := NewChart()
Expand Down

0 comments on commit 754187d

Please sign in to comment.