Skip to content

Commit

Permalink
fix: Helm v3 CRD are not deployed (#3345)
Browse files Browse the repository at this point in the history
* Fixing could not find plugin issue when app sync and app diff

* Fixing codegen error

* Revert "Fixing codegen error"

This reverts commit b2dcfb8

* Fixing codegen error

* If user is logged in, settings API would return ConfigManagementPlugins

* For helm3, add flag --include-crds when calling helm template to support helm3 crd

* Fixing typo.

* Added further assertion of ResourceSyncStatusIs for CRD resources.
  • Loading branch information
mayzhang2000 authored and alexmt committed Apr 6, 2020
1 parent bdda410 commit 76241f9
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/e2e/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,14 @@ 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)).
Expect(ResourceSyncStatusIs("CustomResourceDefinition", "crontabs.stable.example.com", 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.additionalTemplateArgs != nil {
args = append(args, c.HelmVer.additionalTemplateArgs...)
}

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,
additionalTemplateArgs: []string{"--include-crds"},
}
)

Expand Down Expand Up @@ -82,4 +83,5 @@ type HelmVer struct {
pullCommand string
kubeVersionSupported bool
getPostTemplateCallback func(chartPath string) (func(), error)
additionalTemplateArgs []string
}

0 comments on commit 76241f9

Please sign in to comment.