Bridge: Prune objects a component stops rendering

What does this MR do?

Introduces a prune mechanism that deletes objects a component stops rendering when a GitLabCore or Siphon resource is edited, replacing the previous Sweep approach.

Problem: Removing a component's structured field (or disabling it via spec.chart.values) leaves its Deployment, ConfigMaps, and other objects running. Kubernetes garbage collection only fires when the resource is deleted, not when it is edited. The existing Sweep targeted a kind wholesale, which worked for exclusively-owned cluster-scoped kinds like GatewayClass, but would delete every object of a shared kind (e.g., Deployment) if applied per reconcile.

Solution:

  • New release.Pruner (internal/controller/release/prune.go): For each kind and namespace the render uses, lists objects carrying the release labels and deletes those whose name the render no longer wants. Four kinds are never pruned (PersistentVolumeClaim, PersistentVolume, VolumeSnapshot, Secret) because deleting them is destructive.
  • status.renderedKinds: Records the kinds each applied render used (e.g., apps/v1/Deployment, v1/ConfigMap). This catches kinds dropped entirely from a render, such as all Gateway API objects when global.gatewayApi.enabled is turned off. Without this, nothing would name those kinds to list against.
  • Unified cleanup for GitLabCore and Siphon: Both reconcilers now call PruneOrphans after applying, and their finalizers prune against an empty release (everything under the release labels becomes an orphan). Deleting a resource no longer requires rendering its chart.
  • Siphon namespace pinning: Both namespace and monitoring_namespace are now overrides, keeping every rendered object ownable so the finalizer has nothing to delete.

Testing

  1. Create a GitLabCore and confirm webservice comes up.
  2. Edit the resource to remove to disable webservice via value overrides.
  3. Confirm the webservice deployment and configmap are gone.

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • Merge Request Title and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for omnibus-gitlab opened
  • Validate potential values for new configuration settings. Formats such as integer 10, duration 10s, URI scheme://user:passwd@host:port may require quotation or other special handling when rendered in a template and written to a configuration file.
Edited by Clemens Beck

Merge request reports

Loading
Loading