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