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
cecd663c
Commit
cecd663c
authored
Feb 08, 2018
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
controller-manager: add authz/n to options, nil by default
parent
f4564ea0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
1 deletion
+35
-1
config.go
cmd/controller-manager/app/config.go
+2
-0
options.go
cmd/controller-manager/app/options/options.go
+14
-0
serve.go
cmd/controller-manager/app/serve.go
+15
-1
authentication.go
...src/k8s.io/apiserver/pkg/server/options/authentication.go
+4
-0
No files found.
cmd/controller-manager/app/config.go
View file @
cecd663c
...
...
@@ -32,6 +32,8 @@ type Config struct {
SecureServing
*
apiserver
.
SecureServingInfo
// TODO: remove deprecated insecure serving
InsecureServing
*
InsecureServingInfo
Authentication
apiserver
.
AuthenticationInfo
Authorization
apiserver
.
AuthorizationInfo
// the general kube client
Client
*
clientset
.
Clientset
...
...
cmd/controller-manager/app/options/options.go
View file @
cecd663c
...
...
@@ -48,6 +48,8 @@ type GenericControllerManagerOptions struct {
SecureServing
*
apiserveroptions
.
SecureServingOptions
// TODO: remove insecure serving mode
InsecureServing
*
InsecureServingOptions
Authentication
*
apiserveroptions
.
DelegatingAuthenticationOptions
Authorization
*
apiserveroptions
.
DelegatingAuthorizationOptions
Master
string
Kubeconfig
string
...
...
@@ -75,6 +77,8 @@ func NewGenericControllerManagerOptions(componentConfig componentconfig.KubeCont
BindPort
:
int
(
componentConfig
.
Port
),
BindNetwork
:
"tcp"
,
},
Authentication
:
nil
,
// TODO: enable with apiserveroptions.NewDelegatingAuthenticationOptions()
Authorization
:
nil
,
// TODO: enable with apiserveroptions.NewDelegatingAuthorizationOptions()
}
// disable secure serving for now
...
...
@@ -175,6 +179,8 @@ func (o *GenericControllerManagerOptions) AddFlags(fs *pflag.FlagSet) {
o
.
SecureServing
.
AddFlags
(
fs
)
o
.
InsecureServing
.
AddFlags
(
fs
)
o
.
InsecureServing
.
AddDeprecatedFlags
(
fs
)
o
.
Authentication
.
AddFlags
(
fs
)
o
.
Authorization
.
AddFlags
(
fs
)
}
// ApplyTo fills up controller manager config with options and userAgent
...
...
@@ -187,6 +193,12 @@ func (o *GenericControllerManagerOptions) ApplyTo(c *genericcontrollermanager.Co
if
err
:=
o
.
InsecureServing
.
ApplyTo
(
&
c
.
InsecureServing
,
&
c
.
ComponentConfig
);
err
!=
nil
{
return
err
}
if
err
:=
o
.
Authentication
.
ApplyTo
(
&
c
.
Authentication
,
c
.
SecureServing
,
nil
);
err
!=
nil
{
return
err
}
if
err
:=
o
.
Authorization
.
ApplyTo
(
&
c
.
Authorization
);
err
!=
nil
{
return
err
}
var
err
error
c
.
Kubeconfig
,
err
=
clientcmd
.
BuildConfigFromFlags
(
o
.
Master
,
o
.
Kubeconfig
)
...
...
@@ -214,6 +226,8 @@ func (o *GenericControllerManagerOptions) Validate() []error {
errors
:=
[]
error
{}
errors
=
append
(
errors
,
o
.
SecureServing
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
InsecureServing
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
Authentication
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
Authorization
.
Validate
()
...
)
// TODO: validate component config, master and kubeconfig
...
...
cmd/controller-manager/app/serve.go
View file @
cecd663c
...
...
@@ -24,7 +24,11 @@ import (
"github.com/prometheus/client_golang/prometheus"
genericapifilters
"k8s.io/apiserver/pkg/endpoints/filters"
apirequest
"k8s.io/apiserver/pkg/endpoints/request"
genericfilters
"k8s.io/apiserver/pkg/server/filters"
"k8s.io/apiserver/pkg/server/healthz"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/util/configz"
)
...
...
@@ -47,5 +51,15 @@ func Serve(c *CompletedConfig, serveFunc serveFunc, stopCh <-chan struct{}) erro
configz
.
InstallHandler
(
mux
)
mux
.
Handle
(
"/metrics"
,
prometheus
.
Handler
())
return
serveFunc
(
mux
,
0
,
stopCh
)
requestContextMapper
:=
apirequest
.
NewRequestContextMapper
()
requestInfoResolver
:=
&
apirequest
.
RequestInfoFactory
{}
failedHandler
:=
genericapifilters
.
Unauthorized
(
requestContextMapper
,
legacyscheme
.
Codecs
,
false
)
handler
:=
genericapifilters
.
WithAuthorization
(
mux
,
requestContextMapper
,
c
.
Authorization
.
Authorizer
,
legacyscheme
.
Codecs
)
handler
=
genericapifilters
.
WithAuthentication
(
handler
,
requestContextMapper
,
c
.
Authentication
.
Authenticator
,
failedHandler
)
handler
=
genericapifilters
.
WithRequestInfo
(
handler
,
requestInfoResolver
,
requestContextMapper
)
handler
=
apirequest
.
WithRequestContext
(
handler
,
requestContextMapper
)
handler
=
genericfilters
.
WithPanicRecovery
(
handler
)
return
serveFunc
(
handler
,
0
,
stopCh
)
}
staging/src/k8s.io/apiserver/pkg/server/options/authentication.go
View file @
cecd663c
...
...
@@ -131,6 +131,10 @@ func (s *DelegatingAuthenticationOptions) Validate() []error {
}
func
(
s
*
DelegatingAuthenticationOptions
)
AddFlags
(
fs
*
pflag
.
FlagSet
)
{
if
s
==
nil
{
return
}
fs
.
StringVar
(
&
s
.
RemoteKubeConfigFile
,
"authentication-kubeconfig"
,
s
.
RemoteKubeConfigFile
,
""
+
"kubeconfig file pointing at the 'core' kubernetes server with enough rights to create "
+
"tokenaccessreviews.authentication.k8s.io."
)
...
...
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