Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Helm v3 CRD are not deployed #3345

Merged
merged 9 commits into from
Apr 3, 2020
10 changes: 10 additions & 0 deletions test/e2e/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,13 @@ func testHelmWithDependencies(t *testing.T, chartPath string, legacyRepo bool) {
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced))
}

func TestHelm3CRD(t *testing.T) {
Given(t).
Path("helm3-crd").
When().
Create().
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced))
}
6 changes: 6 additions & 0 deletions test/e2e/testdata/helm3-crd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: argocd-helm3-crd
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: 1.16.0
14 changes: 14 additions & 0 deletions test/e2e/testdata/helm3-crd/crds/crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: crontabs.stable.example.com
spec:
group: stable.example.com
version: v1
scope: Namespaced
names:
plural: crontabs
singular: crontab
kind: CronTab
shortNames:
- ct
6 changes: 6 additions & 0 deletions test/e2e/testdata/helm3-crd/templates/config-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: my-map
data:
foo: bar
Empty file.
3 changes: 3 additions & 0 deletions util/helm/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ func (c *Cmd) template(chartPath string, opts *TemplateOpts) (string, error) {
for _, v := range opts.APIVersions {
args = append(args, "--api-versions", v)
}
if c.HelmVer.additionalTempalteArgs != nil {
jannfis marked this conversation as resolved.
Show resolved Hide resolved
args = append(args, c.HelmVer.additionalTempalteArgs...)
}

return c.run(args...)
}
Expand Down
2 changes: 2 additions & 0 deletions util/helm/helmver.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
pullCommand: "pull",
initSupported: false,
getPostTemplateCallback: cleanupChartLockFile,
additionalTempalteArgs: []string{"--include-crds"},
jannfis marked this conversation as resolved.
Show resolved Hide resolved
}
)

Expand Down Expand Up @@ -82,4 +83,5 @@ type HelmVer struct {
pullCommand string
kubeVersionSupported bool
getPostTemplateCallback func(chartPath string) (func(), error)
additionalTempalteArgs []string
mayzhang2000 marked this conversation as resolved.
Show resolved Hide resolved
}