Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
331d9653
Commit
331d9653
authored
Jan 17, 2017
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
genericapiserver: move pkg/auth/handlers into filters
parent
8f99b744
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
100 deletions
+54
-100
BUILD
cmd/kube-aggregator/pkg/apiserver/BUILD
+24
-25
apiserver.go
cmd/kube-aggregator/pkg/apiserver/apiserver.go
+1
-2
BUILD
pkg/BUILD
+0
-1
BUILD
pkg/auth/handlers/BUILD
+0
-46
BUILD
pkg/genericapiserver/BUILD
+0
-1
BUILD
pkg/genericapiserver/api/filters/BUILD
+26
-21
authentication.go
pkg/genericapiserver/api/filters/authentication.go
+1
-1
authentication_test.go
pkg/genericapiserver/api/filters/authentication_test.go
+1
-1
config.go
pkg/genericapiserver/config.go
+1
-2
No files found.
cmd/kube-aggregator/pkg/apiserver/BUILD
View file @
331d9653
...
@@ -8,6 +8,30 @@ load(
...
@@ -8,6 +8,30 @@ load(
"go_test",
"go_test",
)
)
go_test(
name = "go_default_test",
srcs = [
"handler_apis_test.go",
"handler_proxy_test.go",
],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//cmd/kube-aggregator/pkg/apis/apiregistration:go_default_library",
"//cmd/kube-aggregator/pkg/client/listers/apiregistration/internalversion:go_default_library",
"//pkg/api:go_default_library",
"//pkg/api/v1:go_default_library",
"//pkg/client/cache:go_default_library",
"//pkg/client/listers/core/v1:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/util/diff",
"//vendor:k8s.io/apimachinery/pkg/util/sets",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
"//vendor:k8s.io/apiserver/pkg/request",
],
)
go_library(
go_library(
name = "go_default_library",
name = "go_default_library",
srcs = [
srcs = [
...
@@ -27,7 +51,6 @@ go_library(
...
@@ -27,7 +51,6 @@ go_library(
"//cmd/kube-aggregator/pkg/client/listers/apiregistration/internalversion:go_default_library",
"//cmd/kube-aggregator/pkg/client/listers/apiregistration/internalversion:go_default_library",
"//cmd/kube-aggregator/pkg/registry/apiservice/etcd:go_default_library",
"//cmd/kube-aggregator/pkg/registry/apiservice/etcd:go_default_library",
"//pkg/api:go_default_library",
"//pkg/api:go_default_library",
"//pkg/auth/handlers:go_default_library",
"//pkg/client/cache:go_default_library",
"//pkg/client/cache:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/client/informers/informers_generated:go_default_library",
"//pkg/client/informers/informers_generated:go_default_library",
...
@@ -56,30 +79,6 @@ go_library(
...
@@ -56,30 +79,6 @@ go_library(
],
],
)
)
go_test(
name = "go_default_test",
srcs = [
"handler_apis_test.go",
"handler_proxy_test.go",
],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//cmd/kube-aggregator/pkg/apis/apiregistration:go_default_library",
"//cmd/kube-aggregator/pkg/client/listers/apiregistration/internalversion:go_default_library",
"//pkg/api:go_default_library",
"//pkg/api/v1:go_default_library",
"//pkg/client/cache:go_default_library",
"//pkg/client/listers/core/v1:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/util/diff",
"//vendor:k8s.io/apimachinery/pkg/util/sets",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
"//vendor:k8s.io/apiserver/pkg/request",
],
)
filegroup(
filegroup(
name = "package-srcs",
name = "package-srcs",
srcs = glob(["**"]),
srcs = glob(["**"]),
...
...
cmd/kube-aggregator/pkg/apiserver/apiserver.go
View file @
331d9653
...
@@ -23,7 +23,6 @@ import (
...
@@ -23,7 +23,6 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/wait"
genericapirequest
"k8s.io/apiserver/pkg/request"
genericapirequest
"k8s.io/apiserver/pkg/request"
authhandlers
"k8s.io/kubernetes/pkg/auth/handlers"
kubeclientset
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
kubeclientset
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
kubeinformers
"k8s.io/kubernetes/pkg/client/informers/informers_generated"
kubeinformers
"k8s.io/kubernetes/pkg/client/informers/informers_generated"
v1listers
"k8s.io/kubernetes/pkg/client/listers/core/v1"
v1listers
"k8s.io/kubernetes/pkg/client/listers/core/v1"
...
@@ -191,7 +190,7 @@ func (h *handlerChainConfig) handlerChain(apiHandler http.Handler, c *genericapi
...
@@ -191,7 +190,7 @@ func (h *handlerChainConfig) handlerChain(apiHandler http.Handler, c *genericapi
handler
=
genericapifilters
.
WithImpersonation
(
handler
,
c
.
RequestContextMapper
,
c
.
Authorizer
)
handler
=
genericapifilters
.
WithImpersonation
(
handler
,
c
.
RequestContextMapper
,
c
.
Authorizer
)
// audit to stdout to help with debugging as we get this started
// audit to stdout to help with debugging as we get this started
handler
=
genericapifilters
.
WithAudit
(
handler
,
c
.
RequestContextMapper
,
os
.
Stdout
)
handler
=
genericapifilters
.
WithAudit
(
handler
,
c
.
RequestContextMapper
,
os
.
Stdout
)
handler
=
authhandlers
.
WithAuthentication
(
handler
,
c
.
RequestContextMapper
,
c
.
Authenticator
,
authhandl
ers
.
Unauthorized
(
c
.
SupportsBasicAuth
))
handler
=
genericapifilters
.
WithAuthentication
(
handler
,
c
.
RequestContextMapper
,
c
.
Authenticator
,
genericapifilt
ers
.
Unauthorized
(
c
.
SupportsBasicAuth
))
handler
=
genericfilters
.
WithCORS
(
handler
,
c
.
CorsAllowedOriginList
,
nil
,
nil
,
nil
,
"true"
)
handler
=
genericfilters
.
WithCORS
(
handler
,
c
.
CorsAllowedOriginList
,
nil
,
nil
,
nil
,
"true"
)
handler
=
genericfilters
.
WithPanicRecovery
(
handler
,
c
.
RequestContextMapper
)
handler
=
genericfilters
.
WithPanicRecovery
(
handler
,
c
.
RequestContextMapper
)
...
...
pkg/BUILD
View file @
331d9653
...
@@ -31,7 +31,6 @@ filegroup(
...
@@ -31,7 +31,6 @@ filegroup(
"//pkg/apis/rbac:all-srcs",
"//pkg/apis/rbac:all-srcs",
"//pkg/apis/storage:all-srcs",
"//pkg/apis/storage:all-srcs",
"//pkg/auth/authorizer/abac:all-srcs",
"//pkg/auth/authorizer/abac:all-srcs",
"//pkg/auth/handlers:all-srcs",
"//pkg/auth/user:all-srcs",
"//pkg/auth/user:all-srcs",
"//pkg/capabilities:all-srcs",
"//pkg/capabilities:all-srcs",
"//pkg/client/cache:all-srcs",
"//pkg/client/cache:all-srcs",
...
...
pkg/auth/handlers/BUILD
deleted
100644 → 0
View file @
8f99b744
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_library(
name = "go_default_library",
srcs = ["handlers.go"],
tags = ["automanaged"],
deps = [
"//vendor:github.com/golang/glog",
"//vendor:github.com/prometheus/client_golang/prometheus",
"//vendor:k8s.io/apiserver/pkg/authentication/authenticator",
"//vendor:k8s.io/apiserver/pkg/request",
],
)
go_test(
name = "go_default_test",
srcs = ["handlers_test.go"],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//vendor:k8s.io/apiserver/pkg/authentication/authenticator",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
"//vendor:k8s.io/apiserver/pkg/request",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)
pkg/genericapiserver/BUILD
View file @
331d9653
...
@@ -68,7 +68,6 @@ go_library(
...
@@ -68,7 +68,6 @@ go_library(
deps = [
deps = [
"//pkg/admission:go_default_library",
"//pkg/admission:go_default_library",
"//pkg/api:go_default_library",
"//pkg/api:go_default_library",
"//pkg/auth/handlers:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/client/restclient:go_default_library",
"//pkg/genericapiserver/api:go_default_library",
"//pkg/genericapiserver/api:go_default_library",
"//pkg/genericapiserver/api/filters:go_default_library",
"//pkg/genericapiserver/api/filters:go_default_library",
...
...
pkg/genericapiserver/api/filters/BUILD
View file @
331d9653
...
@@ -8,10 +8,34 @@ load(
...
@@ -8,10 +8,34 @@ load(
"go_test",
"go_test",
)
)
go_test(
name = "go_default_test",
srcs = [
"audit_test.go",
"authentication_test.go",
"authorization_test.go",
"impersonation_test.go",
"requestinfo_test.go",
],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//pkg/apis/authentication:go_default_library",
"//pkg/apis/batch:go_default_library",
"//pkg/genericapiserver/api/handlers/responsewriters:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/util/sets",
"//vendor:k8s.io/apiserver/pkg/authentication/authenticator",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
"//vendor:k8s.io/apiserver/pkg/authorization/authorizer",
"//vendor:k8s.io/apiserver/pkg/request",
],
)
go_library(
go_library(
name = "go_default_library",
name = "go_default_library",
srcs = [
srcs = [
"audit.go",
"audit.go",
"authentication.go",
"authorization.go",
"authorization.go",
"doc.go",
"doc.go",
"impersonation.go",
"impersonation.go",
...
@@ -24,7 +48,9 @@ go_library(
...
@@ -24,7 +48,9 @@ go_library(
"//pkg/genericapiserver/api/handlers/responsewriters:go_default_library",
"//pkg/genericapiserver/api/handlers/responsewriters:go_default_library",
"//vendor:github.com/golang/glog",
"//vendor:github.com/golang/glog",
"//vendor:github.com/pborman/uuid",
"//vendor:github.com/pborman/uuid",
"//vendor:github.com/prometheus/client_golang/prometheus",
"//vendor:k8s.io/apimachinery/pkg/util/net",
"//vendor:k8s.io/apimachinery/pkg/util/net",
"//vendor:k8s.io/apiserver/pkg/authentication/authenticator",
"//vendor:k8s.io/apiserver/pkg/authentication/serviceaccount",
"//vendor:k8s.io/apiserver/pkg/authentication/serviceaccount",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
"//vendor:k8s.io/apiserver/pkg/authorization/authorizer",
"//vendor:k8s.io/apiserver/pkg/authorization/authorizer",
...
@@ -33,27 +59,6 @@ go_library(
...
@@ -33,27 +59,6 @@ go_library(
],
],
)
)
go_test(
name = "go_default_test",
srcs = [
"audit_test.go",
"authorization_test.go",
"impersonation_test.go",
"requestinfo_test.go",
],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//pkg/apis/authentication:go_default_library",
"//pkg/apis/batch:go_default_library",
"//pkg/genericapiserver/api/handlers/responsewriters:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/util/sets",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
"//vendor:k8s.io/apiserver/pkg/authorization/authorizer",
"//vendor:k8s.io/apiserver/pkg/request",
],
)
filegroup(
filegroup(
name = "package-srcs",
name = "package-srcs",
srcs = glob(["**"]),
srcs = glob(["**"]),
...
...
pkg/
auth/handlers/handlers
.go
→
pkg/
genericapiserver/api/filters/authentication
.go
View file @
331d9653
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
handl
ers
package
filt
ers
import
(
import
(
"net/http"
"net/http"
...
...
pkg/
auth/handlers/handlers
_test.go
→
pkg/
genericapiserver/api/filters/authentication
_test.go
View file @
331d9653
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
handl
ers
package
filt
ers
import
(
import
(
"errors"
"errors"
...
...
pkg/genericapiserver/config.go
View file @
331d9653
...
@@ -50,7 +50,6 @@ import (
...
@@ -50,7 +50,6 @@ import (
apirequest
"k8s.io/apiserver/pkg/request"
apirequest
"k8s.io/apiserver/pkg/request"
"k8s.io/kubernetes/pkg/admission"
"k8s.io/kubernetes/pkg/admission"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
authhandlers
"k8s.io/kubernetes/pkg/auth/handlers"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/restclient"
genericapifilters
"k8s.io/kubernetes/pkg/genericapiserver/api/filters"
genericapifilters
"k8s.io/kubernetes/pkg/genericapiserver/api/filters"
apiopenapi
"k8s.io/kubernetes/pkg/genericapiserver/api/openapi"
apiopenapi
"k8s.io/kubernetes/pkg/genericapiserver/api/openapi"
...
@@ -573,7 +572,7 @@ func DefaultBuildHandlerChain(apiHandler http.Handler, c *Config) (secure, insec
...
@@ -573,7 +572,7 @@ func DefaultBuildHandlerChain(apiHandler http.Handler, c *Config) (secure, insec
handler
=
genericapifilters
.
WithAuthorization
(
handler
,
c
.
RequestContextMapper
,
c
.
Authorizer
)
handler
=
genericapifilters
.
WithAuthorization
(
handler
,
c
.
RequestContextMapper
,
c
.
Authorizer
)
handler
=
genericapifilters
.
WithImpersonation
(
handler
,
c
.
RequestContextMapper
,
c
.
Authorizer
)
handler
=
genericapifilters
.
WithImpersonation
(
handler
,
c
.
RequestContextMapper
,
c
.
Authorizer
)
handler
=
audit
(
handler
)
// before impersonation to read original user
handler
=
audit
(
handler
)
// before impersonation to read original user
handler
=
authhandlers
.
WithAuthentication
(
handler
,
c
.
RequestContextMapper
,
c
.
Authenticator
,
authhandl
ers
.
Unauthorized
(
c
.
SupportsBasicAuth
))
handler
=
genericapifilters
.
WithAuthentication
(
handler
,
c
.
RequestContextMapper
,
c
.
Authenticator
,
genericapifilt
ers
.
Unauthorized
(
c
.
SupportsBasicAuth
))
return
handler
return
handler
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment