Skip to content

Helm: Allow users to override automatically calculated GOMAXPROCS #11983

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

Merged
merged 17 commits into from
Aug 14, 2025

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Jul 4, 2025

Summary

As raised in #6467 right now users have no way to override the default env variables some components define. This PR improves that.

• Add reusable mimir.lib.containerEnv helper to merge environment variables with proper precedence
• Enable GOMAXPROCS override for distributor, ingester, querier, ruler-querier, and store-gateway components
• Maintain backward compatibility with existing automatic GOMAXPROCS calculations
• Add comprehensive test coverage for override functionality

🤖 Generated with Claude Code

@narqo narqo requested a review from a team as a code owner July 4, 2025 19:38
@narqo narqo force-pushed the vldmr/helm-gomaxprocs branch from 047d769 to 0d6949c Compare July 4, 2025 19:38
Comment on lines +136 to +137
env:
[]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for the reviewers, the side effect of the changes is that the components render a default empty env, when there is no environment variables. This is valid; I don't have issues with that.

@baurmatt
Copy link

@narqo Can we please get this merged?

@zenador
Copy link
Contributor

zenador commented Jul 30, 2025

🤖 Automated comment

The CHANGELOG has just been cut to prepare for the next release. Please rebase main and eventually move the CHANGELOG entry added / updated in this PR to the top of the operations/helm/charts/mimir-distributed/CHANGELOG.md document. Thanks!

@QuentinBisson
Copy link
Contributor

Thank you for this PR this is great work :)

@narqo narqo force-pushed the vldmr/helm-gomaxprocs branch from 79b766e to 50d67ac Compare August 1, 2025 10:53
@narqo narqo requested a review from dimitarvdimitrov August 1, 2025 17:46
@narqo
Copy link
Contributor Author

narqo commented Aug 1, 2025

@dimitarvdimitrov could you have a look at the latest version

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

there are 9 more places which define their own env: blocks. Any reason not to use this template there too?

ingester:
resources:
requests:
cpu: 1 # This would normally calculate GOMAXPROCS as (1 + max(min(1, 6), 3) + 1) = 5
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't there an extra +1 in the comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the formula in the ingester template is request + max(min(request, 6), 3) + 1 (and I think I know the person, who wrote this formula ;))

@narqo
Copy link
Contributor Author

narqo commented Aug 13, 2025

there are 9 more places which define their own env: blocks. Any reason not to use this template there too?

But you've asked to not touch places that don't have "GOMAXPROCS" (#11983 (comment)). So I've reverted these. Should I put them back? 😬

@dimitarvdimitrov
Copy link
Contributor

there are 9 more places which define their own env: blocks. Any reason not to use this template there too?

But you've asked to not touch places that don't have "GOMAXPROCS" (#11983 (comment)). So I've reverted these. Should I put them back? 😬

oh.. ok uhmmm, let's keep it as-is 🐒

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

i haven't reviewed all files because it will take a long time feel free to merge

narqo added 14 commits August 14, 2025 16:20
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
@narqo narqo force-pushed the vldmr/helm-gomaxprocs branch from c1723f0 to 06cb061 Compare August 14, 2025 14:38
Comment on lines 84 to -85
env:
envFrom:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

LOL, these tests were broken 🙈

@narqo narqo requested a review from Copilot August 14, 2025 14:41
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements functionality to allow users to override automatically calculated GOMAXPROCS environment variables in Helm chart deployments. The PR adds infrastructure to merge environment variables with proper precedence, enabling GOMAXPROCS override for distributor, ingester, querier, ruler-querier, and store-gateway components while maintaining backward compatibility.

  • Adds reusable mimir.lib.containerEnv helper for merging environment variables with proper precedence
  • Standardizes environment variable syntax by removing unnecessary quotes around environment variable names
  • Provides comprehensive test coverage demonstrating GOMAXPROCS override functionality

Reviewed Changes

Copilot reviewed 300 out of 399 changed files in this pull request and generated 1 comment.

File Description
Multiple test-generated YAML files Generated test outputs showing standardized env variable syntax and new override capabilities
test-gomaxprocs-override-values-generated New test case demonstrating GOMAXPROCS override functionality with custom values

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

narqo added 2 commits August 14, 2025 17:18
Signed-off-by: Vladimir Varankin <vladimir.varankin@grafana.com>
@narqo narqo enabled auto-merge (squash) August 14, 2025 15:19
@narqo narqo merged commit d5c3e83 into main Aug 14, 2025
33 checks passed
@narqo narqo deleted the vldmr/helm-gomaxprocs branch August 14, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants