pull/32683/merge
胡玮文 2 days ago committed by GitHub
commit a9434d2def
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -270,15 +270,23 @@ func splitAndDeannotate(postrendered, fallbackPrefix string) (map[string]string,
return reconstructed, nil return reconstructed, nil
} }
func appendSourceManifest(b []byte, source, body string) []byte {
// Preserve existing trailing newlines: block scalars may retain them.
// Adding a missing newline can change a scalar's value, but document
// separators require a line break and Kubernetes' YAMLOrJSONDecoder
// also adds one to an unterminated final line.
return fmt.Appendf(b, "---\n# Source: %s\n%s\n", source, strings.TrimSuffix(body, "\n"))
}
// renderResources renders the templates in a chart // renderResources renders the templates in a chart
// //
// TODO: This function is badly in need of a refactor. // TODO: This function is badly in need of a refactor.
// TODO: As part of the refactor the duplicate code in cmd/helm/template.go should be removed // TODO: As part of the refactor the duplicate code in cmd/helm/template.go should be removed
// //
// This code has to do with writing files to disk. // This code has to do with writing files to disk.
func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart, values common.Values, releaseName, outputDir string, subNotes, useReleaseName, includeCrds bool, pr postrenderer.PostRenderer, interactWithRemote, enableDNS, hideSecret bool, postRenderStrategy PostRenderStrategy) ([]*release.Hook, *bytes.Buffer, string, error) { func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart, values common.Values, releaseName, outputDir string, subNotes, useReleaseName, includeCrds bool, pr postrenderer.PostRenderer, interactWithRemote, enableDNS, hideSecret bool, postRenderStrategy PostRenderStrategy) ([]*release.Hook, []byte, string, error) {
var hs []*release.Hook var hs []*release.Hook
b := bytes.NewBuffer(nil) var b []byte
caps, err := cfg.getCapabilities() caps, err := cfg.getCapabilities()
if err != nil { if err != nil {
@ -355,7 +363,7 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart,
if strings.TrimSpace(content) == "" { if strings.TrimSpace(content) == "" {
continue continue
} }
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", name, content) b = appendSourceManifest(b, name, content)
} }
return hs, b, "", err return hs, b, "", err
} }
@ -473,7 +481,7 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart,
if strings.TrimSpace(content) == "" { if strings.TrimSpace(content) == "" {
continue continue
} }
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", name, content) b = appendSourceManifest(b, name, content)
} }
return hs, b, "", err return hs, b, "", err
} }
@ -484,7 +492,7 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart,
if includeCrds { if includeCrds {
for _, crd := range ch.CRDObjects() { for _, crd := range ch.CRDObjects() {
if outputDir == "" { if outputDir == "" {
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", crd.Filename, string(crd.File.Data)) b = appendSourceManifest(b, crd.Filename, string(crd.File.Data))
} else { } else {
err = writeToFile(outputDir, crd.Filename, string(crd.File.Data), fileWritten[crd.Filename]) err = writeToFile(outputDir, crd.Filename, string(crd.File.Data), fileWritten[crd.Filename])
if err != nil { if err != nil {
@ -498,9 +506,9 @@ func (cfg *Configuration) renderResources(ctx context.Context, ch *chart.Chart,
for _, m := range manifests { for _, m := range manifests {
if outputDir == "" { if outputDir == "" {
if hideSecret && m.Head.Kind == "Secret" && m.Head.Version == "v1" { 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) b = appendSourceManifest(b, m.Name, "# HIDDEN: The Secret output has been suppressed\n")
} else { } else {
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", m.Name, m.Content) b = appendSourceManifest(b, m.Name, m.Content)
} }
} else { } else {
newDir := outputDir newDir := outputDir

@ -22,12 +22,16 @@ import (
"fmt" "fmt"
"io" "io"
"log/slog" "log/slog"
"os"
"path/filepath"
"strings" "strings"
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.yaml.in/yaml/v3"
k8syaml "k8s.io/apimachinery/pkg/util/yaml"
fakeclientset "k8s.io/client-go/kubernetes/fake" fakeclientset "k8s.io/client-go/kubernetes/fake"
"helm.sh/helm/v4/internal/logging" "helm.sh/helm/v4/internal/logging"
@ -1826,15 +1830,12 @@ func TestRenderResources_PostRenderer_Success(t *testing.T) {
expectedBuf := `--- expectedBuf := `---
# Source: yellow/templates/foodpie # Source: yellow/templates/foodpie
foodpie: world foodpie: world
--- ---
# Source: yellow/templates/with-partials # Source: yellow/templates/with-partials
yellow: Earth yellow: Earth
--- ---
# Source: yellow/templates/yellow # Source: yellow/templates/yellow
yellow: world yellow: world
` `
expectedHook := `kind: ConfigMap expectedHook := `kind: ConfigMap
metadata: metadata:
@ -1845,7 +1846,7 @@ data:
name: value name: value
` `
assert.Equal(t, expectedBuf, buf.String()) assert.Equal(t, expectedBuf, string(buf))
assert.Len(t, hooks, 1) assert.Len(t, hooks, 1)
assert.Equal(t, expectedHook, hooks[0].Manifest) assert.Equal(t, expectedHook, hooks[0].Manifest)
} }
@ -1941,22 +1942,19 @@ func TestRenderResources_PostRenderer_Integration(t *testing.T) {
assert.Empty(t, notes) // Notes should be empty for this test assert.Empty(t, notes) // Notes should be empty for this test
// Verify that the post-renderer modifications are present in the output // Verify that the post-renderer modifications are present in the output
output := buf.String() output := string(buf)
expected := `--- expected := `---
# Source: hello/templates/goodbye # Source: hello/templates/goodbye
goodbye: world goodbye: world
color: blue color: blue
--- ---
# Source: hello/templates/hello # Source: hello/templates/hello
hello: world hello: world
color: blue color: blue
--- ---
# Source: hello/templates/with-partials # Source: hello/templates/with-partials
hello: Earth hello: Earth
color: blue color: blue
` `
assert.Contains(t, output, "color: blue") assert.Contains(t, output, "color: blue")
assert.Equal(t, 3, strings.Count(output, "color: blue")) assert.Equal(t, 3, strings.Count(output, "color: blue"))
@ -2036,8 +2034,8 @@ spec:
require.NoError(t, err) require.NoError(t, err)
assert.Len(t, hooks, 1) assert.Len(t, hooks, 1)
assert.Equal(t, "my-app", hooks[0].Name) assert.Equal(t, "my-app", hooks[0].Name)
assert.Contains(t, buf.String(), "kind: Deployment") assert.Contains(t, string(buf), "kind: Deployment")
assert.Contains(t, buf.String(), "kind: ServiceAccount") assert.Contains(t, string(buf), "kind: ServiceAccount")
} }
func TestRenderResources_PostRenderer_CombinedInvokesOnceWithEverything(t *testing.T) { func TestRenderResources_PostRenderer_CombinedInvokesOnceWithEverything(t *testing.T) {
@ -2221,7 +2219,7 @@ metadata:
// Hooks still round-trip through the release so they can execute. // Hooks still round-trip through the release so they can execute.
require.Len(t, hooks, 1) require.Len(t, hooks, 1)
assert.Contains(t, hooks[0].Manifest, "hook-cm") assert.Contains(t, hooks[0].Manifest, "hook-cm")
assert.Contains(t, manifestDoc.String(), "template-cm") assert.Contains(t, string(manifestDoc), "template-cm")
} }
func TestRenderResources_PostRenderer_NoHooksWithOnlyHooks(t *testing.T) { func TestRenderResources_PostRenderer_NoHooksWithOnlyHooks(t *testing.T) {
@ -2276,6 +2274,74 @@ metadata:
assert.ErrorContains(t, err, "bogus") assert.ErrorContains(t, err, "bogus")
} }
func TestRenderResources_BlockScalarChomping(t *testing.T) {
tests := []struct {
name string
indicator string
value string
wantNewlines [3]int // indexed by the number of authored trailing newlines
}{
{"literal_clip", "|", "line1\nline2", [3]int{1, 1, 1}},
{"literal_strip", "|-", "line1\nline2", [3]int{0, 0, 0}},
{"literal_keep", "|+", "line1\nline2", [3]int{1, 1, 2}},
{"folded_clip", ">", "line1 line2", [3]int{1, 1, 1}},
{"folded_strip", ">-", "line1 line2", [3]int{0, 0, 0}},
{"folded_keep", ">+", "line1 line2", [3]int{1, 1, 2}},
}
for _, tc := range tests {
for trailing := range 3 {
for _, output := range []string{"buffer", "output-dir"} {
t.Run(fmt.Sprintf("%s/%d_newlines/%s", tc.name, trailing, output), func(t *testing.T) {
var files []*common.File
var wantOutput strings.Builder
for _, name := range []string{"first", "last"} {
body := fmt.Sprintf("apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: %s\ndata:\n cfg: %s\n line1\n line2", name, tc.indicator)
path := "templates/" + name + ".yaml"
files = append(files, &common.File{Name: path, Data: []byte(body + strings.Repeat("\n", trailing))})
fmt.Fprintf(&wantOutput, "---\n# Source: hello/%s\n%s%s", path, body, strings.Repeat("\n", max(1, trailing)))
}
outputDir := ""
if output == "output-dir" {
outputDir = t.TempDir()
}
cfg := actionConfigFixture(t)
_, rendered, _, err := cfg.renderResources(
t.Context(), buildChartWithTemplates(files), nil, "test-release", outputDir, false, false, false,
nil, false, false, false, PostRenderStrategyCombined,
)
require.NoError(t, err)
if outputDir != "" {
assert.Empty(t, rendered)
for _, file := range files {
data, err := os.ReadFile(filepath.Join(outputDir, "hello", file.Name))
require.NoError(t, err)
rendered = append(rendered, data...)
}
}
assert.Equal(t, wantOutput.String(), string(rendered))
var cm struct {
Data map[string]string `json:"data" yaml:"data"`
}
wantValue := tc.value + strings.Repeat("\n", tc.wantNewlines[trailing])
// Kubernetes also normalizes a missing newline in a standalone document.
require.NoError(t, k8syaml.NewYAMLOrJSONDecoder(bytes.NewReader(files[0].Data), 4096).Decode(&cm))
assert.Equal(t, wantValue, cm.Data["cfg"])
// Decode the whole stream without Kubernetes' implicit EOF newline.
decoder := yaml.NewDecoder(bytes.NewReader(rendered))
for range 2 {
require.NoError(t, decoder.Decode(&cm))
assert.Equal(t, wantValue, cm.Data["cfg"])
}
require.ErrorIs(t, decoder.Decode(&cm), io.EOF)
})
}
}
}
}
func TestDetermineReleaseSSAApplyMethod(t *testing.T) { func TestDetermineReleaseSSAApplyMethod(t *testing.T) {
assert.Equal(t, release.ApplyMethodClientSideApply, determineReleaseSSApplyMethod(false)) assert.Equal(t, release.ApplyMethodClientSideApply, determineReleaseSSApplyMethod(false))
assert.Equal(t, release.ApplyMethodServerSideApply, determineReleaseSSApplyMethod(true)) assert.Equal(t, release.ApplyMethodServerSideApply, determineReleaseSSApplyMethod(true))

@ -374,12 +374,10 @@ func (i *Install) RunWithContext(ctx context.Context, ch ci.Charter, vals map[st
rel := i.createRelease(chrt, vals, i.Labels) rel := i.createRelease(chrt, vals, i.Labels)
var manifestDoc *bytes.Buffer var manifest []byte
rel.Hooks, manifestDoc, rel.Info.Notes, err = i.cfg.renderResources(ctx, chrt, valuesToRender, i.ReleaseName, i.OutputDir, i.SubNotes, i.UseReleaseName, i.IncludeCRDs, i.PostRenderer, interactWithServer(i.DryRunStrategy), i.EnableDNS, i.HideSecret, i.PostRenderStrategy) rel.Hooks, manifest, rel.Info.Notes, err = i.cfg.renderResources(ctx, chrt, valuesToRender, i.ReleaseName, i.OutputDir, i.SubNotes, i.UseReleaseName, i.IncludeCRDs, i.PostRenderer, interactWithServer(i.DryRunStrategy), i.EnableDNS, i.HideSecret, i.PostRenderStrategy)
// Even for errors, attach this if available // Even for errors, attach this if available
if manifestDoc != nil { rel.Manifest = string(manifest)
rel.Manifest = manifestDoc.String()
}
// Check error from render // Check error from render
if err != nil { if err != nil {
rel.SetStatus(rcommon.StatusFailed, "failed to render resource: "+err.Error()) rel.SetStatus(rcommon.StatusFailed, "failed to render resource: "+err.Error())
@ -391,7 +389,7 @@ func (i *Install) RunWithContext(ctx context.Context, ch ci.Charter, vals map[st
rel.SetStatus(rcommon.StatusPendingInstall, "Initial install underway") rel.SetStatus(rcommon.StatusPendingInstall, "Initial install underway")
var toBeAdopted kube.ResourceList var toBeAdopted kube.ResourceList
resources, err := i.cfg.KubeClient.Build(bytes.NewBufferString(rel.Manifest), !i.DisableOpenAPIValidation) resources, err := i.cfg.KubeClient.Build(bytes.NewReader(manifest), !i.DisableOpenAPIValidation)
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to build kubernetes objects from release manifest: %w", err) return nil, fmt.Errorf("unable to build kubernetes objects from release manifest: %w", err)
} }
@ -732,7 +730,7 @@ func writeToFile(outputDir, name, data string, appendData bool) error {
defer f.Close() defer f.Close()
_, err = fmt.Fprintf(f, "---\n# Source: %s\n%s\n", name, data) _, err = fmt.Fprintf(f, "---\n# Source: %s\n%s\n", name, strings.TrimSuffix(data, "\n"))
if err != nil { if err != nil {
return err return err
} }

@ -9,7 +9,6 @@ rules:
resources: ["pods", "pods/exec", "pods/log"] resources: ["pods", "pods/exec", "pods/log"]
verbs: ["*"] verbs: ["*"]
--- ---
# Source: hello/templates/rbac # Source: hello/templates/rbac
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -25,4 +24,3 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: schedule-agents name: schedule-agents
namespace: spaced namespace: spaced

@ -299,7 +299,7 @@ func (u *Upgrade) prepareUpgrade(ctx context.Context, name string, chart *chartv
return nil, nil, false, err return nil, nil, false, err
} }
hooks, manifestDoc, notesTxt, err := u.cfg.renderResources(ctx, chart, valuesToRender, "", "", u.SubNotes, false, false, u.PostRenderer, interactWithServer(u.DryRunStrategy), u.EnableDNS, u.HideSecret, u.PostRenderStrategy) hooks, manifest, notesTxt, err := u.cfg.renderResources(ctx, chart, valuesToRender, "", "", u.SubNotes, false, false, u.PostRenderer, interactWithServer(u.DryRunStrategy), u.EnableDNS, u.HideSecret, u.PostRenderStrategy)
if err != nil { if err != nil {
return nil, nil, false, err return nil, nil, false, err
} }
@ -328,7 +328,7 @@ func (u *Upgrade) prepareUpgrade(ctx context.Context, name string, chart *chartv
Description: "Preparing upgrade", // This should be overwritten later. Description: "Preparing upgrade", // This should be overwritten later.
}, },
Version: revision, Version: revision,
Manifest: manifestDoc.String(), Manifest: string(manifest),
Hooks: hooks, Hooks: hooks,
Labels: mergeCustomLabels(lastRelease.Labels, u.Labels), Labels: mergeCustomLabels(lastRelease.Labels, u.Labels),
ApplyMethod: string(determineReleaseSSApplyMethod(serverSideApply)), ApplyMethod: string(determineReleaseSSApplyMethod(serverSideApply)),
@ -337,7 +337,7 @@ func (u *Upgrade) prepareUpgrade(ctx context.Context, name string, chart *chartv
if notesTxt != "" { if notesTxt != "" {
upgradedRelease.Info.Notes = notesTxt upgradedRelease.Info.Notes = notesTxt
} }
err = validateManifest(u.cfg.KubeClient, manifestDoc.Bytes(), !u.DisableOpenAPIValidation) err = validateManifest(u.cfg.KubeClient, manifest, !u.DisableOpenAPIValidation)
return currentRelease, upgradedRelease, serverSideApply, err return currentRelease, upgradedRelease, serverSideApply, err
} }

@ -17,7 +17,6 @@ limitations under the License.
package cmd package cmd
import ( import (
"bytes"
"errors" "errors"
"fmt" "fmt"
"io" "io"
@ -118,8 +117,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
// We ignore a potential error here because, when the --debug flag was specified, // We ignore a potential error here because, when the --debug flag was specified,
// we always want to print the YAML, even if it is not valid. The error is still returned afterwards. // we always want to print the YAML, even if it is not valid. The error is still returned afterwards.
if rel != nil { if rel != nil {
var manifests bytes.Buffer manifests := []byte(rel.Manifest)
fmt.Fprintln(&manifests, strings.TrimSpace(rel.Manifest))
if !client.DisableHooks { if !client.DisableHooks {
fileWritten := make(map[string]bool) fileWritten := make(map[string]bool)
for _, m := range rel.Hooks { for _, m := range rel.Hooks {
@ -127,7 +125,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
continue continue
} }
if client.OutputDir == "" { if client.OutputDir == "" {
fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", m.Path, m.Manifest) manifests = fmt.Appendf(manifests, "---\n# Source: %s\n%s\n", m.Path, strings.TrimSuffix(m.Manifest, "\n"))
} else { } else {
newDir := client.OutputDir newDir := client.OutputDir
if client.UseReleaseName { if client.UseReleaseName {
@ -151,7 +149,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
if len(showFiles) > 0 { if len(showFiles) > 0 {
// This is necessary to ensure consistent manifest ordering when using --show-only // This is necessary to ensure consistent manifest ordering when using --show-only
// with globs or directory names. // with globs or directory names.
splitManifests := releaseutil.SplitManifests(manifests.String()) splitManifests := releaseutil.SplitManifests(string(manifests))
manifestsKeys := make([]string, 0, len(splitManifests)) manifestsKeys := make([]string, 0, len(splitManifests))
for k := range splitManifests { for k := range splitManifests {
manifestsKeys = append(manifestsKeys, k) manifestsKeys = append(manifestsKeys, k)
@ -195,10 +193,10 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
} }
} }
for _, m := range manifestsToRender { for _, m := range manifestsToRender {
fmt.Fprintf(out, "---\n%s\n", m) fmt.Fprintf(out, "---\n%s\n", strings.TrimSuffix(m, "\n"))
} }
} else { } else {
fmt.Fprintf(out, "%s", manifests.String()) out.Write(manifests)
} }
} }
@ -253,7 +251,7 @@ func writeToFile(outputDir, name, data string, appendData bool) error {
defer f.Close() defer f.Close()
_, err = fmt.Fprintf(f, "---\n# Source: %s\n%s\n", name, data) _, err = fmt.Fprintf(f, "---\n# Source: %s\n%s\n", name, strings.TrimSuffix(data, "\n"))
if err != nil { if err != nil {
return err return err
} }

@ -20,12 +20,17 @@ import (
"fmt" "fmt"
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/stretchr/testify/require"
"helm.sh/helm/v4/internal/test"
) )
var chartPath = "testdata/testcharts/subchart" var chartPath = "testdata/testcharts/subchart"
func TestTemplateCmd(t *testing.T) { func TestTemplateCmd(t *testing.T) {
deletevalchart := "testdata/testcharts/issue-9027" deletevalchart := "testdata/testcharts/issue-9027"
newlinesChart := "testdata/testcharts/trailing-newlines"
tests := []cmdTestCase{ tests := []cmdTestCase{
{ {
@ -172,10 +177,66 @@ func TestTemplateCmd(t *testing.T) {
cmd: fmt.Sprintf("template '%s' -f %s/extra_values.yaml", chartPath, chartPath), cmd: fmt.Sprintf("template '%s' -f %s/extra_values.yaml", chartPath, chartPath),
golden: "output/template-subchart-cm-set-file.txt", golden: "output/template-subchart-cm-set-file.txt",
}, },
{
name: "trailing newlines",
cmd: fmt.Sprintf("template '%s'", newlinesChart),
golden: "output/template-newlines.txt",
},
{
name: "trailing newlines without hooks",
cmd: fmt.Sprintf("template '%s' --no-hooks", newlinesChart),
golden: "output/template-newlines-no-hooks.txt",
},
{
name: "trailing newlines with reversed show-only order",
cmd: fmt.Sprintf("template '%s' --show-only templates/hooks.yaml --show-only templates/00-no-newline-hook.yaml --show-only templates/regular.yaml --show-only templates/00-no-newline.yaml", newlinesChart),
golden: "output/template-newlines-reversed.txt",
},
{
name: "trailing newlines with show-only regular manifests",
cmd: fmt.Sprintf("template '%s' --show-only templates/regular.yaml", newlinesChart),
golden: "output/template-newlines-regular.txt",
},
{
name: "trailing newlines with show-only hooks",
cmd: fmt.Sprintf("template '%s' --show-only templates/hooks.yaml", newlinesChart),
golden: "output/template-newlines-hooks.txt",
},
{
name: "missing final newline with show-only",
cmd: fmt.Sprintf("template '%s' --show-only templates/00-no-newline.yaml", newlinesChart),
golden: "output/template-newlines-no-newline.txt",
},
{
name: "missing final newline with show-only hook",
cmd: fmt.Sprintf("template '%s' --show-only templates/00-no-newline-hook.yaml", newlinesChart),
golden: "output/template-newlines-no-newline-hook.txt",
},
} }
runTestCmd(t, tests) runTestCmd(t, tests)
} }
func TestTemplateCmdOutputDir(t *testing.T) {
t.Cleanup(resetEnv())
outputDir := t.TempDir()
_, _, err := executeActionCommand(fmt.Sprintf("template testdata/testcharts/trailing-newlines --output-dir %q", outputDir))
require.NoError(t, err)
for _, tc := range []struct {
file string
golden string
}{
{"regular.yaml", "output/template-newlines-regular.txt"},
{"hooks.yaml", "output/template-newlines-hooks.txt"},
{"00-no-newline.yaml", "output/template-newlines-no-newline.txt"},
{"00-no-newline-hook.yaml", "output/template-newlines-no-newline-hook.txt"},
} {
t.Run(tc.file, func(t *testing.T) {
test.AssertGoldenFile(t, filepath.Join(outputDir, "trailing-newlines", "templates", tc.file), tc.golden)
})
}
}
func TestTemplateVersionCompletion(t *testing.T) { func TestTemplateVersionCompletion(t *testing.T) {
repoFile := "testdata/helmhome/helm/repositories.yaml" repoFile := "testdata/helmhome/helm/repositories.yaml"
repoCache := "testdata/helmhome/helm/repository" repoCache := "testdata/helmhome/helm/repository"

@ -19,4 +19,3 @@ metadata:
data: data:
foo: bar foo: bar

@ -15,7 +15,6 @@ metadata:
name: test-secret name: test-secret
stringData: stringData:
foo: bar foo: bar
--- ---
# Source: chart-with-secret/templates/configmap.yaml # Source: chart-with-secret/templates/configmap.yaml
apiVersion: v1 apiVersion: v1
@ -25,4 +24,3 @@ metadata:
data: data:
foo: bar foo: bar

@ -15,7 +15,6 @@ hash:
key4: 4 key4: 4
key5: 5 key5: 5
key6: 6 key6: 6
--- ---
# Source: issue-9027/templates/values.yaml # Source: issue-9027/templates/values.yaml
global: global:

@ -11,7 +11,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/01-a.yml # Source: object-order/templates/01-a.yml
# 2 # 2
@ -25,7 +24,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/01-a.yml # Source: object-order/templates/01-a.yml
# 3 # 3
@ -39,7 +37,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 5 # 5
@ -53,7 +50,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 7 # 7
@ -67,7 +63,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 8 # 8
@ -81,7 +76,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 9 # 9
@ -95,7 +89,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 10 # 10
@ -109,7 +102,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 11 # 11
@ -123,7 +115,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 12 # 12
@ -137,7 +128,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 13 # 13
@ -151,7 +141,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 14 # 14
@ -165,7 +154,6 @@ spec:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/02-b.yml # Source: object-order/templates/02-b.yml
# 15 (11th object within 02-b.yml, in order to test `SplitManifests` which assigns `manifest-10` # 15 (11th object within 02-b.yml, in order to test `SplitManifests` which assigns `manifest-10`
@ -179,7 +167,6 @@ spec:
policyTypes: policyTypes:
- Egress - Egress
- Ingress - Ingress
--- ---
# Source: object-order/templates/01-a.yml # Source: object-order/templates/01-a.yml
# 4 (Deployment should come after all NetworkPolicy manifests, since 'helm template' outputs in install order) # 4 (Deployment should come after all NetworkPolicy manifests, since 'helm template' outputs in install order)
@ -215,4 +202,3 @@ spec:
- Egress - Egress
- Ingress - Ingress

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/role.yaml # Source: subchart/templates/subdir/role.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -15,7 +14,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -30,7 +28,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -48,7 +45,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -66,7 +62,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -98,7 +93,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -118,4 +112,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -0,0 +1,25 @@
---
# Source: trailing-newlines/templates/hooks.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-one-newline
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/hooks.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-two-newlines
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2

@ -0,0 +1,31 @@
---
# Source: trailing-newlines/templates/00-no-newline.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-no-newline
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/regular.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-one-newline
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/regular.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-two-newlines
data:
cfg: |+
line1
line2

@ -0,0 +1,12 @@
---
# Source: trailing-newlines/templates/00-no-newline-hook.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-no-newline
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2

@ -0,0 +1,10 @@
---
# Source: trailing-newlines/templates/00-no-newline.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-no-newline
data:
cfg: |+
line1
line2

@ -0,0 +1,21 @@
---
# Source: trailing-newlines/templates/regular.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-one-newline
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/regular.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-two-newlines
data:
cfg: |+
line1
line2

@ -0,0 +1,68 @@
---
# Source: trailing-newlines/templates/hooks.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-one-newline
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/hooks.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-two-newlines
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/00-no-newline-hook.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-no-newline
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/regular.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-one-newline
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/regular.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-two-newlines
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/00-no-newline.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-no-newline
data:
cfg: |+
line1
line2

@ -0,0 +1,68 @@
---
# Source: trailing-newlines/templates/00-no-newline.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-no-newline
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/regular.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-one-newline
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/regular.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-two-newlines
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/00-no-newline-hook.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-no-newline
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/hooks.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-one-newline
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2
---
# Source: trailing-newlines/templates/hooks.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-two-newlines
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/role.yaml # Source: subchart/templates/subdir/role.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -15,7 +14,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -30,7 +28,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -48,7 +45,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -66,7 +62,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -98,7 +93,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -118,4 +112,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -8,8 +8,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -24,5 +22,3 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default

@ -19,7 +19,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchart app.kubernetes.io/name: subchart
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -37,5 +36,3 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta

@ -19,4 +19,3 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchart app.kubernetes.io/name: subchart

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/role.yaml # Source: subchart/templates/subdir/role.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -15,7 +14,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -30,7 +28,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -48,7 +45,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -66,7 +62,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/configmap.yaml # Source: subchart/templates/subdir/configmap.yaml
apiVersion: v1 apiVersion: v1
@ -23,7 +22,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -38,7 +36,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -56,7 +53,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -74,7 +70,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -106,7 +101,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -126,4 +120,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/configmap.yaml # Source: subchart/templates/subdir/configmap.yaml
apiVersion: v1 apiVersion: v1
@ -23,7 +22,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -38,7 +36,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -56,7 +53,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -74,7 +70,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -106,7 +101,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -126,4 +120,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/configmap.yaml # Source: subchart/templates/subdir/configmap.yaml
apiVersion: v1 apiVersion: v1
@ -23,7 +22,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -38,7 +36,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -56,7 +53,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -74,7 +70,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -106,7 +101,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -126,4 +120,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/role.yaml # Source: subchart/templates/subdir/role.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -15,7 +14,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -30,7 +28,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -48,7 +45,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -66,7 +62,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -98,7 +93,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -118,4 +112,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/role.yaml # Source: subchart/templates/subdir/role.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -15,7 +14,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -30,7 +28,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -48,7 +45,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -66,7 +62,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -100,7 +95,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -120,4 +114,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -14,14 +14,12 @@ spec:
shortNames: shortNames:
- tc - tc
singular: authconfig singular: authconfig
--- ---
# Source: subchart/templates/subdir/serviceaccount.yaml # Source: subchart/templates/subdir/serviceaccount.yaml
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/role.yaml # Source: subchart/templates/subdir/role.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -32,7 +30,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -47,7 +44,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -65,7 +61,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -83,7 +78,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -115,7 +109,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -135,4 +128,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/role.yaml # Source: subchart/templates/subdir/role.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -15,7 +14,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -30,7 +28,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -48,7 +45,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -66,7 +62,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -98,7 +93,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -118,4 +112,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -4,7 +4,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: subchart-sa name: subchart-sa
--- ---
# Source: subchart/templates/subdir/role.yaml # Source: subchart/templates/subdir/role.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -15,7 +14,6 @@ rules:
- apiGroups: [""] - apiGroups: [""]
resources: ["pods"] resources: ["pods"]
verbs: ["get","list","watch"] verbs: ["get","list","watch"]
--- ---
# Source: subchart/templates/subdir/rolebinding.yaml # Source: subchart/templates/subdir/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
@ -30,7 +28,6 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: subchart-sa name: subchart-sa
namespace: default namespace: default
--- ---
# Source: subchart/charts/subcharta/templates/service.yaml # Source: subchart/charts/subcharta/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -48,7 +45,6 @@ spec:
name: apache name: apache
selector: selector:
app.kubernetes.io/name: subcharta app.kubernetes.io/name: subcharta
--- ---
# Source: subchart/charts/subchartb/templates/service.yaml # Source: subchart/charts/subchartb/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -66,7 +62,6 @@ spec:
name: nginx name: nginx
selector: selector:
app.kubernetes.io/name: subchartb app.kubernetes.io/name: subchartb
--- ---
# Source: subchart/templates/service.yaml # Source: subchart/templates/service.yaml
apiVersion: v1 apiVersion: v1
@ -98,7 +93,6 @@ metadata:
"helm.sh/hook": test "helm.sh/hook": test
data: data:
message: Hello World message: Hello World
--- ---
# Source: subchart/templates/tests/test-nothing.yaml # Source: subchart/templates/tests/test-nothing.yaml
apiVersion: v1 apiVersion: v1
@ -118,4 +112,3 @@ spec:
- echo - echo
- "$message" - "$message"
restartPolicy: Never restartPolicy: Never

@ -0,0 +1,3 @@
apiVersion: v2
name: trailing-newlines
version: 0.1.0

@ -0,0 +1 @@
The `00-no-newline*.yaml` templates intentionally have no final newline. The other templates contain two documents ending in one and two newlines, respectively. Keep chomping (`|+`) makes these newlines part of the ConfigMap value.

@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-no-newline
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2

@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-no-newline
data:
cfg: |+
line1
line2

@ -0,0 +1,22 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-one-newline
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2
---
apiVersion: v1
kind: ConfigMap
metadata:
name: hook-two-newlines
annotations:
helm.sh/hook: pre-install
data:
cfg: |+
line1
line2

@ -0,0 +1,18 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-one-newline
data:
cfg: |+
line1
line2
---
apiVersion: v1
kind: ConfigMap
metadata:
name: regular-two-newlines
data:
cfg: |+
line1
line2
Loading…
Cancel
Save