Skip to content
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

flux seems to struggle with UTF-16 LE encoded files written from Windows PowerShell #1126

Open
stealthybox opened this issue Mar 19, 2021 · 2 comments

Comments

@stealthybox
Copy link
Member

stealthybox commented Mar 19, 2021

In TGIK #149 @ 1h23m kustomize-controller reported failing to decode Kubernetes YAML due to "invalid UTF-16 characters", but in VSCode the file looks to display as a valid YAML file.

Windows PowerShell redirects (echo hi > ./file) write files as UTF-16 LE.

We should write test-cases to ensure that files with reasonable encodings work with our controllers.

This particular case may be unique to kustomize-controller, but we should verify that our other controllers don't also break.


The PowerShell workaround to write UTF-8 files is like so:

echo hello | out-file -encoding utf8 hi.txt

source: https://superuser.com/questions/327492/default-powershell-to-emitting-utf-8-instead-of-utf-16

@stealthybox stealthybox changed the title flux seems to struggle with UTF-16 encoded files written from Windows PowerShell flux seems to struggle with UTF-16 LE encoded files written from Windows PowerShell Mar 20, 2021
@stealthybox
Copy link
Member Author

I am able to reproduce this by adding a UTF-16 LE encoded YAML containing a Kubernetes Service for podinfo to my bootstrap directory:

flux get kustomizations
NAME            READY   MESSAGE                                                                       
                        REVISION                                        SUSPENDED
flux-system     False   kustomize create failed: failed to decode Kubernetes YAML from /tmp/flux-system466986746/clusters/cluster0/default/podinfo-svc.yaml: error converting YAML to JSON: yaml: incomplete UTF-16 character       main/ceb3e29fff0e495e17bbc3da6c5d74c80bb7e498   False

@hiddeco
Copy link
Member

hiddeco commented Mar 23, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants