-
Notifications
You must be signed in to change notification settings - Fork 30
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
Policy Generator is splitting go template functions in yaml scalar strings #55
Comments
@fgharo thank you for reporting this! The issue is not related to the Policy Generator but is a bug with Kustomize: Are you able to make it a multi-line string with If you can't use a multi-line string, you aren't using any of the Kustomize features, and you aren't executing Kustomize as part of the GitHub workflows, you can execute the Policy Generator binary directly with something like: /path/to/PolicyGenerator ./policy-generator-config.yaml This will provide the generated policies without the line breaks. |
@mprahl |
@mprahl
|
@mprahl |
This is expected because the YAML is parsed into a Go data-structure and then converted back to YAML in the generated policy. The output is equivalent it's just not the same style as the input. |
@mprahl Gotcha. Thanks for explaining! |
Version(s):
PolicyGenerator - v1.7.0
ACM - 2.4.3
Description:
The policy generator splits a go template function located in the same input manifest into multiple lines, creating an invalid yaml strings as output. Subsequently, this output can't be pasted into the ACM console -> Governance -> Create Policy -> editor. The editor has a red squiggly line and when I hover over it, it says:
Malformed inline yaml string ('{{ fromConfigMap "default" "logs-config" #57).
Note: The output can still be fed to oc apply -f - and the go template function can still be evaluated so this is a workaround.
Steps to reproduce:
namespace.yaml:
policy-generator-config.yaml:
kustomization.yaml:
Run policy generator with kustomize in the folder with the yaml files.
$ kustomize build --enable-alpha-plugins
The result contains the line breaks like so:
Expected Result:
Extra notes:
For instance when this configmap gets fed into the policy generator it is translated into the subsequent configmap:
before:
after:
For simplicity sake it might be better to focus on the line breaks that are created. And delegate the problem of scalar symbols not being respected to another issue. I would of expected
them to appear in the output as opposed to be replaced by | in some cases.
For instance this configmap doesn't get any line breaks:
before:
after:
Screenshots:
![Screen Shot 2022-06-22 at 6 50 44 PM](https://user-images.githubusercontent.com/3970206/175168336-00bddd9c-bb5f-4064-ba3d-f87fcd0e15f6.png)
The text was updated successfully, but these errors were encountered: