-
Notifications
You must be signed in to change notification settings - Fork 9
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
CP 19442: CloudAccountId must be a string #53
Conversation
I think this is a good solution given the drawbacks of trying to handle it within the chart |
967b101
to
b6cf907
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good
Nice, Great write up! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a changelog request, looks great!
charts/cloudzero-agent/CHANGELOG.md
Outdated
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. | |||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | |||
|
|||
## [0.0.12] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think we're on 0.0.13 technically, we may just be missing the notes from .12. I think the eventual goal plan is to have github actions update this, but for now, would you mind bumping this to 0.13 and adding the release notes for .12 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
@@ -157,7 +157,7 @@ data: | |||
{{- end}} | |||
{{- end}} | |||
remote_write: | |||
- url: 'https://{{ .Values.host }}/v1/container-metrics?cluster_name={{.Values.clusterName}}&cloud_account_id={{.Values.cloudAccountId | toString}}®ion={{.Values.region}}' | |||
- url: 'https://{{ .Values.host }}/v1/container-metrics?cluster_name={{.Values.clusterName | urlquery}}&cloud_account_id={{.Values.cloudAccountId | urlquery}}®ion={{.Values.region | urlquery}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh nice, I didn't know about that function
By submitting a PR to this repository, you agree to the terms within the CloudZero Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
Problem
The issue is with cloudAccountId being a large integer. What happens is, before the cloudAccountId reaches our helm chart, it has changed into scientific notation.
Among others, you can see people discussing the issue here: helm/helm#1707
If cloudAccountId is being passed as an explicit argument, eg.
--set cloudAccountId=123123123123123123123123123123
it works as expected
But when using -f to include a file that has the cloudAccountId, it gets converted to scientific notation.
Alternatives considered
Tried a few approaches that were non ideal.
In helm chart, cast the value to an integer (which works for scientific notation), and then use that value if it's a number > 0, otherwise assume it was a string. See the first commit on this branch for that attempt.
This does not work if either a) the conversion to scientific notation lost precision, eg. 123123123123123123 ends up as like 123123123123123000 . or b) leading zero's are significant, which apparently they are in AWS.
Helm hooks - can't rely on these since customers are likely using tools like argo or spinaker rather than helm
Solution
We must mandate that cloudAccountId is a string. This prevents the issue, and gives the user immediate feedback about the issue.
It might be annoying for customers, but it also feels justifiable. Consider this description from CoPilot (emphasis mine):
Testing
Running command like this:
helm template cz-prom-agent . --set apiKey=$api_key --set clusterName=jonp --set host=dev-api.cloudzero.com --set createSecret=true --set prometheus-node-exporter.enabled=true --set kube-state-metrics.enabled=true --set clusterName='jonp-test-cluster' -f extra-values.yaml | grep remote_write -A 2
with cloudAccountId set to integer gives this immediate feedback:
Checklist
main