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
fcf2df9a
Commit
fcf2df9a
authored
Jun 26, 2017
by
xiangpengzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate --storage-backend type.
parent
53a66020
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
BUILD
staging/src/k8s.io/apiserver/pkg/server/options/BUILD
+1
-0
etcd.go
staging/src/k8s.io/apiserver/pkg/server/options/etcd.go
+11
-0
No files found.
staging/src/k8s.io/apiserver/pkg/server/options/BUILD
View file @
fcf2df9a
...
...
@@ -51,6 +51,7 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission:go_default_library",
"//vendor/k8s.io/apiserver/pkg/admission/initializer:go_default_library",
"//vendor/k8s.io/apiserver/pkg/audit:go_default_library",
...
...
staging/src/k8s.io/apiserver/pkg/server/options/etcd.go
View file @
fcf2df9a
...
...
@@ -22,6 +22,7 @@ import (
"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/registry/generic"
genericregistry
"k8s.io/apiserver/pkg/registry/generic/registry"
"k8s.io/apiserver/pkg/server"
...
...
@@ -47,6 +48,12 @@ type EtcdOptions struct {
DefaultWatchCacheSize
int
}
var
storageTypes
=
sets
.
NewString
(
storagebackend
.
StorageTypeUnset
,
storagebackend
.
StorageTypeETCD2
,
storagebackend
.
StorageTypeETCD3
,
)
func
NewEtcdOptions
(
backendConfig
*
storagebackend
.
Config
)
*
EtcdOptions
{
return
&
EtcdOptions
{
StorageConfig
:
*
backendConfig
,
...
...
@@ -64,6 +71,10 @@ func (s *EtcdOptions) Validate() []error {
allErrors
=
append
(
allErrors
,
fmt
.
Errorf
(
"--etcd-servers must be specified"
))
}
if
!
storageTypes
.
Has
(
s
.
StorageConfig
.
Type
)
{
allErrors
=
append
(
allErrors
,
fmt
.
Errorf
(
"--storage-backend invalid, must be 'etcd3' or 'etcd2'. If not specified, it will default to 'etcd3'"
))
}
return
allErrors
}
...
...
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