projectsyn / lieutenant-operator

The Project Syn Inventory API Operator
https://docs.syn.tools/lieutenant-operator/
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Reconcile Tenants and Clusters when their ServiceAccounts, Roles or Rolebindings change #237

Closed simu closed 2 years ago

simu commented 2 years ago

We add ServiceAccounts, Roles and Rolebindings as owned resources when setting up the tenant and cluster controllers. This ensures that a reconcile of the owning tenant or cluster is triggered if its associated ServiceAccount is deleted.

Additionally, we change the owner reference on the tenant ServiceAccount, Role and RoleBinding to be a controller reference so that the reconcile for a tenant is actually triggered when its ServiceAccount is deleted. Notably, reconciles aren't triggered for owned resources, if the owner reference isn't a controller reference (cf. documentation for controllerutil.SetControllerReference and controllerutil.SetOwnerReference)

Split out from #234

Checklist

glrf commented 2 years ago

I just noticed: The same issue exists for roles and rolebindings.

simu commented 2 years ago

I just noticed: The same issue exists for roles and rolebindings.

Updated PR to also adjust handling of owned Roles & RoleBindings