Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leverage finalizer for Package deletions #523

Open
mjnagel opened this issue Jun 28, 2024 · 2 comments · May be fixed by #634
Open

Leverage finalizer for Package deletions #523

mjnagel opened this issue Jun 28, 2024 · 2 comments · May be fixed by #634
Assignees
Labels
enhancement New feature or request operator Issues pertaining to the UDS Operator (Pepr)

Comments

@mjnagel
Copy link
Contributor

mjnagel commented Jun 28, 2024

Describe what should be investigated or refactored

In the current state of things deletions happen in a watch in our pepr code. As we manage additional "external resources" (such as keycloak clients), blocking on that deletion is critical to prevent errors when a rapid delete + create process happens. Kubernetes finalizers feel like the right solution to ensure that someone cannot reuse a Package name before the previous one is fully cleaned up.

Links to any relevant code

This block of code is the most relevant - note that these are two separate flows and there is currently no "block on delete" in here:

// Watch for changes to the UDSPackage CRD and cleanup the namespace mutations
When(UDSPackage)
.IsDeleted()
.Watch(async pkg => {
// Cleanup the namespace
await cleanupNamespace(pkg);
// Remove any SSO clients
await purgeSSOClients(pkg, []);
});
// Watch for changes to the UDSPackage CRD to enqueue a package for processing
When(UDSPackage)
.IsCreatedOrUpdated()
// Advanced CR validation
.Validate(validator)
// Enqueue the package for processing
.Reconcile(packageReconciler);

Additional context

https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/

@mjnagel mjnagel added enhancement New feature or request operator Issues pertaining to the UDS Operator (Pepr) labels Jul 2, 2024
@mjnagel mjnagel added this to the 0.25.0 milestone Jul 22, 2024
@mjnagel mjnagel self-assigned this Aug 1, 2024
@mjnagel mjnagel modified the milestones: 0.25.0, 0.26.0 Aug 2, 2024
@mjnagel
Copy link
Contributor Author

mjnagel commented Aug 2, 2024

Linking Pepr issue/feature suggestion for native finalizer support - defenseunicorns/pepr#1022

@mjnagel
Copy link
Contributor Author

mjnagel commented Aug 6, 2024

May put this on hold to see what shakes out from the Pepr native support feature request.

@mjnagel mjnagel removed this from the 0.26.0 milestone Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request operator Issues pertaining to the UDS Operator (Pepr)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant