pull/32566/merge
water 14 hours ago committed by GitHub
commit 451acf625e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -355,7 +355,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)
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", name, strings.TrimRight(content, "\n"))
}
return hs, b, "", err
}
@ -473,7 +473,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)
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", name, strings.TrimRight(content, "\n"))
}
return hs, b, "", err
}
@ -484,7 +484,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))
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", crd.Filename, strings.TrimRight(string(crd.File.Data), "\n"))
} else {
err = writeToFile(outputDir, crd.Filename, string(crd.File.Data), fileWritten[crd.Filename])
if err != nil {
@ -500,7 +500,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)
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", m.Name, strings.TrimRight(m.Content, "\n"))
}
} else {
newDir := outputDir

@ -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.TrimRight(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.TrimRight(m, "\n"))
}
} else {
fmt.Fprintf(out, "%s", manifests.String())

Loading…
Cancel
Save