-
Notifications
You must be signed in to change notification settings - Fork 283
fix #1601 : enable cpu limit for "robusta-forwarder" service as current config cause cpu hogging #1602
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe forwarder Helm template now unconditionally sets the kubewatch container’s cpu limit from values. Default values set cpu limits for kubewatch and grafanaRenderer to 50m instead of null. Memory limit logic remains unchanged. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User/CI
participant H as Helm
participant T as forwarder.yaml (template)
participant K as Kubernetes API
participant S as Scheduler/Kubelet
U->>H: helm install/upgrade
H->>T: Render with values.yaml
note over T: Unconditionally set kubewatch<br/>resources.limits.cpu = values.kubewatch.resources.limits.cpu
T-->>H: Manifest (Deployment/Pod spec)
H->>K: Apply manifest
K->>S: Create/Run Pod
S-->>S: Enforce CPU limit at runtime
note over S: kubewatch container capped per configured CPU limit
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ce as current config cause cpu hogging Signed-off-by: Pratik Raj <[email protected]>
3655cf8 to
9576d07
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
helm/robusta/templates/forwarder.yaml(1 hunks)helm/robusta/values.yaml(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: run_tests
| cpu: {{ .Values.kubewatch.resources.limits.cpu }} | ||
| memory: {{ if .Values.isSmallCluster }}"64Mi"{{ else if .Values.kubewatch.resources.limits.memory }}{{ .Values.kubewatch.resources.limits.memory | quote }}{{ else }}{{ .Values.kubewatch.resources.requests.memory | quote }}{{ end }} |
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.
Restore conditional rendering for cpu limit
Emitting cpu: {{ .Values.kubewatch.resources.limits.cpu }} unconditionally breaks the common use case where operators set that value to null to remove the limit—Helm renders it as <no value>, yielding invalid YAML and failing the deploy. Please wrap the stanza with an if/with, as it was before, so the key is omitted when the value is unset.
Apply this diff to bring back the guard:
- limits:
- cpu: {{ .Values.kubewatch.resources.limits.cpu }}
+ limits:
+ {{- with .Values.kubewatch.resources.limits.cpu }}
+ cpu: {{ . }}
+ {{- end }}
memory: {{ if .Values.isSmallCluster }}"64Mi"{{ else if .Values.kubewatch.resources.limits.memory }}{{ .Values.kubewatch.resources.limits.memory | quote }}{{ else }}{{ .Values.kubewatch.resources.requests.memory | quote }}{{ end }}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| cpu: {{ .Values.kubewatch.resources.limits.cpu }} | |
| memory: {{ if .Values.isSmallCluster }}"64Mi"{{ else if .Values.kubewatch.resources.limits.memory }}{{ .Values.kubewatch.resources.limits.memory | quote }}{{ else }}{{ .Values.kubewatch.resources.requests.memory | quote }}{{ end }} | |
| limits: | |
| {{- with .Values.kubewatch.resources.limits.cpu }} | |
| cpu: {{ . }} | |
| {{- end }} | |
| memory: {{ if .Values.isSmallCluster }}"64Mi"{{ else if .Values.kubewatch.resources.limits.memory }}{{ .Values.kubewatch.resources.limits.memory | quote }}{{ else }}{{ .Values.kubewatch.resources.requests.memory | quote }}{{ end }} |
🤖 Prompt for AI Agents
In helm/robusta/templates/forwarder.yaml around lines 74-75, the cpu limit key
is emitted unconditionally causing Helm to render "<no value>" when
.Values.kubewatch.resources.limits.cpu is null; wrap the cpu line in an if (or
with) guard that only renders the entire "cpu: ..." line when
.Values.kubewatch.resources.limits.cpu is set (preserve current indentation),
leaving the key out otherwise so the generated YAML remains valid.
fix #1601
Signed-off-by: Pratik Raj [email protected]