Description
Bug Report
I have a KafkaUserDR
which is a CRUDKubernetesDependentResource<KafkaUser, LHCluster>
. In my LHClusterReconciler#reconcile
method, I call kafkaUserDR.delete(...)
.
KafkaUser
is the class of the CRD that is created by the Dependent Resource, and LHCluster
is the primary.
The name of the Primary resource (the LHCluster
) is my-cluster
. I had another CRD of a different type (LHKafkaUser
), and that an instance of that CRD also named my-cluster
.
The LHKafkaUser
CRD creates as a dependent a KafkaUser
and therefore put an ownerRef
on the created KafkaUser
. The ownerRef on that KafkaUser
correctly reported the kind: LHKafkaUser
.
However, in the LHCluster Reconciler, calling delete()
on the kafkaUserDR
incorrectly deleted that resource: it was owned by the LHKafkaUser
and NOT by the LHCluster
.
Potential Fix
I think the fix is that the CRUDKubernetesDependentResource#delete()
method needs to check both the name
and kind
on the ownerRef
of resources before deleting it. Right now, the behavior suggests that it is not checking the kind
.
Environment
Using a KIND cluster. JOSDK version 4.4.x