diff --git a/internal/controller/runtime/fsm/runtime_fsm_apply_clusterrolebindings.go b/internal/controller/runtime/fsm/runtime_fsm_apply_clusterrolebindings.go index dbefa9a5..ce295874 100644 --- a/internal/controller/runtime/fsm/runtime_fsm_apply_clusterrolebindings.go +++ b/internal/controller/runtime/fsm/runtime_fsm_apply_clusterrolebindings.go @@ -33,7 +33,7 @@ func sFnApplyClusterRoleBindings(ctx context.Context, m *fsm, s *systemState) (s var crbList rbacv1.ClusterRoleBindingList if err := shootAdminClient.List(ctx, &crbList); err != nil { updateCRBApplyFailed(&s.instance) - m.log.Info("Cannot list Cluster Role Bindings on shoot, scheduling for retry", "RuntimeCR", s.instance.Name, "shoot", s.shoot.Name) + m.log.Info("Cannot list Cluster Role Bindings on shoot, scheduling for retry") return requeue() } @@ -46,9 +46,10 @@ func sFnApplyClusterRoleBindings(ctx context.Context, m *fsm, s *systemState) (s } { if err := fn(); err != nil { updateCRBApplyFailed(&s.instance) - m.log.Info("Cannot setup Cluster Role Bindings on shoot, scheduling for retry", "RuntimeCR", s.instance.Name, "shoot", s.shoot.Name) + m.log.Info("Cannot setup Cluster Role Bindings on shoot, scheduling for retry") return requeue() } + logDeletedClusterRoleBindings(removed, m, s) } s.instance.UpdateStateReady( @@ -60,6 +61,16 @@ func sFnApplyClusterRoleBindings(ctx context.Context, m *fsm, s *systemState) (s return updateStatusAndStop() } +func logDeletedClusterRoleBindings(removed []rbacv1.ClusterRoleBinding, m *fsm, s *systemState) { + if len(removed) > 0 { + var crbsNames []string + for _, binding := range removed { + crbsNames = append(crbsNames, binding.Name) + } + m.log.Info("Following CRBs were deleted", "deletedCRBs", crbsNames) + } +} + //nolint:gochecknoglobals var GetShootClient = func(ctx context.Context, cnt client.Client, runtime imv1.Runtime) (client.Client, error) { runtimeID := runtime.Labels[imv1.LabelKymaRuntimeID] @@ -213,6 +224,7 @@ var newDelCRBs = func(ctx context.Context, shootClient client.Client, crbs []rba return err } } + return nil } }