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

toToml filter converts int to float #2474

Closed
mattsch opened this issue May 22, 2017 · 11 comments
Closed

toToml filter converts int to float #2474

mattsch opened this issue May 22, 2017 · 11 comments

Comments

@mattsch
Copy link

mattsch commented May 22, 2017

Given the following data structure in values.yaml:

config:
  bar: 9

And this in my configmap template:

data:
  telegraf-local.conf: |-
{{ .Values.config | toToml | indent 4 }}

I get this:

data:
  telegraf-local.conf: |-
    foo = 9.0

Even casting the variable via bar: !!int 9 doesn't change the behavior, can't reproduce using the toJson filter either.

@adamreese adamreese added the bug label May 22, 2017
@technosophos
Copy link
Member

Which version of Helm/Tiller?

@mattsch
Copy link
Author

mattsch commented May 27, 2017 via email

@mlieberman85
Copy link

I'm seeing the same issue with 2.5.0

@copumpkin
Copy link

copumpkin commented Jul 12, 2017

From poking around the code a bit, it seems like the YAML parser Helm is using converts YAML to JSON and then parses that. And although the YAML spec distinguishes between integers and floats, the JSON spec doesn't (as far as I can tell), so the conversion process is lossy. By the time the TOML encoder sees it, it's already a float, so it adds a decimal point to the output.

For reference, the conversion to JSON is happening here: https://github.com/ghodss/yaml/blob/73d445a93680fa1a78ae23a5839bad48f32ba1ee/yaml.go#L98

@bacongobbler
Copy link
Member

related issue: #1707

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@johanfleury
Copy link

johanfleury commented Sep 30, 2019

/reopen
/remove-lifecycle rotten

@bacongobbler
Copy link
Member

Hey @johanfleury, if you could please open a new issue with the version of Helm and Kubernetes you are using as well as a demonstration/reproduction of the issue, that would be great. This issue was opened over two years ago and was likely fixed in #6010, so if you could try and reproduce using the canaries, that'd be great. Thanks!

@dud225
Copy link

dud225 commented Apr 26, 2024

reopened as #12987

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

10 participants