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
b153268d
Commit
b153268d
authored
Sep 07, 2017
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apiserver: avoid panics on nil sub-option structs
parent
2b64d3a0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
0 deletions
+60
-0
audit.go
staging/src/k8s.io/apiserver/pkg/server/options/audit.go
+12
-0
authentication.go
...src/k8s.io/apiserver/pkg/server/options/authentication.go
+4
-0
authorization.go
.../src/k8s.io/apiserver/pkg/server/options/authorization.go
+4
-0
coreapi.go
staging/src/k8s.io/apiserver/pkg/server/options/coreapi.go
+4
-0
etcd.go
staging/src/k8s.io/apiserver/pkg/server/options/etcd.go
+12
-0
feature.go
staging/src/k8s.io/apiserver/pkg/server/options/feature.go
+12
-0
serving.go
staging/src/k8s.io/apiserver/pkg/server/options/serving.go
+12
-0
No files found.
staging/src/k8s.io/apiserver/pkg/server/options/audit.go
View file @
b153268d
...
...
@@ -87,6 +87,10 @@ func NewAuditOptions() *AuditOptions {
// Validate checks invalid config combination
func
(
o
*
AuditOptions
)
Validate
()
[]
error
{
if
o
==
nil
{
return
nil
}
allErrors
:=
[]
error
{}
if
!
advancedAuditingEnabled
()
{
...
...
@@ -137,6 +141,10 @@ func (o *AuditOptions) Validate() []error {
}
func
(
o
*
AuditOptions
)
AddFlags
(
fs
*
pflag
.
FlagSet
)
{
if
o
==
nil
{
return
}
fs
.
StringVar
(
&
o
.
PolicyFile
,
"audit-policy-file"
,
o
.
PolicyFile
,
"Path to the file that defines the audit policy configuration. Requires the 'AdvancedAuditing' feature gate."
+
" With AdvancedAuditing, a profile is required to enable auditing."
)
...
...
@@ -146,6 +154,10 @@ func (o *AuditOptions) AddFlags(fs *pflag.FlagSet) {
}
func
(
o
*
AuditOptions
)
ApplyTo
(
c
*
server
.
Config
)
error
{
if
o
==
nil
{
return
nil
}
// Apply legacy audit options if advanced audit is not enabled.
if
!
advancedAuditingEnabled
()
{
return
o
.
LogOptions
.
legacyApplyTo
(
c
)
...
...
staging/src/k8s.io/apiserver/pkg/server/options/authentication.go
View file @
b153268d
...
...
@@ -43,6 +43,10 @@ type RequestHeaderAuthenticationOptions struct {
}
func
(
s
*
RequestHeaderAuthenticationOptions
)
AddFlags
(
fs
*
pflag
.
FlagSet
)
{
if
s
==
nil
{
return
}
fs
.
StringSliceVar
(
&
s
.
UsernameHeaders
,
"requestheader-username-headers"
,
s
.
UsernameHeaders
,
""
+
"List of request headers to inspect for usernames. X-Remote-User is common."
)
...
...
staging/src/k8s.io/apiserver/pkg/server/options/authorization.go
View file @
b153268d
...
...
@@ -57,6 +57,10 @@ func (s *DelegatingAuthorizationOptions) Validate() []error {
}
func
(
s
*
DelegatingAuthorizationOptions
)
AddFlags
(
fs
*
pflag
.
FlagSet
)
{
if
s
==
nil
{
return
}
fs
.
StringVar
(
&
s
.
RemoteKubeConfigFile
,
"authorization-kubeconfig"
,
s
.
RemoteKubeConfigFile
,
""
+
"kubeconfig file pointing at the 'core' kubernetes server with enough rights to create "
+
" subjectaccessreviews.authorization.k8s.io."
)
...
...
staging/src/k8s.io/apiserver/pkg/server/options/coreapi.go
View file @
b153268d
...
...
@@ -40,6 +40,10 @@ func NewCoreAPIOptions() *CoreAPIOptions {
}
func
(
o
*
CoreAPIOptions
)
AddFlags
(
fs
*
pflag
.
FlagSet
)
{
if
o
==
nil
{
return
}
fs
.
StringVar
(
&
o
.
CoreAPIKubeconfigPath
,
"kubeconfig"
,
o
.
CoreAPIKubeconfigPath
,
"kubeconfig file pointing at the 'core' kubernetes server."
)
}
...
...
staging/src/k8s.io/apiserver/pkg/server/options/etcd.go
View file @
b153268d
...
...
@@ -71,6 +71,10 @@ func NewEtcdOptions(backendConfig *storagebackend.Config) *EtcdOptions {
}
func
(
s
*
EtcdOptions
)
Validate
()
[]
error
{
if
s
==
nil
{
return
nil
}
allErrors
:=
[]
error
{}
if
len
(
s
.
StorageConfig
.
ServerList
)
==
0
{
allErrors
=
append
(
allErrors
,
fmt
.
Errorf
(
"--etcd-servers must be specified"
))
...
...
@@ -85,6 +89,10 @@ func (s *EtcdOptions) Validate() []error {
// AddEtcdFlags adds flags related to etcd storage for a specific APIServer to the specified FlagSet
func
(
s
*
EtcdOptions
)
AddFlags
(
fs
*
pflag
.
FlagSet
)
{
if
s
==
nil
{
return
}
fs
.
StringSliceVar
(
&
s
.
EtcdServersOverrides
,
"etcd-servers-overrides"
,
s
.
EtcdServersOverrides
,
""
+
"Per-resource etcd servers overrides, comma separated. The individual override "
+
"format: group/resource#servers, where servers are http://ip:port, semicolon separated."
)
...
...
@@ -132,6 +140,10 @@ func (s *EtcdOptions) AddFlags(fs *pflag.FlagSet) {
}
func
(
s
*
EtcdOptions
)
ApplyTo
(
c
*
server
.
Config
)
error
{
if
s
==
nil
{
return
nil
}
s
.
addEtcdHealthEndpoint
(
c
)
c
.
RESTOptionsGetter
=
&
SimpleRestOptionsFactory
{
Options
:
*
s
}
return
nil
...
...
staging/src/k8s.io/apiserver/pkg/server/options/feature.go
View file @
b153268d
...
...
@@ -40,6 +40,10 @@ func NewFeatureOptions() *FeatureOptions {
}
func
(
o
*
FeatureOptions
)
AddFlags
(
fs
*
pflag
.
FlagSet
)
{
if
o
==
nil
{
return
}
fs
.
BoolVar
(
&
o
.
EnableProfiling
,
"profiling"
,
o
.
EnableProfiling
,
"Enable profiling via web interface host:port/debug/pprof/"
)
fs
.
BoolVar
(
&
o
.
EnableContentionProfiling
,
"contention-profiling"
,
o
.
EnableContentionProfiling
,
...
...
@@ -49,6 +53,10 @@ func (o *FeatureOptions) AddFlags(fs *pflag.FlagSet) {
}
func
(
o
*
FeatureOptions
)
ApplyTo
(
c
*
server
.
Config
)
error
{
if
o
==
nil
{
return
nil
}
c
.
EnableProfiling
=
o
.
EnableProfiling
c
.
EnableContentionProfiling
=
o
.
EnableContentionProfiling
c
.
EnableSwaggerUI
=
o
.
EnableSwaggerUI
...
...
@@ -57,6 +65,10 @@ func (o *FeatureOptions) ApplyTo(c *server.Config) error {
}
func
(
o
*
FeatureOptions
)
Validate
()
[]
error
{
if
o
==
nil
{
return
nil
}
errs
:=
[]
error
{}
return
errs
}
staging/src/k8s.io/apiserver/pkg/server/options/serving.go
View file @
b153268d
...
...
@@ -81,6 +81,10 @@ func (s *SecureServingOptions) DefaultExternalAddress() (net.IP, error) {
}
func
(
s
*
SecureServingOptions
)
Validate
()
[]
error
{
if
s
==
nil
{
return
nil
}
errors
:=
[]
error
{}
if
s
.
BindPort
<
0
||
s
.
BindPort
>
65535
{
...
...
@@ -91,6 +95,10 @@ func (s *SecureServingOptions) Validate() []error {
}
func
(
s
*
SecureServingOptions
)
AddFlags
(
fs
*
pflag
.
FlagSet
)
{
if
s
==
nil
{
return
}
fs
.
IPVar
(
&
s
.
BindAddress
,
"bind-address"
,
s
.
BindAddress
,
""
+
"The IP address on which to listen for the --secure-port port. The "
+
"associated interface(s) must be reachable by the rest of the cluster, and by CLI/web "
+
...
...
@@ -136,6 +144,10 @@ func (s *SecureServingOptions) AddDeprecatedFlags(fs *pflag.FlagSet) {
// ApplyTo fills up serving information in the server configuration.
func
(
s
*
SecureServingOptions
)
ApplyTo
(
c
*
server
.
Config
)
error
{
if
s
==
nil
{
return
nil
}
if
s
.
BindPort
<=
0
{
return
nil
}
...
...
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