Unproject workloads no longer targeted by a ServiceBinding by scothis · Pull Request #348 · servicebinding/runtime

@scothis requested a review from a team

October 5, 2023 18:26

scothis

This was referenced

Oct 11, 2023

@scothis

When a previously bound workload is no longer targeted by a
ServiceBinding it is now unprojected. Previously, the projection was
orphaned as the controller only managed workload matching the reference
on the ServiceBinding resource. This could happen for a few different
reasons:

- the name of the referenced workload was updated on the ServiceBinding
- the label selector matching the workload was updated on the
  ServiceBinding
- the labels on the workload were updated to no longer match the
  selector on the ServiceBinding.

In order to find previously bound workloads, we now list all resources
matching the workload refs GVK in the namespace.  That list is filtered
to resources that are currently projected, or match the new criteria.
All matching workloads are unprojected, but only resources matching the
current ref are re-projected.

To avoid a much larger search area, the workloadRef apiVersion and kind
fields are now immutable. Users who need to update either of these
values will need to delete the ServiceBinding and create a new resource
with the desired values.

Signed-off-by: Scott Andrews <andrewssc@vmware.com>

sadlerap

@scothis

Signed-off-by: Scott Andrews <andrewssc@vmware.com>

sadlerap