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

feat: remove cpu limit default #1163

Merged
merged 2 commits into from
Jul 13, 2023
Merged

Conversation

jrRibeiro
Copy link
Contributor

Currently, CPU limit can't be removed.

The getResources function, which creates the base for resources, sets the requests and limits for both memory and CPU.

If one defines the container's limits not to include a CPU limit, the reconciler merges the base resources with the overrides defined in the CR using a structural merge patch, which doesn't remove fields present in base but missing from the overrides. So, there's no way we can remove CPU limits.

Now, this should not be yet another discussion on whether we should or not specify CPU limits, but to allow those who need to remove CPU limits to do so.

Possible solutions:

  • Remove the CPU limit from base: this is a breaking change, as users not defining the CPU limit would have to define it if needed. Also, having a CPU limit by default is a good thing if users don't want to explicitly remove it.

  • Look for the grafana container defined in the CR and if the CR defines limits, but leaves out the CPU limit, don't add it to the base (ie. define the base with only a memory limit). This is not a breaking change because if users don't define limits, these will still be defined as they are now. The only change is, if the CR defines limits only containing a memory limit, then only the memory limit is set, not the CPU limit.

This is an implementation of the first solution.

Related: #1161

Signed-off-by: Ricardo Ribeiro <j.ribeiro.fafe@gmail.com>
@NissesSenap NissesSenap merged commit bd98817 into grafana:master Jul 13, 2023
9 checks passed
@jrRibeiro jrRibeiro deleted the cpu_limit1 branch July 13, 2023 15:22
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.

None yet

2 participants