feat: set the task manager retention and start the background services through infrahub

Draft
SA
6d ago
+48-6

Why

Separate background services must apply Infrahub's retention settings before starting Prefect. Starting them directly with prefect server services start ignores those settings: finished task history remains unbounded and activity events follow Prefect's default retention.

This accompanies Infrahub #11289.

Changes

  • The base chart starts separate services with infrahub tasks background-services, including deployments without a sizing preset. The five Enterprise presets use the same command after their existing wait loop.
  • prefect-server.global.prefect.env supplies both containers with defaults of 30 days for task history, 7 days for Infrahub activity, and 2 days for Prefect internal events, including heartbeats.
  • Infrahub retention settings accept 1–365 days; internal-event retention cannot exceed activity-log retention. Native Prefect overrides retain precedence. Set the complete environment list when overriding it, because Helm replaces lists.
  • The base background container uses its writable /tmp directory for Prometheus metric files.
  • Regenerated the configuration reference and aligned the changelog.

Enterprise availability and edition-specific restrictions remain undecided. The current implementation has no edition gate.

The upgrade job only prints task-history size and cleanup guidance. Operators start backlog cleanup separately with infrahub tasks flush flow-runs [--rewrite].

Validation

Rendered twelve cases using Helm v3.19's chart dependency processing and rendering engine with Prefect chart 2026.10.21032730: Community and Enterprise bases, separate services without presets, all five Enterprise presets, OpenShift variants and custom overrides. Checked the startup arguments, retention environment and writable metrics directory; per-service overrides retain precedence.

The scratch Enterprise chart used this branch's Community chart, with unrelated service dependencies disabled. Regenerated the README with helm-docs 1.14.2. No Kubernetes deployment or database cleanup ran.

Release coordination

Do not merge until the Infrahub images move to 1.13 or newer. The chart still selects 1.11.9, which lacks the new command. This requirement applies to all separate-service deployments, including presets.

The Enterprise chart must also move from Community dependency 4.35.0 to the release containing these changes. The chart currently adds no version guard; decide whether to reject older images explicitly before release.