-
Notifications
You must be signed in to change notification settings - Fork 167
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
tk export
produces wrapped lines
#607
Comments
I can remember a few discussions about yaml.v2/v3 but I can't recall what implications that may have. @sh0rez might have more context. |
Hey, it's been a month. I'm happy to get a PR going to fix this particular issue, let me know if you have any opinions on the approach to take. |
To be noted that this causes a massive amount of indent changes. The kustomize Kubernetes team has the same issue with go-yaml. They have their own fork that allows to customize the indents (reducing the migration impact). This issue has been updated semi-recently so it might be good to see what comes of it: go-yaml/yaml#720 before forcing a massive YAML update on users. Also, it does seem like |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Will you consider using the aforementioned |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hey folks 👋 |
Perhaps it would be more beneficial to poke upstream to fix the issue? |
Tanka is now on v3 and I can no longer reproduce this issue 🙂 |
Tanka's definition
produces
Reproduced on other resources as well. |
You are absolutely right ... now I wonder why I couldn't reproduce it before. |
Looks like that's a problem with gopkg.in/yaml.v2 v2.4.0. It was "fixed" before but since it introduces a behavioral change, it got reverted and is now only fixed in v3 🙁 Unfortunately that's also consistent with how sigs.k8s.io/yaml marshals things. |
Maybe we will only be able to fix that once we are able to upgrade to yaml.v3 everywhere. Let's put it this way: This has been on our wishlist for a while... |
I open exported yamls in Visual Studio Code. And TBH, example with container didn't show errors.
But I was afraid of my Traefik Ingress Route:
which produces
Maybe because of that, but Kubernetes took that yaml without complains and fixed it a little (added
In the end this is not urgent issue to me. For now at least.
That would be great. Thank you. |
Ahhhhh, looks like in YAML linebreaks in list-item values are ignored... So your initial example output spec:
containers:
- args:
- start aaaaa bbbbb ccccc ddddd eeeee fffff ggggg hhhhh iiiii jjjjj kkkkk
mmmmm nnnnn
image: quay.io/keycloak/keycloak is valid and the arg contains everything including As far as I can tell, as long as you are not trying to parse the produced YAML with something that does not support this language "feature", then you should be good to go also in your Traefik example 🙂 |
tk export
sometimes produces invalid Kubernetes manifests due to wrapping of long lines. Most fields where long lines might exist are resistant to\n
in their values, but some fields are not.This is a sample file where we can see the line wrapping occurring:
tk export output environments/default/main.jsonnet
produces the following (notice thek
annotation):In our particular use-case, we're using tanka to generate helm charts, and so some values are actually Helm templating, e.g.:
The output of this snippet makes helm templating fail because it breaks the
{{ }}
markers into different lines.This has been a known surprising behavior of go-yaml.v2 for quite some time, so much so that
v3
changed to not wrap long lines by default.I tried this patch locally and it fixes the issue, but I don't know if it will have unintended side-effects elsewhere:
Another option would be to use
yaml.v2
'sFutureLineWrap()
to disable line wrapping, if you're not in a place where you can migrate tov3
.The text was updated successfully, but these errors were encountered: