Skip to content

Commit

Permalink
add missing label check when looking for missing admin CRBs
Browse files Browse the repository at this point in the history
  • Loading branch information
m00g3n committed Aug 14, 2024
1 parent e0c541d commit 0ef59b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
7 changes: 0 additions & 7 deletions api/v1/runtime_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ func (k *Runtime) IsConditionSetWithStatus(c RuntimeConditionType, r RuntimeCond
return false
}

func (k *Runtime) IsConditionConfiguredSuccess() bool {
return k.IsConditionSetWithStatus(
ConditionTypeRuntimeConfigured,
ConditionReasonShootCreationCompleted,
metav1.ConditionTrue)
}

func (k *Runtime) ValidateRequiredLabels() error {
var requiredLabelKeys = []string{
LabelKymaInstanceID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,12 @@ func getRemoved(crbs []rbacv1.ClusterRoleBinding, admins []string) (removed []rb

//nolint:gochecknoglobals
var newContainsAdmin = func(admin string) func(rbacv1.ClusterRoleBinding) bool {
return func(r rbacv1.ClusterRoleBinding) bool {
return func(crb rbacv1.ClusterRoleBinding) bool {
if !labels.Set(crb.Labels).AsSelector().Matches(labels.Set(labelsClusterRoleBindings)) {
return false
}
isAdmin := isRBACUserKindOneOf([]string{admin})
return slices.ContainsFunc(r.Subjects, isAdmin)
return slices.ContainsFunc(crb.Subjects, isAdmin)
}
}

Expand Down

0 comments on commit 0ef59b3

Please sign in to comment.