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

Enable purging of CFServiceInstances #3573

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

klapkov
Copy link
Contributor

@klapkov klapkov commented Oct 30, 2024

Is there a related GitHub Issue?

Related to #3572

What is this change about?

Here we enable purging of Service Instances. We take advantage of the Owner Reference to Service Instances in the CFServiceBinding Object. This way, if purge is true, we just remove the finalizer on the CFServiceInstance, so the broker won't be contacted. Since the bindings are a child of the instance, they will be deleted.

I wanted to include a test case in the service_instance_repository_test for checking if a service binding is purged, but I did not work for some reason. At some point I found out that envtest has some drawbacks in this case. As per: https://book.kubebuilder.io/reference/envtest#testing-considerations - "One common example is garbage collection; because there are no controllers monitoring built-in resources, objects do not get deleted, even if an OwnerReference is set up". So we could not directly verify this via test case.

Copy link
Member

@danail-branekov danail-branekov left a comment

Choose a reason for hiding this comment

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

Overall looks OK. I would request adding a test into the managed service instance controller to verify that whenever a CFServiceInstance without finalizers is being deleted (i.e. it has its DeletionTimestamp set), the controller does not talk to the broker.

Maybe When("the instance is purged" next to When("the instance is being deleted

api/handlers/service_instance.go Outdated Show resolved Hide resolved
api/handlers/service_instance_test.go Show resolved Hide resolved
api/payloads/service_instance_test.go Outdated Show resolved Hide resolved
api/repositories/service_instance_repository.go Outdated Show resolved Hide resolved
api/repositories/service_instance_repository_test.go Outdated Show resolved Hide resolved
api/handlers/service_instance.go Outdated Show resolved Hide resolved
api/handlers/service_instance.go Outdated Show resolved Hide resolved
@georgethebeatle georgethebeatle enabled auto-merge (squash) November 8, 2024 13:48
@georgethebeatle georgethebeatle enabled auto-merge (squash) November 8, 2024 13:57
@georgethebeatle georgethebeatle linked an issue Nov 8, 2024 that may be closed by this pull request
@georgethebeatle georgethebeatle merged commit 31e0123 into cloudfoundry:main Nov 8, 2024
10 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.

Implement purging of Service Instances
3 participants