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

Codify fails when the input yaml object names have a dash in it. #45

Closed
fkautz opened this issue Aug 2, 2021 · 6 comments
Closed

Codify fails when the input yaml object names have a dash in it. #45

fkautz opened this issue Aug 2, 2021 · 6 comments

Comments

@fkautz
Copy link
Collaborator

fkautz commented Aug 2, 2021

Took the example stateless app from https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/ and ran it against naml.

[...]
kind: Deployment
metadata:
  name: nginx-deployment
[...]

Ran this through naml:

kubectl get deployments -oyaml | naml c
Error during codify: unable to auto format code: 88:2: expected identifier on left side of :=2021-08-01T18:41:03-07:00 [Critical  ]  unable to auto format code: 88:2: expected identifier on left side of :=

I disabled gofmt to see the actual error and found this:

nginx-deploymentDeployment := &appsv1.Deployment{

We should probably trim illegal characters, though this may in rare circumstances cause a duplicate name. e.g. two deployments on the same system with names nginx-deployment vs nginxdeplolyment

@fkautz
Copy link
Collaborator Author

fkautz commented Aug 2, 2021

Looks like we can safely rename all - characters in k8s object names to _ in go. K8s does not allow _ and go does not allow - in variable names.

@krisnova
Copy link
Owner

krisnova commented Aug 2, 2021

@fkautz
Copy link
Collaborator Author

fkautz commented Aug 2, 2021

working on it :)

@fkautz
Copy link
Collaborator Author

fkautz commented Aug 2, 2021

#46

@fkautz
Copy link
Collaborator Author

fkautz commented Aug 3, 2021

fixed in #46

@fkautz fkautz closed this as completed Aug 3, 2021
@krisnova
Copy link
Owner

krisnova commented Aug 3, 2021

closed with #46
released binaries with the patch https://github.com/kris-nova/naml/releases/tag/0.2.4

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