Add configurable resource requests/limits for the controller#783
Add configurable resource requests/limits for the controller#783kelos-bot[bot] wants to merge 2 commits intomainfrom
Conversation
Remove hardcoded resource limits from the controller deployment and add --controller-resource-requests and --controller-resource-limits flags to kelos install, allowing users to set controller resources as needed. By default no resources are set, avoiding OOM kills from the previous 128Mi memory limit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gjkim42
left a comment
There was a problem hiding this comment.
It shouldn't be changed in deploy-to-dev workflow.
/kelos pick-up
|
🤖 Kelos Task Status Task |
There was a problem hiding this comment.
3 issues found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/cli/install_test.go">
<violation number="1" location="internal/cli/install_test.go:587">
P2: The new “no controller resources by default” tests only check old limit defaults and miss old request defaults, leaving a regression gap for default requests still being rendered.
(Based on your team's feedback about adding tests for new behavior.) [FEEDBACK_USED]</violation>
<violation number="2" location="internal/cli/install_test.go:607">
P2: The CPU limit assertion is too broad: `"cpu: 1"` matches the request value `"cpu: 100m"`, so this test can pass when controller CPU limits are not rendered.</violation>
</file>
<file name="internal/manifests/charts/kelos/templates/deployment.yaml">
<violation number="1" location="internal/manifests/charts/kelos/templates/deployment.yaml:103">
P1: Trim whitespace from the split key and value to prevent invalid YAML indentation if users include spaces after commas. (Apply this fix to both the limits and requests blocks).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| memory: 128Mi | ||
| {{- range splitList "," .Values.controllerResourceLimits }} | ||
| {{- $kv := splitList "=" . }} | ||
| {{ index $kv 0 }}: {{ index $kv 1 }} |
There was a problem hiding this comment.
P1: Trim whitespace from the split key and value to prevent invalid YAML indentation if users include spaces after commas. (Apply this fix to both the limits and requests blocks).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/manifests/charts/kelos/templates/deployment.yaml, line 103:
<comment>Trim whitespace from the split key and value to prevent invalid YAML indentation if users include spaces after commas. (Apply this fix to both the limits and requests blocks).</comment>
<file context>
@@ -94,10 +94,20 @@ spec:
- memory: 128Mi
+ {{- range splitList "," .Values.controllerResourceLimits }}
+ {{- $kv := splitList "=" . }}
+ {{ index $kv 0 }}: {{ index $kv 1 }}
+ {{- end }}
+ {{- end }}
</file context>
| {{ index $kv 0 }}: {{ index $kv 1 }} | |
| {{ trim (index $kv 0) }}: {{ trim (index $kv 1) }} |
| if !bytes.Contains(data, []byte("memory: 256Mi")) { | ||
| t.Error("expected memory: 256Mi in rendered output for controller requests") | ||
| } | ||
| if !bytes.Contains(data, []byte("cpu: 1")) { |
There was a problem hiding this comment.
P2: The CPU limit assertion is too broad: "cpu: 1" matches the request value "cpu: 100m", so this test can pass when controller CPU limits are not rendered.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/cli/install_test.go, line 607:
<comment>The CPU limit assertion is too broad: `"cpu: 1"` matches the request value `"cpu: 100m"`, so this test can pass when controller CPU limits are not rendered.</comment>
<file context>
@@ -537,8 +537,98 @@ func TestInstallCommand_NoTokenRefresherResourcesByDefault(t *testing.T) {
+ if !bytes.Contains(data, []byte("memory: 256Mi")) {
+ t.Error("expected memory: 256Mi in rendered output for controller requests")
+ }
+ if !bytes.Contains(data, []byte("cpu: 1")) {
+ t.Error("expected cpu: 1 in rendered output for controller limits")
+ }
</file context>
| if !bytes.Contains(data, []byte("cpu: 1")) { | |
| if !bytes.Contains(data, []byte("cpu: 1\n")) { |
| }) | ||
|
|
||
| // With no flags, no resources block should be rendered for the controller | ||
| if strings.Contains(output, "cpu: 500m") { |
There was a problem hiding this comment.
P2: The new “no controller resources by default” tests only check old limit defaults and miss old request defaults, leaving a regression gap for default requests still being rendered.
(Based on your team's feedback about adding tests for new behavior.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/cli/install_test.go, line 587:
<comment>The new “no controller resources by default” tests only check old limit defaults and miss old request defaults, leaving a regression gap for default requests still being rendered.
(Based on your team's feedback about adding tests for new behavior.) </comment>
<file context>
@@ -537,8 +537,98 @@ func TestInstallCommand_NoTokenRefresherResourcesByDefault(t *testing.T) {
+ })
+
+ // With no flags, no resources block should be rendered for the controller
+ if strings.Contains(output, "cpu: 500m") {
+ t.Error("expected no hardcoded cpu: 500m when controller resources not set")
+ }
</file context>
Preserve the previous default controller resources in the dev deployment now that hardcoded defaults have been removed from the Helm chart. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/kelos needs-input All review feedback was addressed in previous commits. Ready for re-review. Changes made:
|
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds
--controller-resource-requestsand--controller-resource-limitsflags tokelos install, allowing users to configure CPU and memory resources for the controller container. The previously hardcoded resource limits (cpu: 500m / memory: 128Milimits,cpu: 10m / memory: 64Mirequests) have been removed as defaults, since the low memory limit was causing OOM kills in real workloads.Users who want to set resources can now use:
GitOps/Helm users can set
controllerResourceRequestsandcontrollerResourceLimitsin their values override.The deploy-to-dev workflow has been updated to explicitly pass the previous default values so that dev environment behavior is preserved.
Fixes #779
Which issue(s) this PR is related to:
Fixes #779
Special notes for your reviewer:
The maintainer noted that setting resource limits by default may be a bad idea (similar to how linkerd/cilium handle control plane resources). This PR removes the hardcoded defaults entirely — when no flags are provided, no
resources:block is rendered in the deployment. Users can opt-in to resource constraints via the new CLI flags or Helm values.The deploy-to-dev workflow was updated to explicitly set controller resources (matching the previous hardcoded defaults) so that dev deployments are unaffected.
Does this PR introduce a user-facing change?