diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 8bab79429..d8480f54f 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -74,7 +74,7 @@ serviceAccount: create: true # The name of the service account to use. # If not set and create is true, a name is generated using the fullname template - name: + name: "" podSecurityContext: {} # fsGroup: 2000 diff --git a/pkg/lint/lint_test.go b/pkg/lint/lint_test.go index 0514f7f6d..acd67adac 100644 --- a/pkg/lint/lint_test.go +++ b/pkg/lint/lint_test.go @@ -17,11 +17,14 @@ limitations under the License. package lint import ( + "io/ioutil" + "os" "strings" + "testing" + "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/lint/support" - - "testing" + "k8s.io/helm/pkg/proto/hapi/chart" ) var values = []byte{} @@ -101,3 +104,36 @@ func TestGoodChart(t *testing.T) { t.Errorf("All failed but shouldn't have: %#v", m) } } + +// TestHelmCreateChart tests that a `helm create` always passes a `helm lint` test. +// +// See https://github.com/helm/helm/issues/7923 +func TestHelmCreateChart(t *testing.T) { + dir, err := ioutil.TempDir("", "-helm-test") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dir) + + cfile := &chart.Metadata{ + Name: "testhelmcreatepasseslint", + Description: "See lint_test.go", + Version: "0.1.0", + AppVersion: "1.0", + ApiVersion: chartutil.ApiVersionV1, + } + + createdChart, err := chartutil.Create(cfile, dir) + if err != nil { + t.Error(err) + // Fatal is bad because of the defer. + return + } + + m := All(createdChart, values, namespace, true).Messages + if ll := len(m); ll != 1 { + t.Errorf("All should have had exactly 1 error. Got %d", ll) + } else if msg := m[0].Err.Error(); !strings.Contains(msg, "icon is recommended") { + t.Errorf("Unexpected lint error: %s", msg) + } +}