Skip to content

feat: Add lifecycle hooks, terminationGracePeriodSeconds#508

Merged
emyller merged 1 commit intoFlagsmith:mainfrom
aharonh:feat/lifecycle-hooks
Mar 18, 2026
Merged

feat: Add lifecycle hooks, terminationGracePeriodSeconds#508
emyller merged 1 commit intoFlagsmith:mainfrom
aharonh:feat/lifecycle-hooks

Conversation

@aharonh
Copy link
Contributor

@aharonh aharonh commented Mar 18, 2026

Summary

Adds support for container lifecycle hooks and pod terminationGracePeriodSeconds to all 4 application deployment templates: API, TaskProcessor, Frontend, and SSE.

Currently the PgBouncer deployment template has a hardcoded preStop lifecycle hook, but none of the application deployments support configuring lifecycle hooks or termination grace periods via values.

Closes #507

Changes

  • templates/deployment-api.yaml: Add lifecycle and terminationGracePeriodSeconds
  • templates/deployment-task-processor.yaml: Add lifecycle and terminationGracePeriodSeconds
  • templates/deployment-frontend.yaml: Add lifecycle and terminationGracePeriodSeconds
  • templates/deployment-sse.yaml: Add lifecycle and terminationGracePeriodSeconds
  • values.yaml: Add default values (lifecycle: {}, terminationGracePeriodSeconds: null) for all 4 components

Usage Example

api:
  terminationGracePeriodSeconds: 30
  lifecycle:
    preStop:
      exec:
        command: ["/bin/sh", "-c", "sleep 10"]

Backward Compatibility

  • Defaults are lifecycle: {} and terminationGracePeriodSeconds: null, which means no change to existing deployments
  • Both fields are rendered conditionally ({{- with }} / {{- if }}) so they are omitted entirely when not set

Testing

Verified with helm template that:

  • All 4 templates render lifecycle and terminationGracePeriodSeconds correctly when set
  • Default values produce no change in rendered output (no lifecycle or terminationGracePeriodSeconds in the manifest)

@khvn26 khvn26 changed the title Add lifecycle hooks and terminationGracePeriodSeconds for all deployments feat: Add lifecycle hooks, terminationGracePeriodSeconds Mar 18, 2026
Copy link
Contributor

@emyller emyller left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! This is helpful and much appreciated.

@emyller emyller merged commit e9f6d2b into Flagsmith:main Mar 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add lifecycle hooks and terminationGracePeriodSeconds support for all deployment templates

3 participants