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

Fix service instance purging #3616

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

klapkov
Copy link
Contributor

@klapkov klapkov commented Nov 18, 2024

Is there a related GitHub Issue?

#3615

What is this change about?

Previously the service bindings did not have a finalizer, but now they do. So when purging a service instance, we need to remove them from every related service binding.

Does this PR introduce a breaking change?

No

Acceptance Steps

Tag your pair, your PM, and/or team

 * Remove the finalizers from all related bindings
},
}

serviceBinding.Finalizers = append(serviceBinding.Finalizers, korifiv1alpha1.CFServiceBindingFinalizerName)
Copy link
Member

Choose a reason for hiding this comment

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

This can be in-lined in the literal

@@ -519,6 +522,28 @@ func (r *ServiceInstanceRepo) GetDeletedAt(ctx context.Context, authInfo authori
return serviceInstance.DeletedAt, nil
}

func (r *ServiceInstanceRepo) DeleteServiceBindings(ctx context.Context, userClient client.WithWatch, namespace, instanceGUID string) error {
Copy link
Member

Choose a reason for hiding this comment

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

This method does not delete service bindings but removes their finalizers, so it would be better to call it removeBindingFinalizer or something in this sense. Also it does not need to be public

@@ -1052,13 +1073,14 @@ var _ = Describe("ServiceInstanceRepository", func() {
It("purges the service instance", func() {
Copy link
Member

Choose a reason for hiding this comment

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

This test should check that both the instance and the binding are not found in an Eventually block. Removing the finalizer is an implementation detail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@georgethebeatle The service binding wont be deleted since the with envtest we do not have the garbage collector controller. As per: https://book.kubebuilder.io/reference/envtest#testing-considerations

Copy link
Member

Choose a reason for hiding this comment

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

@georgethebeatle The service binding wont be deleted since the with envtest we do not have the garbage collector controller. As per: book.kubebuilder.io/reference/envtest#testing-considerations

makes sense, indeed

@danail-branekov danail-branekov merged commit c7bfdf1 into cloudfoundry:main Nov 26, 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.

3 participants