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
f2ea31fd
Commit
f2ea31fd
authored
Aug 12, 2017
by
m1093782566
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add validation for fed-apiserver
parent
cf80b91a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
validation.go
...ration/cmd/federation-apiserver/app/options/validation.go
+3
-0
server_run_options.go
...k8s.io/apiserver/pkg/server/options/server_run_options.go
+16
-0
No files found.
federation/cmd/federation-apiserver/app/options/validation.go
View file @
f2ea31fd
...
@@ -20,6 +20,9 @@ import "fmt"
...
@@ -20,6 +20,9 @@ import "fmt"
func
(
options
*
ServerRunOptions
)
Validate
()
[]
error
{
func
(
options
*
ServerRunOptions
)
Validate
()
[]
error
{
var
errors
[]
error
var
errors
[]
error
if
errs
:=
options
.
GenericServerRunOptions
.
Validate
();
len
(
errs
)
>
0
{
errors
=
append
(
errors
,
errs
...
)
}
if
errs
:=
options
.
Etcd
.
Validate
();
len
(
errs
)
>
0
{
if
errs
:=
options
.
Etcd
.
Validate
();
len
(
errs
)
>
0
{
errors
=
append
(
errors
,
errs
...
)
errors
=
append
(
errors
,
errs
...
)
}
}
...
...
staging/src/k8s.io/apiserver/pkg/server/options/server_run_options.go
View file @
f2ea31fd
...
@@ -83,6 +83,22 @@ func (s *ServerRunOptions) DefaultAdvertiseAddress(secure *SecureServingOptions)
...
@@ -83,6 +83,22 @@ func (s *ServerRunOptions) DefaultAdvertiseAddress(secure *SecureServingOptions)
return
nil
return
nil
}
}
// Validate checks validation of ServerRunOptions
func
(
s
*
ServerRunOptions
)
Validate
()
[]
error
{
errors
:=
[]
error
{}
if
s
.
TargetRAMMB
<
0
{
errors
=
append
(
errors
,
fmt
.
Errorf
(
"--target-ram-mb can not be negative value"
))
}
if
s
.
MaxRequestsInFlight
<
0
{
errors
=
append
(
errors
,
fmt
.
Errorf
(
"--max-requests-inflight can not be negative value"
))
}
if
s
.
MaxMutatingRequestsInFlight
<
0
{
errors
=
append
(
errors
,
fmt
.
Errorf
(
"--min-request-timeout can not be negative value"
))
}
return
errors
}
// AddFlags adds flags for a specific APIServer to the specified FlagSet
// AddFlags adds flags for a specific APIServer to the specified FlagSet
func
(
s
*
ServerRunOptions
)
AddUniversalFlags
(
fs
*
pflag
.
FlagSet
)
{
func
(
s
*
ServerRunOptions
)
AddUniversalFlags
(
fs
*
pflag
.
FlagSet
)
{
// Note: the weird ""+ in below lines seems to be the only way to get gofmt to
// Note: the weird ""+ in below lines seems to be the only way to get gofmt to
...
...
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