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
99b8222e
Commit
99b8222e
authored
Nov 16, 2019
by
galal-hussein
Committed by
Craig Jellick
Nov 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change storage to datastore
parent
bdf9dd2b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
39 deletions
+39
-39
server.go
pkg/cli/cmds/server.go
+19
-19
server.go
pkg/cli/server/server.go
+4
-4
cluster.go
pkg/cluster/cluster.go
+3
-3
dqlite.go
pkg/cluster/dqlite.go
+4
-4
types.go
pkg/daemons/config/types.go
+1
-1
server.go
pkg/daemons/control/server.go
+8
-8
No files found.
pkg/cli/cmds/server.go
View file @
99b8222e
...
...
@@ -28,10 +28,10 @@ type Server struct {
ExtraControllerArgs
cli
.
StringSlice
ExtraCloudControllerArgs
cli
.
StringSlice
Rootless
bool
StorageEndpoint
string
StorageCAFile
string
StorageCertFile
string
StorageKeyFile
string
DatastoreEndpoint
string
DatastoreCAFile
string
DatastoreCertFile
string
DatastoreKeyFile
string
AdvertiseIP
string
AdvertisePort
int
DisableScheduler
bool
...
...
@@ -163,28 +163,28 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
Value
:
&
ServerConfig
.
ExtraCloudControllerArgs
,
},
cli
.
StringFlag
{
Name
:
"
storag
e-endpoint"
,
Name
:
"
datastor
e-endpoint"
,
Usage
:
"(db) Specify etcd, Mysql, Postgres, or Sqlite (default) data source name"
,
Destination
:
&
ServerConfig
.
Storag
eEndpoint
,
EnvVar
:
"K3S_
STORAG
E_ENDPOINT"
,
Destination
:
&
ServerConfig
.
Datastor
eEndpoint
,
EnvVar
:
"K3S_
DATASTOR
E_ENDPOINT"
,
},
cli
.
StringFlag
{
Name
:
"
storag
e-cafile"
,
Usage
:
"(db)
SSL Certificate Authority file used to secure storag
e backend communication"
,
Destination
:
&
ServerConfig
.
Storag
eCAFile
,
EnvVar
:
"K3S_
STORAG
E_CAFILE"
,
Name
:
"
datastor
e-cafile"
,
Usage
:
"(db)
TLS Certificate Authority file used to secure datastor
e backend communication"
,
Destination
:
&
ServerConfig
.
Datastor
eCAFile
,
EnvVar
:
"K3S_
DATASTOR
E_CAFILE"
,
},
cli
.
StringFlag
{
Name
:
"
storag
e-certfile"
,
Usage
:
"(db)
SSL certification file used to secure storag
e backend communication"
,
Destination
:
&
ServerConfig
.
Storag
eCertFile
,
EnvVar
:
"K3S_
STORAG
E_CERTFILE"
,
Name
:
"
datastor
e-certfile"
,
Usage
:
"(db)
TLS certification file used to secure datastor
e backend communication"
,
Destination
:
&
ServerConfig
.
Datastor
eCertFile
,
EnvVar
:
"K3S_
DATASTOR
E_CERTFILE"
,
},
cli
.
StringFlag
{
Name
:
"
storag
e-keyfile"
,
Usage
:
"(db)
SSL key file used to secure storag
e backend communication"
,
Destination
:
&
ServerConfig
.
Storag
eKeyFile
,
EnvVar
:
"K3S_
STORAG
E_KEYFILE"
,
Name
:
"
datastor
e-keyfile"
,
Usage
:
"(db)
TLS key file used to secure datastor
e backend communication"
,
Destination
:
&
ServerConfig
.
Datastor
eKeyFile
,
EnvVar
:
"K3S_
DATASTOR
E_KEYFILE"
,
},
cli
.
StringFlag
{
Name
:
"default-local-storage-path"
,
...
...
pkg/cli/server/server.go
View file @
99b8222e
...
...
@@ -88,10 +88,10 @@ func run(app *cli.Context, cfg *cmds.Server) error {
serverConfig
.
ControlConfig
.
ExtraControllerArgs
=
cfg
.
ExtraControllerArgs
serverConfig
.
ControlConfig
.
ExtraSchedulerAPIArgs
=
cfg
.
ExtraSchedulerArgs
serverConfig
.
ControlConfig
.
ClusterDomain
=
cfg
.
ClusterDomain
serverConfig
.
ControlConfig
.
Storage
.
Endpoint
=
cfg
.
Storag
eEndpoint
serverConfig
.
ControlConfig
.
Storage
.
CAFile
=
cfg
.
Storag
eCAFile
serverConfig
.
ControlConfig
.
Storage
.
CertFile
=
cfg
.
Storag
eCertFile
serverConfig
.
ControlConfig
.
Storage
.
KeyFile
=
cfg
.
Storag
eKeyFile
serverConfig
.
ControlConfig
.
Datastore
.
Endpoint
=
cfg
.
Datastor
eEndpoint
serverConfig
.
ControlConfig
.
Datastore
.
CAFile
=
cfg
.
Datastor
eCAFile
serverConfig
.
ControlConfig
.
Datastore
.
CertFile
=
cfg
.
Datastor
eCertFile
serverConfig
.
ControlConfig
.
Datastore
.
KeyFile
=
cfg
.
Datastor
eKeyFile
serverConfig
.
ControlConfig
.
AdvertiseIP
=
cfg
.
AdvertiseIP
serverConfig
.
ControlConfig
.
AdvertisePort
=
cfg
.
AdvertisePort
serverConfig
.
ControlConfig
.
FlannelBackend
=
cfg
.
FlannelBackend
...
...
pkg/cluster/cluster.go
View file @
99b8222e
...
...
@@ -59,14 +59,14 @@ func (c *Cluster) startStorage(ctx context.Context) error {
}
c
.
storageStarted
=
true
etcdConfig
,
err
:=
endpoint
.
Listen
(
ctx
,
c
.
config
.
Storag
e
)
etcdConfig
,
err
:=
endpoint
.
Listen
(
ctx
,
c
.
config
.
Datastor
e
)
if
err
!=
nil
{
return
err
}
c
.
etcdConfig
=
etcdConfig
c
.
config
.
Storag
e
.
Config
=
etcdConfig
.
TLSConfig
c
.
config
.
Storag
e
.
Endpoint
=
strings
.
Join
(
etcdConfig
.
Endpoints
,
","
)
c
.
config
.
Datastor
e
.
Config
=
etcdConfig
.
TLSConfig
c
.
config
.
Datastor
e
.
Endpoint
=
strings
.
Join
(
etcdConfig
.
Endpoints
,
","
)
c
.
config
.
NoLeaderElect
=
!
etcdConfig
.
LeaderElect
return
nil
}
...
...
pkg/cluster/dqlite.go
View file @
99b8222e
...
...
@@ -76,8 +76,8 @@ func (c *Cluster) initClusterDB(ctx context.Context, l net.Listener, handler htt
}
c
.
db
=
dqlite
if
!
strings
.
HasPrefix
(
c
.
config
.
Storag
e
.
Endpoint
,
"dqlite://"
)
{
c
.
config
.
Storag
e
=
endpoint
.
Config
{
if
!
strings
.
HasPrefix
(
c
.
config
.
Datastor
e
.
Endpoint
,
"dqlite://"
)
{
c
.
config
.
Datastor
e
=
endpoint
.
Config
{
Endpoint
:
dqlite
.
StorageEndpoint
,
}
}
...
...
@@ -91,12 +91,12 @@ func (c *Cluster) dqliteEnabled() bool {
return
true
}
driver
,
_
:=
endpoint
.
ParseStorageEndpoint
(
c
.
config
.
Storag
e
.
Endpoint
)
driver
,
_
:=
endpoint
.
ParseStorageEndpoint
(
c
.
config
.
Datastor
e
.
Endpoint
)
if
driver
==
endpoint
.
DQLiteBackend
{
return
true
}
return
c
.
config
.
Storag
e
.
Endpoint
==
""
&&
(
c
.
config
.
ClusterInit
||
(
c
.
config
.
Token
!=
""
&&
c
.
config
.
JoinURL
!=
""
))
return
c
.
config
.
Datastor
e
.
Endpoint
==
""
&&
(
c
.
config
.
ClusterInit
||
(
c
.
config
.
Token
!=
""
&&
c
.
config
.
JoinURL
!=
""
))
}
func
(
c
*
Cluster
)
postJoin
(
ctx
context
.
Context
)
error
{
...
...
pkg/daemons/config/types.go
View file @
99b8222e
...
...
@@ -96,7 +96,7 @@ type Control struct {
KubeConfigMode
string
DataDir
string
Skips
[]
string
Storage
endpoint
.
Config
Datastore
endpoint
.
Config
NoScheduler
bool
ExtraAPIArgs
[]
string
ExtraControllerArgs
[]
string
...
...
pkg/daemons/control/server.go
View file @
99b8222e
...
...
@@ -745,18 +745,18 @@ func KubeConfig(dest, url, caCert, clientCert, clientKey string) error {
func
setupStorageBackend
(
argsMap
map
[
string
]
string
,
cfg
*
config
.
Control
)
{
argsMap
[
"storage-backend"
]
=
"etcd3"
// specify the endpoints
if
len
(
cfg
.
Storag
e
.
Endpoint
)
>
0
{
argsMap
[
"etcd-servers"
]
=
cfg
.
Storag
e
.
Endpoint
if
len
(
cfg
.
Datastor
e
.
Endpoint
)
>
0
{
argsMap
[
"etcd-servers"
]
=
cfg
.
Datastor
e
.
Endpoint
}
// storage backend tls configuration
if
len
(
cfg
.
Storag
e
.
CAFile
)
>
0
{
argsMap
[
"etcd-cafile"
]
=
cfg
.
Storag
e
.
CAFile
if
len
(
cfg
.
Datastor
e
.
CAFile
)
>
0
{
argsMap
[
"etcd-cafile"
]
=
cfg
.
Datastor
e
.
CAFile
}
if
len
(
cfg
.
Storag
e
.
CertFile
)
>
0
{
argsMap
[
"etcd-certfile"
]
=
cfg
.
Storag
e
.
CertFile
if
len
(
cfg
.
Datastor
e
.
CertFile
)
>
0
{
argsMap
[
"etcd-certfile"
]
=
cfg
.
Datastor
e
.
CertFile
}
if
len
(
cfg
.
Storag
e
.
KeyFile
)
>
0
{
argsMap
[
"etcd-keyfile"
]
=
cfg
.
Storag
e
.
KeyFile
if
len
(
cfg
.
Datastor
e
.
KeyFile
)
>
0
{
argsMap
[
"etcd-keyfile"
]
=
cfg
.
Datastor
e
.
KeyFile
}
}
...
...
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