diff --git a/pkg/action/action.go b/pkg/action/action.go index bcc91816c..0ac7a4ad3 100644 --- a/pkg/action/action.go +++ b/pkg/action/action.go @@ -270,6 +270,14 @@ func splitAndDeannotate(postrendered, fallbackPrefix string) (map[string]string, return reconstructed, nil } +// writeSourceManifest writes a YAML document with a --- separator and source +// comment. One trailing newline is trimmed from content so the format's final +// \n does not create a blank line before the next --- (issue 32565). Extra +// trailing newlines, such as those required by YAML |+ chomping, are kept. +func writeSourceManifest(w io.Writer, name, content string) { + fmt.Fprintf(w, "---\n# Source: %s\n%s\n", name, strings.TrimSuffix(content, "\n")) +} + // renderResources renders the templates in a chart // // TODO: This function is badly in need of a refactor. @@ -355,7 +363,7 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart, if strings.TrimSpace(content) == "" { continue } - fmt.Fprintf(b, "---\n# Source: %s\n%s\n", name, content) + writeSourceManifest(b, name, content) } return hs, b, "", err } @@ -473,7 +481,7 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart, if strings.TrimSpace(content) == "" { continue } - fmt.Fprintf(b, "---\n# Source: %s\n%s\n", name, content) + writeSourceManifest(b, name, content) } return hs, b, "", err } @@ -484,7 +492,7 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart, if includeCrds { for _, crd := range ch.CRDObjects() { if outputDir == "" { - fmt.Fprintf(b, "---\n# Source: %s\n%s\n", crd.Filename, string(crd.File.Data)) + writeSourceManifest(b, crd.Filename, string(crd.File.Data)) } else { err = writeToFile(outputDir, crd.Filename, string(crd.File.Data), fileWritten[crd.Filename]) if err != nil { @@ -500,7 +508,7 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart, if hideSecret && m.Head.Kind == "Secret" && m.Head.Version == "v1" { fmt.Fprintf(b, "---\n# Source: %s\n# HIDDEN: The Secret output has been suppressed\n", m.Name) } else { - fmt.Fprintf(b, "---\n# Source: %s\n%s\n", m.Name, m.Content) + writeSourceManifest(b, m.Name, m.Content) } } else { newDir := outputDir diff --git a/pkg/action/action_test.go b/pkg/action/action_test.go index 056c539a5..857386efa 100644 --- a/pkg/action/action_test.go +++ b/pkg/action/action_test.go @@ -1826,15 +1826,12 @@ func TestRenderResources_PostRenderer_Success(t *testing.T) { expectedBuf := `--- # Source: yellow/templates/foodpie foodpie: world - --- # Source: yellow/templates/with-partials yellow: Earth - --- # Source: yellow/templates/yellow yellow: world - ` expectedHook := `kind: ConfigMap metadata: @@ -1946,17 +1943,14 @@ func TestRenderResources_PostRenderer_Integration(t *testing.T) { # Source: hello/templates/goodbye goodbye: world color: blue - --- # Source: hello/templates/hello hello: world color: blue - --- # Source: hello/templates/with-partials hello: Earth color: blue - ` assert.Contains(t, output, "color: blue") assert.Equal(t, 3, strings.Count(output, "color: blue")) @@ -1980,6 +1974,50 @@ func TestRenderResources_NoPostRenderer(t *testing.T) { assert.Empty(t, notes) } +func TestRenderResources_StdoutHasNoExtraBlankLineBeforeDocumentSeparator(t *testing.T) { + cfg := actionConfigFixture(t) + modTime := time.Now() + + // Reproduces https://github.com/helm/helm/issues/32565: a template that + // already ends with a newline must not gain a blank line before the next ---. + ch := buildChartWithTemplates([]*common.File{ + {Name: "templates/one.yaml", ModTime: modTime, Data: []byte("apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: one\n")}, + {Name: "templates/two.yaml", ModTime: modTime, Data: []byte("apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: two")}, + }) + + _, buf, _, err := cfg.renderResources( + t.Context(), ch, map[string]any{}, "test-release", "", false, false, false, + nil, false, false, false, PostRenderStrategyCombined, + ) + require.NoError(t, err) + + out := buf.String() + assert.NotContains(t, out, "\n\n---", "helm template stdout must not insert a blank line before ---") + assert.Contains(t, out, "name: one\n---\n") + assert.True(t, strings.HasSuffix(out, "name: two\n"), "final document should end with a single newline") +} + +func TestRenderResources_StdoutPreservesExtraTrailingNewlines(t *testing.T) { + cfg := actionConfigFixture(t) + modTime := time.Now() + + // YAML |+ keep relies on extra trailing newlines surviving in non-final + // documents (issue 32326). Trim only the printer's extra \n, not all of them. + ch := buildChartWithTemplates([]*common.File{ + {Name: "templates/keep.yaml", ModTime: modTime, Data: []byte("apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: keep\ndata:\n key: |+\n hello\n\n\n")}, + {Name: "templates/zlast.yaml", ModTime: modTime, Data: []byte("apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: zlast")}, + }) + + _, buf, _, err := cfg.renderResources( + t.Context(), ch, map[string]any{}, "test-release", "", false, false, false, + nil, false, false, false, PostRenderStrategyCombined, + ) + require.NoError(t, err) + + out := buf.String() + assert.Contains(t, out, " hello\n\n\n---\n", "extra trailing newlines from |+ must be preserved") +} + func TestRenderResources_PostRenderer_DuplicateResourceInHookAndTemplate(t *testing.T) { cfg := actionConfigFixture(t) diff --git a/pkg/cmd/template.go b/pkg/cmd/template.go index 29839b871..769a967ae 100644 --- a/pkg/cmd/template.go +++ b/pkg/cmd/template.go @@ -127,7 +127,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { continue } if client.OutputDir == "" { - fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", m.Path, m.Manifest) + fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", m.Path, strings.TrimSuffix(m.Manifest, "\n")) } else { newDir := client.OutputDir if client.UseReleaseName { @@ -195,7 +195,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { } } for _, m := range manifestsToRender { - fmt.Fprintf(out, "---\n%s\n", m) + fmt.Fprintf(out, "---\n%s\n", strings.TrimSuffix(m, "\n")) } } else { fmt.Fprintf(out, "%s", manifests.String()) diff --git a/pkg/cmd/testdata/output/install-dry-run-with-secret-hidden.txt b/pkg/cmd/testdata/output/install-dry-run-with-secret-hidden.txt index c2219d8c4..eb770967f 100644 --- a/pkg/cmd/testdata/output/install-dry-run-with-secret-hidden.txt +++ b/pkg/cmd/testdata/output/install-dry-run-with-secret-hidden.txt @@ -19,4 +19,3 @@ metadata: data: foo: bar - diff --git a/pkg/cmd/testdata/output/install-dry-run-with-secret.txt b/pkg/cmd/testdata/output/install-dry-run-with-secret.txt index 62bd78018..d22c1437f 100644 --- a/pkg/cmd/testdata/output/install-dry-run-with-secret.txt +++ b/pkg/cmd/testdata/output/install-dry-run-with-secret.txt @@ -15,7 +15,6 @@ metadata: name: test-secret stringData: foo: bar - --- # Source: chart-with-secret/templates/configmap.yaml apiVersion: v1 @@ -25,4 +24,3 @@ metadata: data: foo: bar - diff --git a/pkg/cmd/testdata/output/issue-9027.txt b/pkg/cmd/testdata/output/issue-9027.txt index f43032499..1227336e4 100644 --- a/pkg/cmd/testdata/output/issue-9027.txt +++ b/pkg/cmd/testdata/output/issue-9027.txt @@ -15,7 +15,6 @@ hash: key4: 4 key5: 5 key6: 6 - --- # Source: issue-9027/templates/values.yaml global: diff --git a/pkg/cmd/testdata/output/object-order.txt b/pkg/cmd/testdata/output/object-order.txt index 96e3ba053..985022951 100644 --- a/pkg/cmd/testdata/output/object-order.txt +++ b/pkg/cmd/testdata/output/object-order.txt @@ -11,7 +11,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/01-a.yml # 2 @@ -25,7 +24,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/01-a.yml # 3 @@ -39,7 +37,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 5 @@ -53,7 +50,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 7 @@ -67,7 +63,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 8 @@ -81,7 +76,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 9 @@ -95,7 +89,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 10 @@ -109,7 +102,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 11 @@ -123,7 +115,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 12 @@ -137,7 +128,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 13 @@ -151,7 +141,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 14 @@ -165,7 +154,6 @@ spec: - Egress - Ingress - --- # Source: object-order/templates/02-b.yml # 15 (11th object within 02-b.yml, in order to test `SplitManifests` which assigns `manifest-10` @@ -179,7 +167,6 @@ spec: policyTypes: - Egress - Ingress - --- # Source: object-order/templates/01-a.yml # 4 (Deployment should come after all NetworkPolicy manifests, since 'helm template' outputs in install order) @@ -215,4 +202,3 @@ spec: - Egress - Ingress - diff --git a/pkg/cmd/testdata/output/template-name-template.txt b/pkg/cmd/testdata/output/template-name-template.txt index b1077012e..9406048dd 100644 --- a/pkg/cmd/testdata/output/template-name-template.txt +++ b/pkg/cmd/testdata/output/template-name-template.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/role.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -15,7 +14,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -30,7 +28,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -48,7 +45,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -66,7 +62,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -98,7 +93,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -118,4 +112,3 @@ spec: - echo - "$message" restartPolicy: Never - diff --git a/pkg/cmd/testdata/output/template-set.txt b/pkg/cmd/testdata/output/template-set.txt index 1ecb8707b..4040991cf 100644 --- a/pkg/cmd/testdata/output/template-set.txt +++ b/pkg/cmd/testdata/output/template-set.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/role.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -15,7 +14,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -30,7 +28,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -48,7 +45,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -66,7 +62,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -98,7 +93,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -118,4 +112,3 @@ spec: - echo - "$message" restartPolicy: Never - diff --git a/pkg/cmd/testdata/output/template-show-only-glob.txt b/pkg/cmd/testdata/output/template-show-only-glob.txt index 160f08a06..b2d2b1c2d 100644 --- a/pkg/cmd/testdata/output/template-show-only-glob.txt +++ b/pkg/cmd/testdata/output/template-show-only-glob.txt @@ -8,8 +8,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -24,5 +22,3 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - - diff --git a/pkg/cmd/testdata/output/template-show-only-multiple.txt b/pkg/cmd/testdata/output/template-show-only-multiple.txt index 3f9aa6f2f..1aac3081a 100644 --- a/pkg/cmd/testdata/output/template-show-only-multiple.txt +++ b/pkg/cmd/testdata/output/template-show-only-multiple.txt @@ -19,7 +19,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchart - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -37,5 +36,3 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - - diff --git a/pkg/cmd/testdata/output/template-show-only-one.txt b/pkg/cmd/testdata/output/template-show-only-one.txt index 27a56c03c..9cc34f515 100644 --- a/pkg/cmd/testdata/output/template-show-only-one.txt +++ b/pkg/cmd/testdata/output/template-show-only-one.txt @@ -19,4 +19,3 @@ spec: name: nginx selector: app.kubernetes.io/name: subchart - diff --git a/pkg/cmd/testdata/output/template-skip-tests.txt b/pkg/cmd/testdata/output/template-skip-tests.txt index 4c5af8df3..5c907b563 100644 --- a/pkg/cmd/testdata/output/template-skip-tests.txt +++ b/pkg/cmd/testdata/output/template-skip-tests.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/role.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -15,7 +14,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -30,7 +28,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -48,7 +45,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -66,7 +62,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 diff --git a/pkg/cmd/testdata/output/template-subchart-cm-set-file.txt b/pkg/cmd/testdata/output/template-subchart-cm-set-file.txt index 227d05903..56844e292 100644 --- a/pkg/cmd/testdata/output/template-subchart-cm-set-file.txt +++ b/pkg/cmd/testdata/output/template-subchart-cm-set-file.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/configmap.yaml apiVersion: v1 @@ -23,7 +22,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -38,7 +36,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -56,7 +53,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -74,7 +70,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -106,7 +101,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -126,4 +120,3 @@ spec: - echo - "$message" restartPolicy: Never - diff --git a/pkg/cmd/testdata/output/template-subchart-cm-set.txt b/pkg/cmd/testdata/output/template-subchart-cm-set.txt index dd8be4db9..e52f7c234 100644 --- a/pkg/cmd/testdata/output/template-subchart-cm-set.txt +++ b/pkg/cmd/testdata/output/template-subchart-cm-set.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/configmap.yaml apiVersion: v1 @@ -23,7 +22,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -38,7 +36,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -56,7 +53,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -74,7 +70,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -106,7 +101,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -126,4 +120,3 @@ spec: - echo - "$message" restartPolicy: Never - diff --git a/pkg/cmd/testdata/output/template-subchart-cm.txt b/pkg/cmd/testdata/output/template-subchart-cm.txt index c4600a798..9cc9e2296 100644 --- a/pkg/cmd/testdata/output/template-subchart-cm.txt +++ b/pkg/cmd/testdata/output/template-subchart-cm.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/configmap.yaml apiVersion: v1 @@ -23,7 +22,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -38,7 +36,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -56,7 +53,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -74,7 +70,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -106,7 +101,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -126,4 +120,3 @@ spec: - echo - "$message" restartPolicy: Never - diff --git a/pkg/cmd/testdata/output/template-values-files.txt b/pkg/cmd/testdata/output/template-values-files.txt index 1ecb8707b..4040991cf 100644 --- a/pkg/cmd/testdata/output/template-values-files.txt +++ b/pkg/cmd/testdata/output/template-values-files.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/role.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -15,7 +14,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -30,7 +28,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -48,7 +45,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -66,7 +62,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -98,7 +93,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -118,4 +112,3 @@ spec: - echo - "$message" restartPolicy: Never - diff --git a/pkg/cmd/testdata/output/template-with-api-version.txt b/pkg/cmd/testdata/output/template-with-api-version.txt index ae726e624..8b6074cdb 100644 --- a/pkg/cmd/testdata/output/template-with-api-version.txt +++ b/pkg/cmd/testdata/output/template-with-api-version.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/role.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -15,7 +14,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -30,7 +28,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -48,7 +45,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -66,7 +62,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -100,7 +95,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -120,4 +114,3 @@ spec: - echo - "$message" restartPolicy: Never - diff --git a/pkg/cmd/testdata/output/template-with-crds.txt b/pkg/cmd/testdata/output/template-with-crds.txt index 1d63265ec..a0c78ea12 100644 --- a/pkg/cmd/testdata/output/template-with-crds.txt +++ b/pkg/cmd/testdata/output/template-with-crds.txt @@ -14,14 +14,12 @@ spec: shortNames: - tc singular: authconfig - --- # Source: subchart/templates/subdir/serviceaccount.yaml apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/role.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -32,7 +30,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -47,7 +44,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -65,7 +61,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -83,7 +78,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -115,7 +109,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -135,4 +128,3 @@ spec: - echo - "$message" restartPolicy: Never - diff --git a/pkg/cmd/testdata/output/template-with-kube-version.txt b/pkg/cmd/testdata/output/template-with-kube-version.txt index 2c42e2e84..9d326f328 100644 --- a/pkg/cmd/testdata/output/template-with-kube-version.txt +++ b/pkg/cmd/testdata/output/template-with-kube-version.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/role.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -15,7 +14,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -30,7 +28,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -48,7 +45,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -66,7 +62,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -98,7 +93,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -118,4 +112,3 @@ spec: - echo - "$message" restartPolicy: Never - diff --git a/pkg/cmd/testdata/output/template.txt b/pkg/cmd/testdata/output/template.txt index ddbfebe9d..58c480b47 100644 --- a/pkg/cmd/testdata/output/template.txt +++ b/pkg/cmd/testdata/output/template.txt @@ -4,7 +4,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: subchart-sa - --- # Source: subchart/templates/subdir/role.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -15,7 +14,6 @@ rules: - apiGroups: [""] resources: ["pods"] verbs: ["get","list","watch"] - --- # Source: subchart/templates/subdir/rolebinding.yaml apiVersion: rbac.authorization.k8s.io/v1 @@ -30,7 +28,6 @@ subjects: - kind: ServiceAccount name: subchart-sa namespace: default - --- # Source: subchart/charts/subcharta/templates/service.yaml apiVersion: v1 @@ -48,7 +45,6 @@ spec: name: apache selector: app.kubernetes.io/name: subcharta - --- # Source: subchart/charts/subchartb/templates/service.yaml apiVersion: v1 @@ -66,7 +62,6 @@ spec: name: nginx selector: app.kubernetes.io/name: subchartb - --- # Source: subchart/templates/service.yaml apiVersion: v1 @@ -98,7 +93,6 @@ metadata: "helm.sh/hook": test data: message: Hello World - --- # Source: subchart/templates/tests/test-nothing.yaml apiVersion: v1 @@ -118,4 +112,3 @@ spec: - echo - "$message" restartPolicy: Never -