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
or 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.