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

fix: scientific notation integer parsing in config #1662

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

olevski
Copy link
Member

@olevski olevski commented Oct 11, 2023

Helm will convert a large integer (specified normally in the values file) like 3000000 to scientific notation like 3e6 in the templates.

And python int() crashes when it sees 3e6 and you have to use float() to parse it.

Also I have the same function repeated because it is in two separate modules that are at the same level and they share no code. So to not repeat that one simple function I would have to do a lot unnecessary gymnastics just for one small really simple function.

@olevski olevski requested a review from a team as a code owner October 11, 2023 12:41
@@ -29,8 +26,8 @@ class Config:
git_proxy_health_port: Union[Text, int] = 8081

def __post_init__(self):
self.port = _parse_value_as_numeric(self.port, int)
self.git_proxy_health_port = _parse_value_as_numeric(self.git_proxy_health_port, int)
self.port = _parse_value_as_int(self.port)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (non-blocking): Do ports actually have this issue, since they only go to 65535?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not but I am not sure at what value k8s decides to convert large ints to scientific notation

@olevski olevski enabled auto-merge (squash) October 23, 2023 12:48
@olevski olevski merged commit c4ce286 into master Oct 23, 2023
9 checks passed
@olevski olevski deleted the fix-config-integer-parsing branch October 23, 2023 12:50
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

Successfully merging this pull request may close these issues.

3 participants