Skip to content

Commit

Permalink
Merge branch 'main' into backup-app
Browse files Browse the repository at this point in the history
  • Loading branch information
akgalwas authored Dec 17, 2024
2 parents 4854438 + 7c764bb commit 38be434
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand All @@ -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(
Expand All @@ -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]
Expand Down Expand Up @@ -213,6 +224,7 @@ var newDelCRBs = func(ctx context.Context, shootClient client.Client, crbs []rba
return err
}
}

return nil
}
}
Expand Down

0 comments on commit 38be434

Please sign in to comment.