<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>We have developed a CRD responsible, with the help of an operator, to create k8s resources such as serviceInstance, serviceBinding and secret. When the serviceInstance, serviceBinding are created, we add ownerReferences to allow the CRD to do the garbage collection of such resources.</div><div><br></div><div>Example</div><div><br></div><div><div>oc get serviceinstance/my-postgresql-db -o yaml<br></div><div>apiVersion: <a href="http://servicecatalog.k8s.io/v1beta1">servicecatalog.k8s.io/v1beta1</a></div><div>kind: ServiceInstance</div><div>metadata:</div><div>  creationTimestamp: 2018-10-22T16:23:16Z</div><div>  deletionGracePeriodSeconds: 0</div><div>  deletionTimestamp: 2018-10-23T07:11:42Z</div><div>  finalizers:</div><div>  - kubernetes-incubator/service-catalog</div><div>  generation: 2</div><div>  labels:</div><div>    app: my-spring-boot-service</div><div>    name: my-spring-boot-service</div><div>  name: my-postgresql-db</div><div>  namespace: my-spring-app</div><div>  ownerReferences:</div><div>  - apiVersion: <a href="http://component.k8s.io/v1alpha1">component.k8s.io/v1alpha1</a></div><div>    blockOwnerDeletion: true</div><div>    controller: true</div><div>    kind: Component</div><div>    name: my-spring-boot-service</div><div>    uid: c7aee0ee-d616-11e8-9b27-08002710b4d8</div><div>...</div><div><br></div></div><div>Unfortunately, when we delete the CRD, the secret is deleted but not the ServiceInstance & serviceBinding which are marked for deletion</div><div><br></div><div>The status mentions such info for the serviceInstance</div><div><br></div><div><div>  - lastTransitionTime: 2018-10-23T07:00:04Z</div><div>    message: All associated ServiceBindings must be removed before this ServiceInstance</div><div>      can be deleted</div><div>    reason: DeprovisionBlockedByExistingCredentials</div><div>    status: "False"</div><div>    type: Ready</div></div><div><br></div><div>and for the serviceBinding</div><div><br></div><div>  Warning  UnbindCallFailed  3m (x63 over 18m)  service-catalog-controller-manager  Error unbinding from ServiceInstance "my-spring-app/my-postgresql-db" of ClusterServiceClass (K8S: "1dda1477cace09730bd8ed7a6505607e" ExternalName: "dh-postgresql-apb") at ClusterServiceBroker "openshift-automation-service-broker": Status: 403; ErrorMessage: <nil>; Description: User does not have sufficient permissions; ResponseError: <nil><br></div><div><br></div><div>okd version used : 3.11</div><div><br></div><div>Question :</div><div>- Can we use "ownerReferences" to delete from a CRD the service's k8s resources ?</div><div>- What is the alternative if we can use "ownerReferences" ?</div><div>- How can we force to delete such k8s resources ?</div><div><br></div><div>Regards</div><div><br></div><div>Charles<br></div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:10px"><div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>