Skip to content

Commit

Permalink
Cleanup after feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
crobby committed Sep 18, 2024
1 parent a1f9a38 commit 5d64537
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions pkg/controllers/managementuser/rbac/namespace_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"strings"
"time"

"k8s.io/apimachinery/pkg/util/wait"

"github.com/pkg/errors"
"github.com/rancher/norman/types/convert"
"github.com/rancher/norman/types/slice"
Expand All @@ -25,6 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/wait"
)

const (
Expand All @@ -33,7 +32,6 @@ const (
initialRoleCondition = "InitialRolesPopulated"
manageNSVerb = "manage-namespaces"
projectNSEditVerb = "*"
cleanupRBACDelaySeconds = 5
)

var projectNSVerbToSuffix = map[string]string{
Expand Down Expand Up @@ -90,12 +88,8 @@ func (n *nsLifecycle) Updated(obj *v1.Namespace) (runtime.Object, error) {
}

func (n *nsLifecycle) Remove(obj *v1.Namespace) (runtime.Object, error) {
if obj.Status.Phase == v1.NamespaceTerminating {
n.asyncCleanupRBAC(obj.Name)
return obj, nil
}
err := n.reconcileNamespaceProjectClusterRole(obj)
return obj, err
n.asyncCleanupRBAC(obj.Name)
return obj, nil
}

func (n *nsLifecycle) syncNS(obj *v1.Namespace) (bool, error) {
Expand Down Expand Up @@ -579,7 +573,7 @@ func updateStatusAnnotation(hasPRTBs bool, namespace *v1.Namespace, mgr *manager
func (n *nsLifecycle) asyncCleanupRBAC(namespaceName string) {
go func() {
backoff := wait.Backoff{
Duration: cleanupRBACDelaySeconds * time.Second,
Duration: 5 * time.Second,
Factor: 2.0,
Jitter: 0.1,
Steps: 10,
Expand Down

0 comments on commit 5d64537

Please sign in to comment.