Skip to content

feat(rhdh): add lifecycleHooks, priorityClassName, terminationGracePeriodSeconds - #512

Open
rm3l wants to merge 2 commits into
redhat-developer:mainfrom
rm3l:feat/rhdh-chart-lifecycle-priority-termination
Open

feat(rhdh): add lifecycleHooks, priorityClassName, terminationGracePeriodSeconds#512
rm3l wants to merge 2 commits into
redhat-developer:mainfrom
rm3l:feat/rhdh-chart-lifecycle-priority-termination

Conversation

@rm3l

@rm3l rm3l commented Aug 26, 2026

Copy link
Copy Markdown
Member

Description of the change

Replicate the lifecycleHooks, priorityClassName, and terminationGracePeriodSeconds fields recently added to the upstream backstage chart into the standalone charts/rhdh chart. Noticed in #499

  • lifecycleHooks (container-level): Rendered as lifecycle on the main RHDH container. Supports preStop, postStart, etc.
  • priorityClassName (pod-level): Allows setting a priority class for pod scheduling.
  • terminationGracePeriodSeconds (pod-level): Configures the graceful shutdown window. Supports 0 (rendered) vs null/unset (omitted).

All three fields default to empty/null (matching upstream) and are omitted from the rendered manifest when not set.

Which issue(s) does this PR fix or relate to

How to test changes / Special notes to the reviewer

# Default: none of the new fields appear
helm template test charts/rhdh | grep -E 'priorityClassName|terminationGrace|lifecycle:'

# With values set: all three fields render correctly
helm template test charts/rhdh \
  --set priorityClassName=high-priority \
  --set terminationGracePeriodSeconds=60 \
  --set 'lifecycleHooks.preStop.exec.command[0]=/bin/sh' \
  --set 'lifecycleHooks.preStop.exec.command[1]=-c' \
  --set 'lifecycleHooks.preStop.exec.command[2]=sleep 10'

# Edge case: terminationGracePeriodSeconds=0 renders (not treated as falsy)
helm template test charts/rhdh --set terminationGracePeriodSeconds=0 | grep terminationGrace

Checklist

  • For each Chart updated, version bumped in the corresponding Chart.yaml according to Semantic Versioning.
  • For each Chart updated, variables are documented in the values.yaml and added to the corresponding README.md. The pre-commit utility can be used to generate the necessary content. Run pre-commit run --all-files to run the hooks and then push any resulting changes. The pre-commit Workflow will enforce this and warn you if needed.
  • JSON Schema template updated and re-generated the raw schema via the pre-commit hook.
  • Tests pass using the Chart Testing tool and the ct lint command.
  • If you updated the orchestrator-infra chart, make sure the versions of the Knative CRDs are aligned with the versions of the CRDs installed by the OpenShift Serverless operators declared in the values.yaml file. See Installing Knative Eventing and Knative Serving CRDs for more details.

@rm3l
rm3l requested a review from a team as a code owner August 26, 2026 07:49
@openshift-ci
openshift-ci Bot requested review from gazarenkov and zdrapela August 26, 2026 07:49
…riodSeconds

Replicate the upstream backstage chart fields recently added in
backstage/charts for container lifecycle hooks, pod priority class,
and graceful termination period into the standalone RHDH chart.
@rhdh-qodo-merge

Copy link
Copy Markdown

PR Summary by Qodo

Add pod lifecycle and scheduling controls to the RHDH chart

✨ Enhancement 📝 Documentation ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Add optional lifecycle hooks, pod priority classes, and graceful termination settings.
• Preserve omission defaults while rendering zero-second termination periods correctly.
• Validate and document new values, then release chart version 1.1.0.
Diagram

graph TD
  A["Chart Values"] -->|consumed by| C["Deployment Template"] -->|renders| D["Pod Spec"] -->|contains| E["Main Container"]
  A -->|checked against| B["JSON Schema"]
  C -->|configures hooks| E
Loading
High-Level Assessment

