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
9992abdf
Commit
9992abdf
authored
Feb 02, 2015
by
Alex Robinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3997 from smarterclayton/make_master_index_optional
Make master index optional when master is used in other contexts
parents
efd71793
42175b43
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
12 deletions
+29
-12
master.go
pkg/master/master.go
+19
-12
server.go
pkg/master/server/server.go
+1
-0
standalone.go
pkg/standalone/standalone.go
+1
-0
auth_test.go
test/integration/auth_test.go
+8
-0
No files found.
pkg/master/master.go
View file @
9992abdf
...
...
@@ -66,17 +66,21 @@ import (
// Config is a structure used to configure a Master.
type
Config
struct
{
Client
*
client
.
Client
Cloud
cloudprovider
.
Interface
EtcdHelper
tools
.
EtcdHelper
EventTTL
time
.
Duration
MinionRegexp
string
KubeletClient
client
.
KubeletClient
PortalNet
*
net
.
IPNet
EnableLogsSupport
bool
EnableUISupport
bool
EnableSwaggerSupport
bool
EnableV1Beta3
bool
Client
*
client
.
Client
Cloud
cloudprovider
.
Interface
EtcdHelper
tools
.
EtcdHelper
EventTTL
time
.
Duration
MinionRegexp
string
KubeletClient
client
.
KubeletClient
PortalNet
*
net
.
IPNet
EnableLogsSupport
bool
EnableUISupport
bool
// allow downstream consumers to disable swagger
EnableSwaggerSupport
bool
// allow v1beta3 to be conditionally enabled
EnableV1Beta3
bool
// allow downstream consumers to disable the index route
EnableIndex
bool
APIPrefix
string
CorsAllowedOriginList
util
.
StringList
Authenticator
authenticator
.
Request
...
...
@@ -418,7 +422,10 @@ func (m *Master) init(c *Config) {
// Register root handler.
// We do not register this using restful Webservice since we do not want to surface this in api docs.
m
.
mux
.
HandleFunc
(
"/"
,
apiserver
.
IndexHandler
(
m
.
handlerContainer
,
m
.
muxHelper
))
// Allow master to be embedded in contexts which already have something registered at the root
if
c
.
EnableIndex
{
m
.
mux
.
HandleFunc
(
"/"
,
apiserver
.
IndexHandler
(
m
.
handlerContainer
,
m
.
muxHelper
))
}
// TODO: use go-restful
apiserver
.
InstallValidator
(
m
.
muxHelper
,
func
()
map
[
string
]
apiserver
.
Server
{
return
m
.
getServersToValidate
(
c
)
})
...
...
pkg/master/server/server.go
View file @
9992abdf
...
...
@@ -247,6 +247,7 @@ func (s *APIServer) Run(_ []string) error {
EnableLogsSupport
:
s
.
EnableLogsSupport
,
EnableUISupport
:
true
,
EnableSwaggerSupport
:
true
,
EnableIndex
:
true
,
APIPrefix
:
s
.
APIPrefix
,
CorsAllowedOriginList
:
s
.
CorsAllowedOriginList
,
ReadOnlyPort
:
s
.
ReadOnlyPort
,
...
...
pkg/standalone/standalone.go
View file @
9992abdf
...
...
@@ -107,6 +107,7 @@ func RunApiServer(cl *client.Client, etcdClient tools.EtcdClient, addr net.IP, p
},
EnableLogsSupport
:
false
,
EnableSwaggerSupport
:
true
,
EnableIndex
:
true
,
APIPrefix
:
"/api"
,
Authorizer
:
apiserver
.
NewAlwaysAllowAuthorizer
(),
...
...
test/integration/auth_test.go
View file @
9992abdf
...
...
@@ -302,6 +302,7 @@ func TestAuthModeAlwaysAllow(t *testing.T) {
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
EnableUISupport
:
false
,
EnableIndex
:
true
,
APIPrefix
:
"/api"
,
Authorizer
:
apiserver
.
NewAlwaysAllowAuthorizer
(),
AdmissionControl
:
admit
.
NewAlwaysAdmit
(),
...
...
@@ -353,6 +354,7 @@ func TestAuthModeAlwaysDeny(t *testing.T) {
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
EnableUISupport
:
false
,
EnableIndex
:
true
,
APIPrefix
:
"/api"
,
Authorizer
:
apiserver
.
NewAlwaysDenyAuthorizer
(),
AdmissionControl
:
admit
.
NewAlwaysAdmit
(),
...
...
@@ -418,6 +420,7 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
EnableUISupport
:
false
,
EnableIndex
:
true
,
APIPrefix
:
"/api"
,
Authenticator
:
getTestTokenAuth
(),
Authorizer
:
allowAliceAuthorizer
{},
...
...
@@ -478,6 +481,7 @@ func TestBobIsForbidden(t *testing.T) {
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
EnableUISupport
:
false
,
EnableIndex
:
true
,
APIPrefix
:
"/api"
,
Authenticator
:
getTestTokenAuth
(),
Authorizer
:
allowAliceAuthorizer
{},
...
...
@@ -538,6 +542,7 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
EnableUISupport
:
false
,
EnableIndex
:
true
,
APIPrefix
:
"/api"
,
Authenticator
:
getTestTokenAuth
(),
Authorizer
:
allowAliceAuthorizer
{},
...
...
@@ -617,6 +622,7 @@ func TestNamespaceAuthorization(t *testing.T) {
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
EnableUISupport
:
false
,
EnableIndex
:
true
,
APIPrefix
:
"/api"
,
Authenticator
:
getTestTokenAuth
(),
Authorizer
:
a
,
...
...
@@ -701,6 +707,7 @@ func TestKindAuthorization(t *testing.T) {
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
EnableUISupport
:
false
,
EnableIndex
:
true
,
APIPrefix
:
"/api"
,
Authenticator
:
getTestTokenAuth
(),
Authorizer
:
a
,
...
...
@@ -779,6 +786,7 @@ func TestReadOnlyAuthorization(t *testing.T) {
KubeletClient
:
client
.
FakeKubeletClient
{},
EnableLogsSupport
:
false
,
EnableUISupport
:
false
,
EnableIndex
:
true
,
APIPrefix
:
"/api"
,
Authenticator
:
getTestTokenAuth
(),
Authorizer
:
a
,
...
...
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