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
50de3a0d
Unverified
Commit
50de3a0d
authored
Nov 06, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #69659 from cheftako/lintClean3
Fixes lint errors in kubeapiserver packages
parents
8dcdec0a
2af982ab
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
31 additions
and
24 deletions
+31
-24
server.go
cmd/kube-apiserver/app/server.go
+1
-1
.golint_failures
hack/.golint_failures
+0
-4
config.go
pkg/kubeapiserver/admission/config.go
+4
-3
initializer_test.go
pkg/kubeapiserver/admission/initializer_test.go
+2
-2
config.go
pkg/kubeapiserver/authenticator/config.go
+4
-2
config.go
pkg/kubeapiserver/authorizer/config.go
+3
-2
modes.go
pkg/kubeapiserver/authorizer/modes/modes.go
+12
-5
authentication.go
pkg/kubeapiserver/options/authentication.go
+2
-2
authentication_test.go
pkg/kubeapiserver/options/authentication_test.go
+1
-1
authorization.go
pkg/kubeapiserver/options/authorization.go
+2
-2
No files found.
cmd/kube-apiserver/app/server.go
View file @
50de3a0d
...
...
@@ -504,7 +504,7 @@ func buildGenericConfig(
genericConfig
.
DisabledPostStartHooks
.
Insert
(
rbacrest
.
PostStartHookName
)
}
admissionConfig
:=
&
kubeapiserveradmission
.
Admission
Config
{
admissionConfig
:=
&
kubeapiserveradmission
.
Config
{
ExternalInformers
:
versionedInformers
,
LoopbackClientConfig
:
genericConfig
.
LoopbackClientConfig
,
CloudConfigFile
:
s
.
CloudProvider
.
CloudConfigFile
,
...
...
hack/.golint_failures
View file @
50de3a0d
...
...
@@ -134,10 +134,6 @@ pkg/credentialprovider/gcp
pkg/credentialprovider/rancher
pkg/features
pkg/kubeapiserver
pkg/kubeapiserver/admission
pkg/kubeapiserver/authenticator
pkg/kubeapiserver/authorizer
pkg/kubeapiserver/authorizer/modes
pkg/kubeapiserver/options
pkg/kubectl
pkg/kubectl/apps
...
...
pkg/kubeapiserver/admission/config.go
View file @
50de3a0d
...
...
@@ -37,14 +37,15 @@ import (
quotainstall
"k8s.io/kubernetes/pkg/quota/v1/install"
)
//
AdmissionConfig holds the configuration for initializing
the admission plugins
type
Admission
Config
struct
{
//
Config holds the configuration needed to for initialize
the admission plugins
type
Config
struct
{
CloudConfigFile
string
LoopbackClientConfig
*
rest
.
Config
ExternalInformers
externalinformers
.
SharedInformerFactory
}
func
(
c
*
AdmissionConfig
)
New
(
proxyTransport
*
http
.
Transport
,
serviceResolver
webhook
.
ServiceResolver
)
([]
admission
.
PluginInitializer
,
server
.
PostStartHookFunc
,
error
)
{
// New sets up the plugins and admission start hooks needed for admission
func
(
c
*
Config
)
New
(
proxyTransport
*
http
.
Transport
,
serviceResolver
webhook
.
ServiceResolver
)
([]
admission
.
PluginInitializer
,
server
.
PostStartHookFunc
,
error
)
{
webhookAuthResolverWrapper
:=
webhook
.
NewDefaultAuthenticationInfoResolverWrapper
(
proxyTransport
,
c
.
LoopbackClientConfig
)
webhookPluginInitializer
:=
webhookinit
.
NewPluginInitializer
(
webhookAuthResolverWrapper
,
serviceResolver
)
...
...
pkg/kubeapiserver/admission/initializer_test.go
View file @
50de3a0d
...
...
@@ -33,8 +33,8 @@ type WantsCloudConfigAdmissionPlugin struct {
cloudConfig
[]
byte
}
func
(
self
*
WantsCloudConfigAdmissionPlugin
)
SetCloudConfig
(
cloudConfig
[]
byte
)
{
self
.
cloudConfig
=
cloudConfig
func
(
p
*
WantsCloudConfigAdmissionPlugin
)
SetCloudConfig
(
cloudConfig
[]
byte
)
{
p
.
cloudConfig
=
cloudConfig
}
func
TestCloudConfigAdmissionPlugin
(
t
*
testing
.
T
)
{
...
...
pkg/kubeapiserver/authenticator/config.go
View file @
50de3a0d
...
...
@@ -38,13 +38,15 @@ import (
"k8s.io/apiserver/plugin/pkg/authenticator/request/basicauth"
"k8s.io/apiserver/plugin/pkg/authenticator/token/oidc"
"k8s.io/apiserver/plugin/pkg/authenticator/token/webhook"
// Initialize all known client auth plugins.
_
"k8s.io/client-go/plugin/pkg/client/auth"
certutil
"k8s.io/client-go/util/cert"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/serviceaccount"
)
type
AuthenticatorConfig
struct
{
// Config contains the data on how to authenticate a request to the Kube API Server
type
Config
struct
{
Anonymous
bool
BasicAuthFile
string
BootstrapToken
bool
...
...
@@ -78,7 +80,7 @@ type AuthenticatorConfig struct {
// New returns an authenticator.Request or an error that supports the standard
// Kubernetes authentication mechanisms.
func
(
config
Authenticator
Config
)
New
()
(
authenticator
.
Request
,
*
spec
.
SecurityDefinitions
,
error
)
{
func
(
config
Config
)
New
()
(
authenticator
.
Request
,
*
spec
.
SecurityDefinitions
,
error
)
{
var
authenticators
[]
authenticator
.
Request
var
tokenAuthenticators
[]
authenticator
.
Token
securityDefinitions
:=
spec
.
SecurityDefinitions
{}
...
...
pkg/kubeapiserver/authorizer/config.go
View file @
50de3a0d
...
...
@@ -33,7 +33,8 @@ import (
"k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/bootstrappolicy"
)
type
AuthorizationConfig
struct
{
// Config contains the data on how to authorize a request to the Kube API Server
type
Config
struct
{
AuthorizationModes
[]
string
// Options for ModeABAC
...
...
@@ -55,7 +56,7 @@ type AuthorizationConfig struct {
// New returns the right sort of union of multiple authorizer.Authorizer objects
// based on the authorizationMode or an error.
func
(
config
Authorization
Config
)
New
()
(
authorizer
.
Authorizer
,
authorizer
.
RuleResolver
,
error
)
{
func
(
config
Config
)
New
()
(
authorizer
.
Authorizer
,
authorizer
.
RuleResolver
,
error
)
{
if
len
(
config
.
AuthorizationModes
)
==
0
{
return
nil
,
nil
,
fmt
.
Errorf
(
"at least one authorization mode must be passed"
)
}
...
...
pkg/kubeapiserver/authorizer/modes/modes.go
View file @
50de3a0d
...
...
@@ -19,14 +19,21 @@ package modes
import
"k8s.io/apimachinery/pkg/util/sets"
const
(
// ModeAlwaysAllow is the mode to set all requests as authorized
ModeAlwaysAllow
string
=
"AlwaysAllow"
ModeAlwaysDeny
string
=
"AlwaysDeny"
ModeABAC
string
=
"ABAC"
ModeWebhook
string
=
"Webhook"
ModeRBAC
string
=
"RBAC"
ModeNode
string
=
"Node"
// ModeAlwaysDeny is the mode to set no requests as authorized
ModeAlwaysDeny
string
=
"AlwaysDeny"
// ModeABAC is the mode to use Attribute Based Access Control to authorize
ModeABAC
string
=
"ABAC"
// ModeWebhook is the mode to make an external webhook call to authorize
ModeWebhook
string
=
"Webhook"
// ModeRBAC is the mode to use Role Based Access Control to authorize
ModeRBAC
string
=
"RBAC"
// ModeNode is an authorization mode that authorizes API requests made by kubelets.
ModeNode
string
=
"Node"
)
// AuthorizationModeChoices is the list of supported authorization modes
var
AuthorizationModeChoices
=
[]
string
{
ModeAlwaysAllow
,
ModeAlwaysDeny
,
ModeABAC
,
ModeWebhook
,
ModeRBAC
,
ModeNode
}
// IsValidAuthorizationMode returns true if the given authorization mode is a valid one for the apiserver
...
...
pkg/kubeapiserver/options/authentication.go
View file @
50de3a0d
...
...
@@ -292,8 +292,8 @@ func (s *BuiltInAuthenticationOptions) AddFlags(fs *pflag.FlagSet) {
}
}
func
(
s
*
BuiltInAuthenticationOptions
)
ToAuthenticationConfig
()
kubeauthenticator
.
Authenticator
Config
{
ret
:=
kubeauthenticator
.
Authenticator
Config
{
func
(
s
*
BuiltInAuthenticationOptions
)
ToAuthenticationConfig
()
kubeauthenticator
.
Config
{
ret
:=
kubeauthenticator
.
Config
{
TokenSuccessCacheTTL
:
s
.
TokenSuccessCacheTTL
,
TokenFailureCacheTTL
:
s
.
TokenFailureCacheTTL
,
}
...
...
pkg/kubeapiserver/options/authentication_test.go
View file @
50de3a0d
...
...
@@ -138,7 +138,7 @@ func TestToAuthenticationConfig(t *testing.T) {
TokenFailureCacheTTL
:
0
,
}
expectConfig
:=
kubeauthenticator
.
Authenticator
Config
{
expectConfig
:=
kubeauthenticator
.
Config
{
APIAudiences
:
authenticator
.
Audiences
{
"http://foo.bar.com"
},
Anonymous
:
false
,
BasicAuthFile
:
"/testBasicAuthFile"
,
...
...
pkg/kubeapiserver/options/authorization.go
View file @
50de3a0d
...
...
@@ -109,8 +109,8 @@ func (s *BuiltInAuthorizationOptions) AddFlags(fs *pflag.FlagSet) {
"The duration to cache 'unauthorized' responses from the webhook authorizer."
)
}
func
(
s
*
BuiltInAuthorizationOptions
)
ToAuthorizationConfig
(
versionedInformerFactory
versionedinformers
.
SharedInformerFactory
)
authorizer
.
Authorization
Config
{
return
authorizer
.
Authorization
Config
{
func
(
s
*
BuiltInAuthorizationOptions
)
ToAuthorizationConfig
(
versionedInformerFactory
versionedinformers
.
SharedInformerFactory
)
authorizer
.
Config
{
return
authorizer
.
Config
{
AuthorizationModes
:
s
.
Modes
,
PolicyFile
:
s
.
PolicyFile
,
WebhookConfigFile
:
s
.
WebhookConfigFile
,
...
...
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