There should be the possibility to create Binding without ownerReference to Service
we use the Crossplane to create IBM Cloud Operator CR like Service and Binding
Currently, Binding contains ownerReference to Service set by IBM Cloud Operator
In our case:
Crossplane create Binding CR and even if the Crossplane set they own OwnerReference to Binding CR,
the Binding CR will contain two OwnerReferences:
for Service CR
for Crossplabe CR.
and if we removed Crossplane CR, Binding will not be removed because it contains ownerReference to Service.
The binding contains credentials for service login, requested by clients.
If one client requests a credential, cross-plane creates CR which creates Binding CR.
But for us, it is crucial to remove Binding CR if we removed Crossplane CR (it is like client remove)
We can do that if there will be the possibility to skip creation ownerReference in Binding CR by IBM Cloud Operator.
We can pass this information through Binding CR inside parameters
and we can read this parameter in the binding Reconciliation loop
// Set an owner reference if service and binding are in the same namespace
// and if there is not parameter skipOwnerReferences='true' inside Binding CR
if serviceInstance.Namespace == instance.Namespace {
parameters, err := r.getParams(ctx, instance)
if err != nil {
r.Log.Error(err, "Instance ", instance.ObjectMeta.Name, " has problems with its parameters")
return ctrl.Result{}, err
}
if parameters["skipOwnerReferences"] != "true" {
if err := r.SetControllerReference(serviceInstance, instance, r.Scheme); err != nil {
logt.Info("Binding could not update controller reference", instance.Name, err.Error())
return ctrl.Result{}, err
}
if err := r.Update(ctx, instance); err != nil {
logt.Info("Error setting controller reference", instance.Name, err.Error())
return ctrl.Result{}, nil
}
}
}
There should be the possibility to create Binding without ownerReference to Service
we use the Crossplane to create IBM Cloud Operator CR like Service and Binding
Currently, Binding contains ownerReference to Service set by IBM Cloud Operator
In our case: Crossplane create Binding CR and even if the Crossplane set they own OwnerReference to Binding CR, the Binding CR will contain two OwnerReferences:
The binding contains credentials for service login, requested by clients. If one client requests a credential, cross-plane creates CR which creates Binding CR. But for us, it is crucial to remove Binding CR if we removed Crossplane CR (it is like client remove)
We can do that if there will be the possibility to skip creation ownerReference in Binding CR by IBM Cloud Operator. We can pass this information through Binding CR inside parameters
and we can read this parameter in the binding Reconciliation loop