Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,28 @@
{{- if hasKey $inputSystemReserved "memory" }}
{{- $systemReservedMemory = printf "\"%s\"" $inputSystemReserved.memory }}
{{- end }}
{{- end }}
{{- $shutdownGracePeriod := "" }}
{{- if hasKey $config "shutdownGracePeriod" }}
{{- $shutdownGracePeriod = $config.shutdownGracePeriod }}
{{- end }}
{{- $shutdownGracePeriodCriticalPods := "" }}
{{- if hasKey $config "shutdownGracePeriodCriticalPods" }}
{{- $shutdownGracePeriodCriticalPods = $config.shutdownGracePeriodCriticalPods }}
{{- end }}
kubeletconfig.experimental: |
{
{{- if $result }}
"allowedUnsafeSysctls":{{ $result | toJson }},
{{- end }}
{{- if $systemReservedMemory }}
"systemReserved":{"memory":{{ $systemReservedMemory }}}
"systemReserved":{"memory":{{ $systemReservedMemory }}},
{{- end }}
{{- if $shutdownGracePeriod }}
"shutdownGracePeriod":"{{ $shutdownGracePeriod }}",
{{- end }}
{{- if $shutdownGracePeriodCriticalPods }}
"shutdownGracePeriodCriticalPods":"{{ $shutdownGracePeriodCriticalPods }}"
Comment on lines +87 to +93

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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.

Suggested change
"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.

{{- end }}
}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ node_tuning_operator_PerformanceProfile:
annotations:
kubeletconfig.experimental: |
{
"systemReserved":{"memory":"11Gi"}
"systemReserved":{"memory":"11Gi"},
"shutdownGracePeriod":"30s",
"shutdownGracePeriodCriticalPods":"10s"
}
spec:
additionalKernelArgs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ node_tuning_operator_PerformanceProfile:
annotations:
kubeletconfig.experimental: |
{
"systemReserved":{"memory":"11Gi"}
"systemReserved":{"memory":"11Gi"},
"shutdownGracePeriod":"30s",
"shutdownGracePeriodCriticalPods":"10s"
}
spec:
additionalKernelArgs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ metadata:
ran.openshift.io/ztp-deploy-wave: "10"
ran.openshift.io/reference-configuration: "ran-du.redhat.com"
# systemReserved: when used, it should be tailored for each environment.
# shutdownGracePeriod: enables kubelet GracefulNodeShutdown to reduce
# IBU upgrade downtime. Non-critical pods get 20s, critical pods get 10s.
kubeletconfig.experimental: |
{
"systemReserved":{"memory":"11Gi"}
"systemReserved":{"memory":"11Gi"},
"shutdownGracePeriod":"30s",
"shutdownGracePeriodCriticalPods":"10s"
}
spec:
# Note: The defaults here are for Grace Hopper systems. Other systems may alternative PCI or iommu settings such as:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ metadata:
ran.openshift.io/ztp-deploy-wave: "10"
ran.openshift.io/reference-configuration: "ran-du.redhat.com"
# systemReserved: when used, it should be tailored for each environment.
# shutdownGracePeriod: enables kubelet GracefulNodeShutdown to reduce
# IBU upgrade downtime. Non-critical pods get 20s, critical pods get 10s.
kubeletconfig.experimental: |
{
"systemReserved":{"memory":"11Gi"}
"systemReserved":{"memory":"11Gi"},
"shutdownGracePeriod":"30s",
"shutdownGracePeriodCriticalPods":"10s"
}
spec:
# Note: The defaults here are for Grace Hopper systems. Other systems may alternative PCI or iommu settings such as:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ metadata:
ran.openshift.io/ztp-deploy-wave: "10"
ran.openshift.io/reference-configuration: "ran-du.redhat.com"
# systemReserved: when used, it should be tailored for each environment.
# shutdownGracePeriod: enables kubelet GracefulNodeShutdown to reduce
# IBU upgrade downtime. Non-critical pods get 20s, critical pods get 10s.
kubeletconfig.experimental: |
{
"systemReserved":{"memory":"11Gi"}
"systemReserved":{"memory":"11Gi"},
"shutdownGracePeriod":"30s",
"shutdownGracePeriodCriticalPods":"10s"
}
spec:
# Optional kernel arguments:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ metadata:
ran.openshift.io/ztp-deploy-wave: "10"
ran.openshift.io/reference-configuration: "ran-du.redhat.com"
# systemReserved: when used, it should be tailored for each environment.
# shutdownGracePeriod: enables kubelet GracefulNodeShutdown to reduce
# IBU upgrade downtime. Non-critical pods get 20s, critical pods get 10s.
kubeletconfig.experimental: |
{
"systemReserved":{"memory":"11Gi"}
"systemReserved":{"memory":"11Gi"},
"shutdownGracePeriod":"30s",
"shutdownGracePeriodCriticalPods":"10s"
}
spec:
# Optional kernel arguments:
Expand Down
Loading