From 0a1e24f31e5dc1a4f193a6d564ed06e2535b2830 Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Fri, 30 Jun 2017 10:51:07 +0800 Subject: [PATCH] remove useless check from impersonation filter When groupsSpecified is false, that means no other groups are added rather than the service account groups. So this check doesn't make any sense. --- .../apiserver/pkg/endpoints/filters/impersonation.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go b/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go index 891b339ecce..1a2d5472478 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go @@ -118,18 +118,8 @@ func WithImpersonation(handler http.Handler, requestContextMapper request.Reques if !groupsSpecified && username != user.Anonymous { // When impersonating a non-anonymous user, if no groups were specified - // if neither the system:authenticated nor system:unauthenticated groups are explicitly included, // include the system:authenticated group in the impersonated user info - found := false - for _, group := range groups { - if group == user.AllAuthenticated || group == user.AllUnauthenticated { - found = true - break - } - } - if !found { - groups = append(groups, user.AllAuthenticated) - } + groups = append(groups, user.AllAuthenticated) } newUser := &user.DefaultInfo{