The direct, upstream-compatible values are the best fit for this chart. A generic pod-spec override was considered but would provide weaker schema validation, documentation, and compatibility while making common Kubernetes controls harder to discover.

Files changed (6) +74 / -3

Enhancement (1) +10 / -0
deployment.yamlRender optional pod and container lifecycle settings +10/-0

Render optional pod and container lifecycle settings

• Conditionally renders priorityClassName and terminationGracePeriodSeconds in the pod spec and lifecycle hooks on the main RHDH container. The termination check distinguishes an unset value from zero so an explicit zero-second grace period is preserved.

charts/rhdh/templates/deployment.yaml

Documentation (1) +5 / -2
README.mdDocument new deployment controls and chart release +5/-2

Document new deployment controls and chart release

• Updates the chart badge and installation example to version 1.1.0. Adds generated values-table entries for lifecycle hooks, pod priority, and graceful termination.

charts/rhdh/README.md

Other (4) +59 / -1
Chart.yamlRelease RHDH chart version 1.1.0 +1/-1

Release RHDH chart version 1.1.0

• Bumps the chart version from 1.0.1 to 1.1.0 for the new configurable deployment capabilities. The application version remains unchanged.

charts/rhdh/Chart.yaml

values.schema.jsonPublish generated schema for new deployment values +22/-0

Publish generated schema for new deployment values

• Adds generated schema definitions and defaults for lifecycle hooks, priorityClassName, and nullable terminationGracePeriodSeconds. Restricts termination periods to non-negative integers when configured.

charts/rhdh/values.schema.json

values.schema.tmpl.jsonDefine schema source for lifecycle and scheduling options +19/-0

Define schema source for lifecycle and scheduling options

• Adds the source schema definitions, Kubernetes documentation references, defaults, and termination-period constraints used to generate the published values schema.

charts/rhdh/values.schema.tmpl.json

values.yamlExpose lifecycle, priority, and termination defaults +17/-0

Expose lifecycle, priority, and termination defaults

• Introduces documented top-level values with omission-safe defaults. Includes an example preStop command for configuring main-container lifecycle hooks.

charts/rhdh/values.yaml

@rhdh-qodo-merge

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Grace period type misdocumented 🐞 Bug ≡ Correctness
Description
The README documents terminationGracePeriodSeconds as a string even though the chart schema only
accepts an integer or null. A user following this table and supplying a quoted string value will
fail Helm schema validation instead of configuring the pod grace period.
Code

charts/rhdh/README.md[313]

+| terminationGracePeriodSeconds | Duration in seconds the pod needs to terminate gracefully before being force killed. Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination | string | `nil` |
Relevance

●●● Strong

Recent accepted precedent confirms reviewers accept README type corrections that prevent Helm values
validation or rendering failures.

PR-#326

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The added README row says string, while both schema sources define the value as integer-or-null
and the template writes it directly to the numeric PodSpec field.

charts/rhdh/README.md[313-313]
charts/rhdh/values.schema.tmpl.json[401-406]
charts/rhdh/values.schema.json[2315-2324]
charts/rhdh/templates/deployment.yaml[77-79]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The generated values table labels `terminationGracePeriodSeconds` as `string`, but its schema requires an integer or null. Correct the documentation generation source/output so users are instructed to provide a numeric value while preserving the null default.

## Issue Context
The value is intentionally unset by default, which caused the generated table to infer the wrong type. The checked-in schema defines `type: ["integer", "null"]`, `minimum: 0`, and the deployment emits the value as a Kubernetes numeric field.

## Fix Focus Areas
- charts/rhdh/values.yaml[319-322]
- charts/rhdh/README.md[313-313]
- charts/rhdh/values.schema.tmpl.json[401-406]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Cross-repo context — repo relationships

Grey Divider

Tip of the day
💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@rhdh-qodo-merge rhdh-qodo-merge Bot added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 26, 2026
@rm3l
rm3l force-pushed the feat/rhdh-chart-lifecycle-priority-termination branch from 08d0445 to 86ad481 Compare August 26, 2026 07:51
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant