diff --git a/cmd/helm/template.go b/cmd/helm/template.go index f10fd1c5a..a4438b50c 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -114,15 +114,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { // if the filepath provided matches a manifest path in the // chart, render that manifest - if strings.HasSuffix(f, "*") { - if matched, _ := filepath.Match(f, manifestPath); !matched { - continue - } - } else if strings.HasSuffix(f, "/") { - if dir, _ := filepath.Split(manifestPath); f != dir { - continue - } - } else if f != manifestPath { + if matched, _ := filepath.Match(f, manifestPath); !matched { continue } manifestsToRender = append(manifestsToRender, manifest) diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index f8c8066b9..87ee79e5a 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -94,13 +94,6 @@ func TestTemplateCmd(t *testing.T) { cmd: fmt.Sprintf("template '%s' --show-only templates/service.yaml --show-only charts/subcharta/templates/service.yaml", chartPath), golden: "output/template-show-only-multiple.txt", }, - { - name: "template with show-only directory", - cmd: fmt.Sprintf("template '%s' --show-only templates/subdir/", chartPath), - golden: "output/template-show-only-directory.txt", - // Repeat to ensure manifest ordering regressions are caught - repeat: 10, - }, { name: "template with show-only glob", cmd: fmt.Sprintf("template '%s' --show-only templates/subdir/role*", chartPath), diff --git a/cmd/helm/testdata/output/template-show-only-directory.txt b/cmd/helm/testdata/output/template-show-only-directory.txt deleted file mode 100644 index 86578adfd..000000000 --- a/cmd/helm/testdata/output/template-show-only-directory.txt +++ /dev/null @@ -1,29 +0,0 @@ ---- -# Source: subchart1/templates/subdir/serviceaccount.yaml -apiVersion: v1 -kind: ServiceAccount -metadata: - name: subchart1-sa ---- -# Source: subchart1/templates/subdir/role.yaml -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: subchart1-role -rules: -- resources: ["*"] - verbs: ["get","list","watch"] ---- -# Source: subchart1/templates/subdir/rolebinding.yaml -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: subchart1-binding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: subchart1-role -subjects: -- kind: ServiceAccount - name: subchart1-sa - namespace: default