Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ type ObjectMeta struct {
}

const (
// TenantAdmin
TenantAdmin string = "admin"
// UserAdmin the username of the administrator
UserAdmin string = "admin"
// TenantDefault
TenantDefault string = "default"
// TenantAll is the default argument to specify on a context when you want to list or filter resources across all tenants
Expand Down
6 changes: 2 additions & 4 deletions pkg/apiserver/resthandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ func ListResource(r rest.Lister, rw rest.Watcher, scope RequestScope, forceWatch
}
//
url := req.Request.URL.String()
if strings.Index(url, "https://") == 0 {
userinfo, _ := api.UserFrom(ctx)
if strings.Index(url, "https://") == 0 && userinfo.GetName() != api.UserAdmin {
tenant := api.TenantValue(ctx)
if err := filterListInTenant(result, tenant, scope.Kind, scope.Namer); err != nil {
errorJSON(err, scope.Codec, w)
Expand Down Expand Up @@ -833,9 +834,6 @@ func filterListInTenant(obj runtime.Object, tenant string, kind string, namer Sc
if !runtime.IsListType(obj) {
return nil
}
if tenant == api.TenantAdmin {
return nil
}

// Set self-link of objects in the list.
items, err := runtime.ExtractList(obj)
Expand Down
1 change: 1 addition & 0 deletions pkg/auth/authorizer/keystone/keystone.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func (ka *keystoneAuthorizer) Authorize(a authorizer.Attributes) (string, error)

func isWhiteListedUser(username string) bool {
whiteList := map[string]bool{
api.UserAdmin: true,
"kubelet": true,
"kube_proxy": true,
"system:scheduler": true,
Expand Down