Skip to content

Operator controller could not delete correlated resources #1263

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

Closed
barryzhounb opened this issue Nov 13, 2020 · 1 comment
Closed

Operator controller could not delete correlated resources #1263

barryzhounb opened this issue Nov 13, 2020 · 1 comment

Comments

@barryzhounb
Copy link

In Kubernetes and Operator-sdk, we can define CRD (Custom Resource Definition) and CR (Custom Resource). In my operator controller, when a CR is initialized, then I create a new Deployment and service.

When we delete a CR object, then the correlated resources (such as Deployment or service) will be deleted as well at the same time. I understand it should be done by CR/CRD finalizer, this is just my guess.

Now I hit an issue, during Operator testing, under envTest environment, when I delete a CR, its correlated resources (Deployment or service) have not been deleted.

I am confused. In real k8s cluster, the correlated resources (Deployment or service) can be deleted automatically when I delete a CR, under envTest environment, why it doesn't delete correlated resources?

Could anybody point out the reason.

@coderanger
Copy link
Contributor

This is managed by a mix of object ownership and the gc controller. When an object is deleted, the gc controller cleans up everything owned by it. The reason you don't see this in tests is envtest doesn't run any kube-controller-manager controllers, including gc.

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

No branches or pull requests

2 participants