-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: removed additional YAML document header when rendering CRDs #12960
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: shruti2522 <shruti.apc01@gmail.com>
Thanks for the PR! Can we include a test please (to prevent regression of this behavior in the future). Otherwise I agree with the approch in this PR -- the existing separator in the file needs to be removed if it exists, as Helm is adding its own (and if Helm didn't add it's own, yaml files without seperators would be rendered to stdout without yaml seperators, which also breaks other tools) For additional context, I'm sure there was an issue/PR recently which fixed that last point. But I don't immediately see it in the git history. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpicks
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, string(crdFileData)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", crd.Filename, string(crdFileData)) | |
fmt.Fprintf(b, "---\n# Source: %s\n%s\n", crd.Filename, crdFileData) |
} else { | ||
err = writeToFile(outputDir, crd.Filename, string(crd.File.Data[:]), fileWritten[crd.Filename]) | ||
err = writeToFile(outputDir, crd.Filename, string(crdFileData), fileWritten[crd.Filename]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = writeToFile(outputDir, crd.Filename, string(crdFileData), fileWritten[crd.Filename]) | |
err = writeToFile(outputDir, crd.Filename, crdFileData, fileWritten[crd.Filename]) |
What this PR does / why we need it:
Fixes #12953. I have modified the way CRD file data is rendered so that no additional headers are generated in the stdout.
Output before:
Output after: