Repository: helm/helm (go)

Issue:
Helm tries to parse non-yaml/json files in crds/
Output of `helm version`:
`version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", GitTreeState:"clean", GoVersion:"go1.13.5"}`

I put a script for updating third party CRDs and some markdown instructions in the crds/ directory of my chart. Helm apparently tries to parse these to install them, and then panics. Is this intended? I would have expected it to only read `*.yaml` and possibly `*.json`.

Output:
```sh
$ helm install crd-test . --debug
install.go:149: [debug] Original chart version: ""
install.go:166: [debug] CHART PATH: /home/carlpett/dev/src/github.com/<redacted company repo path>

Error: failed to install CRD crds/README.md: unable to decode "": json: cannot unmarshal string into Go value of type unstructured.detector
helm.go:76: [debug] unable to decode "": json: cannot unmarshal string into Go value of type unstructured.detector
failed to install CRD crds/.crd-release
helm.sh/helm/v3/pkg/action.(*Install).installCRDs
        /home/circleci/helm.sh/helm/pkg/action/install.go:118
helm.sh/helm/v3/pkg/action.(*Install).Run
        /home/circleci/helm.sh/helm/pkg/action/install.go:171
main.runInstall
        /home/circleci/helm.sh/helm/cmd/helm/install.go:214
main.newInstallCmd.func1
        /home/circleci/helm.sh/helm/cmd/helm/install.go:116
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main
        /home/circleci/helm.sh/helm/cmd/helm/helm.go:75
runtime.main
        /usr/local/go/src/runtime/proc.go:203
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1357
```

Pull request:
Fixes issue where non-CRDs are read in from the crd directory
For example, a readme markdown is read in and parsed

Closes #7536

Patch:
diff --git a/pkg/chart/chart.go b/pkg/chart/chart.go
index 1a85373b9..bd75375a4 100644
--- a/pkg/chart/chart.go
+++ b/pkg/chart/chart.go
@@ -135,7 +135,7 @@ func (ch *Chart) CRDs() []*File {
 	files := []*File{}
 	// Find all resources in the crds/ directory
 	for _, f := range ch.Files {
-		if strings.HasPrefix(f.Name, "crds/") {
+		if strings.HasPrefix(f.Name, "crds/") && hasManifestExtension(f.Name) {
 			files = append(files, f)
 		}
 	}
@@ -151,7 +151,7 @@ func (ch *Chart) CRDObjects() []CRD {
 	crds := []CRD{}
 	// Find all resources in the crds/ directory
 	for _, f := range ch.Files {
-		if strings.HasPrefix(f.Name, "crds/") {
+		if strings.HasPrefix(f.Name, "crds/") && hasManifestExtension(f.Name) {
 			mycrd := CRD{Name: f.Name, Filename: filepath.Join(ch.ChartFullPath(), f.Name), File: f}
 			crds = append(crds, mycrd)
 		}
@@ -162,3 +162,8 @@ func (ch *Chart) CRDObjects() []CRD {
 	}
 	return crds
 }
+
+func hasManifestExtension(fname string) bool {
+	ext := filepath.Ext(fname)
+	return strings.EqualFold(ext, ".yaml") || strings.EqualFold(ext, ".yml") || strings.EqualFold(ext, ".json")
+}
diff --git a/pkg/kube/client.go b/pkg/kube/client.go
index 215fc8308..3853e9036 100644
--- a/pkg/kube/client.go
+++ b/pkg/kube/client.go
@@ -54,8 +54,6 @@ var ErrNoObjectsVisited = errors.New("no objects visited")
 type Client struct {
 	Factory Factory
 	Log     func(string, ...interface{})
-	// Namespace allows to bypass the kubeconfig file for the choice of the namespace
-	Namespace string
 }
 
 var addToScheme sync.Once
@@ -117,9 +115,6 @@ func (c *Client) Wait(resources ResourceList, timeout time.Duration) error {
 }
 
 func (c *Client) namespace() string {
-	if c.Namespace != "" {
-		return c.Namespace
-	}
 	if ns, _, err := c.Factory.ToRawKubeConfigLoader().Namespace(); err == nil {
 		return ns
 	}


Test patch:
diff --git a/pkg/chart/chart_test.go b/pkg/chart/chart_test.go
index 724e52933..ef623fff6 100644
--- a/pkg/chart/chart_test.go
+++ b/pkg/chart/chart_test.go
@@ -41,6 +41,10 @@ func TestCRDs(t *testing.T) {
 				Name: "crdsfoo/bar/baz.yaml",
 				Data: []byte("hello"),
 			},
+			{
+				Name: "crds/README.md",
+				Data: []byte("# hello"),
+			},
 		},
 	}