Skip to content

EPMDEDP-17146: fix: garbage-collect GitServer credentials Secret on deletion#288

Merged
SergK merged 1 commit into
masterfrom
EPMDEDP-17146-gitserver-secret-ownerref
Jun 30, 2026
Merged

EPMDEDP-17146: fix: garbage-collect GitServer credentials Secret on deletion#288
SergK merged 1 commit into
masterfrom
EPMDEDP-17146-gitserver-secret-ownerref

Conversation

@SergK

@SergK SergK commented Jun 30, 2026

Copy link
Copy Markdown
Member

The GitServer reconciler now sets the GitServer as the controller owner of its credentials Secret (spec.nameSshKeySecret). Kubernetes then garbage-collects the Secret whenever the GitServer is deleted, regardless of the deletion path (portal UI, kubectl, or CLI). Previously the native K8s Secret was orphaned, which made recreating a Git integration with the same name fail with "resource already exists".

Ownership is skipped when:

  • the Secret does not exist yet (set on a later reconcile, not a failure);
  • the Secret is already controlled by another resource (e.g. an ExternalSecret managed by the External Secrets Operator), or by this GitServer already;
  • the Secret is referenced by more than one GitServer, so deleting one does not garbage-collect credentials still in use by the others.

@SergK SergK requested a review from a team as a code owner June 30, 2026 15:37
…eletion

The GitServer reconciler now sets the GitServer as the controller owner of
its credentials Secret (spec.nameSshKeySecret). Kubernetes then garbage-collects
the Secret whenever the GitServer is deleted, regardless of the deletion path
(portal UI, kubectl, or CLI). Previously the native K8s Secret was orphaned,
which made recreating a Git integration with the same name fail with
"resource already exists".

Ownership is skipped when:
- the Secret does not exist yet (set on a later reconcile, not a failure);
- the Secret is already controlled by another resource (e.g. an ExternalSecret
  managed by the External Secrets Operator), or by this GitServer already;
- the Secret is referenced by more than one GitServer, so deleting one does not
  garbage-collect credentials still in use by the others.

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
@SergK SergK force-pushed the EPMDEDP-17146-gitserver-secret-ownerref branch from f59ed76 to 49f32e5 Compare June 30, 2026 15:46
@SergK SergK merged commit 740a721 into master Jun 30, 2026
6 checks passed
@SergK SergK deleted the EPMDEDP-17146-gitserver-secret-ownerref branch June 30, 2026 15:52
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.

1 participant