mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
Only do string trim when it's necessary
This will enhance performance a little bit.
This commit is contained in:
parent
bcccbc3d0b
commit
fbcbb77fc8
@ -50,8 +50,6 @@ func (defaultNodeIdentifier) NodeIdentity(u user.Info) (string, bool) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
nodeName := strings.TrimPrefix(userName, nodeUserNamePrefix)
|
||||
|
||||
isNode := false
|
||||
for _, g := range u.GetGroups() {
|
||||
if g == user.NodesGroup {
|
||||
@ -63,5 +61,6 @@ func (defaultNodeIdentifier) NodeIdentity(u user.Info) (string, bool) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
return nodeName, isNode
|
||||
nodeName := strings.TrimPrefix(userName, nodeUserNamePrefix)
|
||||
return nodeName, true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user