CNF-22163: Enable kubelet GracefulNodeShutdown in RAN DU - #903
Conversation
…rofile Add shutdownGracePeriod and shutdownGracePeriodCriticalPods to the kubeletconfig.experimental annotation in all PerformanceProfile source CRs (x86_64 and aarch64). This enables the kubelet's native GracefulNodeShutdown feature, which reduces IBU upgrade downtime by allowing pods to terminate gracefully before node shutdown. The kube-compare template and hack arch values are updated to validate and render the new fields with defaults of 30s total (20s non-critical, 10s critical). Co-authored-by: Cursor <cursoragent@cursor.com>
|
@jmontesi: This pull request references CNF-22163 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jmontesi The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @jmontesi. Thanks for your PR. I'm waiting for a openshift-kni member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
📝 WalkthroughWalkthroughThe kubelet configuration template now emits optional graceful shutdown settings. AArch64 and x86_64 reference and source profiles set a 30-second shutdown period and a 10-second critical-pod period. ChangesKubelet graceful shutdown
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@telco-ran/configuration/kube-compare-reference/functions/unordered_list.tmpl`:
- Around line 87-93: Update the unordered-list template’s optional-field comma
handling so rendered JSON remains valid when either or both shutdown
grace-period fields are omitted; emit separators only when a subsequent field
exists, while preserving output when both fields are present. Add render
coverage for both fields present, each field absent individually, and both
fields absent.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8595a980-f64f-4562-991a-314d5362ce80
📒 Files selected for processing (7)
telco-ran/configuration/kube-compare-reference/functions/unordered_list.tmpltelco-ran/configuration/kube-compare-reference/hack/arch/aarch64.yamltelco-ran/configuration/kube-compare-reference/hack/arch/x86_64.yamltelco-ran/configuration/source-crs/node-tuning-operator/aarch64/PerformanceProfile-SetSelector.yamltelco-ran/configuration/source-crs/node-tuning-operator/aarch64/PerformanceProfile.yamltelco-ran/configuration/source-crs/node-tuning-operator/x86_64/PerformanceProfile-SetSelector.yamltelco-ran/configuration/source-crs/node-tuning-operator/x86_64/PerformanceProfile.yaml
| "systemReserved":{"memory":{{ $systemReservedMemory }}}, | ||
| {{- end }} | ||
| {{- if $shutdownGracePeriod }} | ||
| "shutdownGracePeriod":"{{ $shutdownGracePeriod }}", | ||
| {{- end }} | ||
| {{- if $shutdownGracePeriodCriticalPods }} | ||
| "shutdownGracePeriodCriticalPods":"{{ $shutdownGracePeriodCriticalPods }}" |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Guard commas for omitted optional fields.
Line 87 and Line 90 always emit trailing commas. Lines 89-94 conditionally emit the following fields. An annotation that omits either field can therefore render invalid JSON, such as {"systemReserved":{"memory":"11Gi"},}. Emit each comma only when a later field exists, or serialize a constructed object instead.
Proposed fix
- "systemReserved":{"memory":{{ $systemReservedMemory }}},
+ "systemReserved":{"memory":{{ $systemReservedMemory }}}{{ if or $shutdownGracePeriod $shutdownGracePeriodCriticalPods }},{{ end }}
...
- "shutdownGracePeriod":"{{ $shutdownGracePeriod }}",
+ "shutdownGracePeriod":"{{ $shutdownGracePeriod }}"{{ if $shutdownGracePeriodCriticalPods }},{{ end }}Add render coverage for both fields present, either field absent, and both fields absent.
📝 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.
| "systemReserved":{"memory":{{ $systemReservedMemory }}}, | |
| {{- end }} | |
| {{- if $shutdownGracePeriod }} | |
| "shutdownGracePeriod":"{{ $shutdownGracePeriod }}", | |
| {{- end }} | |
| {{- if $shutdownGracePeriodCriticalPods }} | |
| "shutdownGracePeriodCriticalPods":"{{ $shutdownGracePeriodCriticalPods }}" | |
| "systemReserved":{"memory":{{ $systemReservedMemory }}}{{ if or $shutdownGracePeriod $shutdownGracePeriodCriticalPods }},{{ end }} | |
| {{- end }} | |
| {{- if $shutdownGracePeriod }} | |
| "shutdownGracePeriod":"{{ $shutdownGracePeriod }}"{{ if $shutdownGracePeriodCriticalPods }},{{ end }} | |
| {{- end }} | |
| {{- if $shutdownGracePeriodCriticalPods }} | |
| "shutdownGracePeriodCriticalPods":"{{ $shutdownGracePeriodCriticalPods }}" |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@telco-ran/configuration/kube-compare-reference/functions/unordered_list.tmpl`
around lines 87 - 93, Update the unordered-list template’s optional-field comma
handling so rendered JSON remains valid when either or both shutdown
grace-period fields are omitted; emit separators only when a subsequent field
exists, while preserving output when both fields are present. Add render
coverage for both fields present, each field absent individually, and both
fields absent.
|
/ok-to-test |
|
/hold More testing required. |
|
Discussed with Brent and the OCP node team. This is the best solution for SNO despite of some open issues: |
|
/test lintcheck |
|
@jmontesi: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
Hi @jmontesi could you please include the comment line in the kube-compare template https://github.com/openshift-kni/telco-reference/tree/main/telco-ran/configuration/kube-compare-reference/node-tuning-operator/PerformanceProfile.yaml#L52 to pass CI? |
Add
shutdownGracePeriodandshutdownGracePeriodCriticalPodsto thekubeletconfig.experimentalannotation in all PerformanceProfile source CRs (x86_64 and aarch64). This enables the kubelet's native GracefulNodeShutdown feature, which reduces IBU upgrade downtime by allowing pods to terminate gracefully before node shutdown.The kube-compare template and hack arch values are updated to validate and render the new fields with defaults of 30s total (20s non-critical, 10s critical).