Skip to content

Commit 7a1d81f

Browse files
committed
Support no-hooks flag
Fixes #97
1 parent 35a9a60 commit 7a1d81f

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

Diff for: pkg/apis/helm.cattle.io/v1/types.go

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type HelmChartSpec struct {
3030
JobImage string `json:"jobImage,omitempty"`
3131
Timeout *metav1.Duration `json:"timeout,omitempty"`
3232
FailurePolicy string `json:"failurePolicy,omitempty"`
33+
NoHooks bool `json:"noHooks,omitempty"`
3334
}
3435

3536
type HelmChartStatus struct {

Diff for: pkg/helm/controller.go

+3
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ func args(chart *helmv1.HelmChart) []string {
462462
if spec.Version != "" {
463463
args = append(args, "--version", spec.Version)
464464
}
465+
if spec.NoHooks {
466+
args = append(args, "--no-hooks")
467+
}
465468

466469
for _, k := range keys(spec.Set) {
467470
val := spec.Set[k]

Diff for: pkg/helm/controller_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ func TestInstallArgs(t *testing.T) {
6565
stringArgs)
6666
}
6767

68+
func TestInstallArgsWithNoHooks(t *testing.T) {
69+
assert := assert.New(t)
70+
chart := NewChart()
71+
chart.Spec.NoHooks = true
72+
stringArgs := strings.Join(args(chart), " ")
73+
assert.Equal("install "+
74+
"--no-hooks "+
75+
"--set-string acme.dnsProvider.name=cloudflare "+
76+
"--set-string global.clusterCIDR=10.42.0.0/16\\,fd42::/48 "+
77+
"--set-string global.systemDefaultRegistry= "+
78+
"--set rbac.enabled=true "+
79+
"--set ssl.enabled=false",
80+
stringArgs)
81+
}
82+
6883
func TestDeleteArgs(t *testing.T) {
6984
assert := assert.New(t)
7085
chart := NewChart()

0 commit comments

Comments
 (0)