Skip to content

Commit faf4959

Browse files
committed
switch to external user client
1 parent b4427a0 commit faf4959

File tree

16 files changed

+31
-33
lines changed

16 files changed

+31
-33
lines changed

pkg/auth/userregistry/identitymapper/interfaces.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package identitymapper
22

33
import (
4-
userapi "github.com/openshift/origin/pkg/user/apis/user"
4+
userapi "github.com/openshift/origin/pkg/user/apis/user/v1"
55
)
66

77
type UserToGroupMapper interface {

pkg/authorization/admission/restrictusers/groupcache_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package restrictusers
22

33
import (
4-
userapi "github.com/openshift/origin/pkg/user/apis/user"
4+
userapi "github.com/openshift/origin/pkg/user/apis/user/v1"
55
)
66

77
type fakeGroupCache struct {

pkg/authorization/admission/restrictusers/restrictusers.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import (
1717
authorizationclient "github.com/openshift/origin/pkg/authorization/generated/clientset"
1818
authorizationtypedclient "github.com/openshift/origin/pkg/authorization/generated/clientset/typed/authorization/v1"
1919
oadmission "github.com/openshift/origin/pkg/cmd/server/admission"
20-
userapi "github.com/openshift/origin/pkg/user/apis/user"
20+
userapi "github.com/openshift/origin/pkg/user/apis/user/v1"
2121
usercache "github.com/openshift/origin/pkg/user/cache"
22-
userinformer "github.com/openshift/origin/pkg/user/generated/informers/internalversion"
23-
userclient "github.com/openshift/origin/pkg/user/generated/internalclientset"
22+
userclient "github.com/openshift/origin/pkg/user/generated/clientset"
23+
userinformer "github.com/openshift/origin/pkg/user/generated/informers/externalversions"
2424
)
2525

2626
func Register(plugins *admission.Plugins) {
@@ -72,7 +72,7 @@ func (q *restrictUsersAdmission) SetOpenshiftInternalUserClient(userClient userc
7272
}
7373

7474
func (q *restrictUsersAdmission) SetUserInformer(userInformers userinformer.SharedInformerFactory) {
75-
q.groupCache = usercache.NewGroupCache(userInformers.User().InternalVersion().Groups())
75+
q.groupCache = usercache.NewGroupCache(userInformers.User().V1().Groups())
7676
}
7777

7878
// subjectsDelta returns the relative complement of elementsToIgnore in

pkg/authorization/admission/restrictusers/restrictusers_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
authorizationapi "github.com/openshift/origin/pkg/authorization/apis/authorization/v1"
1919
fakeauthorizationclient "github.com/openshift/origin/pkg/authorization/generated/clientset/fake"
2020
oadmission "github.com/openshift/origin/pkg/cmd/server/admission"
21-
userapi "github.com/openshift/origin/pkg/user/apis/user"
22-
fakeuserclient "github.com/openshift/origin/pkg/user/generated/internalclientset/fake"
21+
userapi "github.com/openshift/origin/pkg/user/apis/user/v1"
22+
fakeuserclient "github.com/openshift/origin/pkg/user/generated/clientset/fake"
2323
)
2424

2525
func TestAdmission(t *testing.T) {

pkg/authorization/admission/restrictusers/subjectchecker.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
1111

1212
authorizationapi "github.com/openshift/origin/pkg/authorization/apis/authorization/v1"
13-
userapi "github.com/openshift/origin/pkg/user/apis/user"
14-
userclient "github.com/openshift/origin/pkg/user/generated/internalclientset/typed/user/internalversion"
13+
userapi "github.com/openshift/origin/pkg/user/apis/user/v1"
14+
userclient "github.com/openshift/origin/pkg/user/generated/clientset/typed/user/v1"
1515
)
1616

1717
// SubjectChecker determines whether rolebindings on a subject (user, group, or
@@ -47,7 +47,7 @@ func (checkers UnionSubjectChecker) Allowed(subject rbac.Subject, ctx *RoleBindi
4747
// RoleBindingRestrictionContext holds context that is used when determining
4848
// whether a RoleBindingRestriction allows rolebindings on a particular subject.
4949
type RoleBindingRestrictionContext struct {
50-
userClient userclient.UserInterface
50+
userClient userclient.UserV1Interface
5151
kclient kclientset.Interface
5252

5353
// groupCache maps user name to groups.
@@ -66,7 +66,7 @@ type RoleBindingRestrictionContext struct {
6666

6767
// NewRoleBindingRestrictionContext returns a new RoleBindingRestrictionContext
6868
// object.
69-
func NewRoleBindingRestrictionContext(ns string, kc kclientset.Interface, userClient userclient.UserInterface, groupCache GroupCache) (*RoleBindingRestrictionContext, error) {
69+
func NewRoleBindingRestrictionContext(ns string, kc kclientset.Interface, userClient userclient.UserV1Interface, groupCache GroupCache) (*RoleBindingRestrictionContext, error) {
7070
return &RoleBindingRestrictionContext{
7171
namespace: ns,
7272
kclient: kc,

pkg/authorization/admission/restrictusers/subjectchecker_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
1212

1313
authorizationapi "github.com/openshift/origin/pkg/authorization/apis/authorization/v1"
14-
userapi "github.com/openshift/origin/pkg/user/apis/user"
15-
fakeuserclient "github.com/openshift/origin/pkg/user/generated/internalclientset/fake"
14+
userapi "github.com/openshift/origin/pkg/user/apis/user/v1"
15+
fakeuserclient "github.com/openshift/origin/pkg/user/generated/clientset/fake"
1616
)
1717

1818
func mustNewSubjectChecker(t *testing.T, spec *authorizationapi.RoleBindingRestrictionSpec) SubjectChecker {

pkg/cmd/server/admission/init.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
quotaclient "github.com/openshift/origin/pkg/quota/generated/internalclientset"
2020
securityinformer "github.com/openshift/origin/pkg/security/generated/informers/internalversion"
2121
templateclient "github.com/openshift/origin/pkg/template/generated/internalclientset"
22-
userinformer "github.com/openshift/origin/pkg/user/generated/informers/internalversion"
23-
userclient "github.com/openshift/origin/pkg/user/generated/internalclientset"
22+
userclient "github.com/openshift/origin/pkg/user/generated/clientset"
23+
userinformer "github.com/openshift/origin/pkg/user/generated/informers/externalversions"
2424
)
2525

2626
type PluginInitializer struct {

pkg/cmd/server/admission/types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
quotaclient "github.com/openshift/origin/pkg/quota/generated/internalclientset"
1818
securityinformer "github.com/openshift/origin/pkg/security/generated/informers/internalversion"
1919
templateclient "github.com/openshift/origin/pkg/template/generated/internalclientset"
20-
userinformer "github.com/openshift/origin/pkg/user/generated/informers/internalversion"
21-
userclient "github.com/openshift/origin/pkg/user/generated/internalclientset"
20+
userclient "github.com/openshift/origin/pkg/user/generated/clientset"
21+
userinformer "github.com/openshift/origin/pkg/user/generated/informers/externalversions"
2222
)
2323

2424
type WantsOpenshiftInternalAuthorizationClient interface {

pkg/cmd/server/origin/admission/plugin_initializer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
securityinformer "github.com/openshift/origin/pkg/security/generated/informers/internalversion"
2323
"github.com/openshift/origin/pkg/service"
2424
templateclient "github.com/openshift/origin/pkg/template/generated/internalclientset"
25-
userinformer "github.com/openshift/origin/pkg/user/generated/informers/internalversion"
26-
userclient "github.com/openshift/origin/pkg/user/generated/internalclientset"
25+
userclient "github.com/openshift/origin/pkg/user/generated/clientset"
26+
userinformer "github.com/openshift/origin/pkg/user/generated/informers/externalversions"
2727
"k8s.io/apimachinery/pkg/api/meta"
2828
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2929
"k8s.io/apimachinery/pkg/util/wait"

pkg/cmd/server/origin/authenticator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func NewAuthenticator(
6363
serviceAccountTokenGetter,
6464
userClient.Users(),
6565
apiClientCAs,
66-
usercache.NewGroupCache(informers.GetUserInformers().User().InternalVersion().Groups()),
66+
usercache.NewGroupCache(informers.GetUserInformers().User().V1().Groups()),
6767
)
6868
}
6969

pkg/cmd/server/origin/master_config.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737
projectcache "github.com/openshift/origin/pkg/project/cache"
3838
"github.com/openshift/origin/pkg/quota/controller/clusterquotamapping"
3939
quotainformer "github.com/openshift/origin/pkg/quota/generated/informers/internalversion"
40-
userinformer "github.com/openshift/origin/pkg/user/generated/informers/internalversion"
40+
userinformer "github.com/openshift/origin/pkg/user/generated/informers/externalversions"
4141

4242
securityinformer "github.com/openshift/origin/pkg/security/generated/informers/internalversion"
4343
"github.com/openshift/origin/pkg/service"
@@ -91,7 +91,6 @@ type MasterConfig struct {
9191
AuthorizationInformers authorizationinformer.SharedInformerFactory
9292
QuotaInformers quotainformer.SharedInformerFactory
9393
SecurityInformers securityinformer.SharedInformerFactory
94-
UserInformers userinformer.SharedInformerFactory
9594
}
9695

9796
type InformerAccess interface {
@@ -203,7 +202,6 @@ func BuildMasterConfig(
203202
AuthorizationInformers: informers.GetAuthorizationInformers(),
204203
QuotaInformers: informers.GetQuotaInformers(),
205204
SecurityInformers: informers.GetSecurityInformers(),
206-
UserInformers: informers.GetUserInformers(),
207205
}
208206

209207
// ensure that the limit range informer will be started

pkg/cmd/server/start/informers.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import (
2828
securityclient "github.com/openshift/origin/pkg/security/generated/internalclientset"
2929
templateinformer "github.com/openshift/origin/pkg/template/generated/informers/internalversion"
3030
templateclient "github.com/openshift/origin/pkg/template/generated/internalclientset"
31-
userinformer "github.com/openshift/origin/pkg/user/generated/informers/internalversion"
32-
userclient "github.com/openshift/origin/pkg/user/generated/internalclientset"
31+
userclient "github.com/openshift/origin/pkg/user/generated/clientset"
32+
userinformer "github.com/openshift/origin/pkg/user/generated/informers/externalversions"
3333
)
3434

3535
// informers is a convenient way for us to keep track of the informers, but

pkg/cmd/server/start/start_master.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ func (m *Master) Start() error {
507507
}
508508
// the API server runs a reverse index on users to groups which requires an index on the group informer
509509
// this activates the lister/watcher, so we want to do it only in this path
510-
err = informers.userInformers.User().InternalVersion().Groups().Informer().AddIndexers(cache.Indexers{
510+
err = informers.userInformers.User().V1().Groups().Informer().AddIndexers(cache.Indexers{
511511
usercache.ByUserIndexName: usercache.ByUserIndexKeys,
512512
})
513513
if err != nil {

pkg/project/admission/requestlimit/admission.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
projectapi "github.com/openshift/origin/pkg/project/apis/project"
2020
projectcache "github.com/openshift/origin/pkg/project/cache"
2121
uservalidation "github.com/openshift/origin/pkg/user/apis/user/validation"
22-
userclient "github.com/openshift/origin/pkg/user/generated/internalclientset"
23-
usertypedclient "github.com/openshift/origin/pkg/user/generated/internalclientset/typed/user/internalversion"
22+
userclient "github.com/openshift/origin/pkg/user/generated/clientset"
23+
usertypedclient "github.com/openshift/origin/pkg/user/generated/clientset/typed/user/v1"
2424
)
2525

2626
// allowedTerminatingProjects is the number of projects that are owned by a user, are in terminating state,

pkg/project/admission/requestlimit/admission_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
requestlimitapi "github.com/openshift/origin/pkg/project/admission/requestlimit/api"
1919
projectapi "github.com/openshift/origin/pkg/project/apis/project"
2020
projectcache "github.com/openshift/origin/pkg/project/cache"
21-
userapi "github.com/openshift/origin/pkg/user/apis/user"
22-
fakeuserclient "github.com/openshift/origin/pkg/user/generated/internalclientset/fake"
21+
userapi "github.com/openshift/origin/pkg/user/apis/user/v1"
22+
fakeuserclient "github.com/openshift/origin/pkg/user/generated/clientset/fake"
2323
apierrors "k8s.io/apimachinery/pkg/api/errors"
2424

2525
// install all APIs

pkg/user/cache/groups.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55

66
"k8s.io/client-go/tools/cache"
77

8-
userapi "github.com/openshift/origin/pkg/user/apis/user"
9-
userinformer "github.com/openshift/origin/pkg/user/generated/informers/internalversion/user/internalversion"
8+
userapi "github.com/openshift/origin/pkg/user/apis/user/v1"
9+
userinformer "github.com/openshift/origin/pkg/user/generated/informers/externalversions/user/v1"
1010
)
1111

1212
// GroupCache is a skin on an indexer to provide the reverse index from user to groups.

0 commit comments

Comments
 (0)