Skip to content

Commit

Permalink
Add support for --skip-crds helm install flag
Browse files Browse the repository at this point in the history
Signed-off-by: svvac <[email protected]>
  • Loading branch information
svvac committed Jun 10, 2024
1 parent 3b100ff commit 054553c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
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 @@ -34,6 +34,7 @@ type HelmChartSpec struct {
JobImage string `json:"jobImage,omitempty"`
BackOffLimit *int32 `json:"backOffLimit,omitempty"`
Timeout *metav1.Duration `json:"timeout,omitempty"`
SkipCRDs bool `json:"skipCRDs,omitempty"`
FailurePolicy string `json:"failurePolicy,omitempty"`
AuthSecret *corev1.LocalObjectReference `json:"authSecret,omitempty"`

Expand Down
4 changes: 4 additions & 0 deletions pkg/controllers/chart/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,10 @@ func args(chart *v1.HelmChart) []string {
args = append(args, "--version", spec.Version)
}

if spec.SkipCRDs {
args = append(args, "--skip-crds")
}

for _, k := range keys(spec.Set) {
val := spec.Set[k]
if typedVal(val) {
Expand Down
4 changes: 3 additions & 1 deletion pkg/controllers/chart/chart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func TestInstallArgs(t *testing.T) {
assert := assert.New(t)
stringArgs := strings.Join(args(NewChart()), " ")
assert.Equal("install "+
"--skip-crds "+
"--set-string acme.dnsProvider.name=cloudflare "+
"--set-string global.clusterCIDR=10.42.0.0/16\\,fd42::/48 "+
"--set-string global.systemDefaultRegistry= "+
Expand All @@ -163,7 +164,8 @@ func TestDeleteArgs(t *testing.T) {
func NewChart() *v1.HelmChart {
return v1.NewHelmChart("kube-system", "traefik", v1.HelmChart{
Spec: v1.HelmChartSpec{
Chart: "stable/traefik",
Chart: "stable/traefik",
SkipCRDs: true,
Set: map[string]intstr.IntOrString{
"rbac.enabled": intstr.Parse("true"),
"ssl.enabled": intstr.Parse("false"),
Expand Down

0 comments on commit 054553c

Please sign in to comment.