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
70e6ca4a
Commit
70e6ca4a
authored
Mar 03, 2019
by
Darren Shepherd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support external CRI implementations
parent
3d113ceb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
23 deletions
+35
-23
config.go
pkg/agent/config/config.go
+6
-3
run.go
pkg/agent/run.go
+2
-2
agent.go
pkg/cli/cmds/agent.go
+16
-9
server.go
pkg/cli/cmds/server.go
+1
-0
types.go
pkg/daemons/config/types.go
+10
-9
No files found.
pkg/agent/config/config.go
View file @
70e6ca4a
...
...
@@ -156,8 +156,9 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
}
nodeConfig
:=
&
config
.
Node
{
Docker
:
envInfo
.
Docker
,
NoFlannel
:
envInfo
.
NoFlannel
,
Docker
:
envInfo
.
Docker
,
NoFlannel
:
envInfo
.
NoFlannel
,
ContainerRuntimeEndpoint
:
envInfo
.
ContainerRuntimeEndpoint
,
}
nodeConfig
.
LocalAddress
=
localAddress
(
controlConfig
)
nodeConfig
.
AgentConfig
.
NodeIP
=
nodeIP
...
...
@@ -183,8 +184,10 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
nodeConfig
.
AgentConfig
.
CNIBinDir
=
filepath
.
Dir
(
hostLocal
)
nodeConfig
.
AgentConfig
.
CNIConfDir
=
filepath
.
Join
(
envInfo
.
DataDir
,
"etc/cni/net.d"
)
}
if
!
nodeConfig
.
Docker
{
if
!
nodeConfig
.
Docker
&&
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
nodeConfig
.
AgentConfig
.
RuntimeSocket
=
"unix://"
+
nodeConfig
.
Containerd
.
Address
}
else
{
nodeConfig
.
AgentConfig
.
RuntimeSocket
=
"unix://"
+
nodeConfig
.
ContainerRuntimeEndpoint
}
if
controlConfig
.
ClusterIPRange
!=
nil
{
nodeConfig
.
AgentConfig
.
ClusterCIDR
=
*
controlConfig
.
ClusterIPRange
...
...
pkg/agent/run.go
View file @
70e6ca4a
...
...
@@ -30,8 +30,8 @@ func run(ctx context.Context, cfg cmds.Agent) error {
}
}
if
nodeConfig
.
Docker
{
nodeConfig
.
AgentConfig
.
RuntimeSocket
=
""
if
nodeConfig
.
Docker
||
nodeConfig
.
ContainerRuntimeEndpoint
!=
""
{
nodeConfig
.
AgentConfig
.
RuntimeSocket
=
nodeConfig
.
ContainerRuntimeEndpoint
}
else
{
if
err
:=
containerd
.
Run
(
ctx
,
nodeConfig
);
err
!=
nil
{
return
err
...
...
pkg/cli/cmds/agent.go
View file @
70e6ca4a
...
...
@@ -8,15 +8,16 @@ import (
)
type
Agent
struct
{
Token
string
ServerURL
string
DataDir
string
NodeIP
string
NodeName
string
ClusterSecret
string
Docker
bool
NoFlannel
bool
Debug
bool
Token
string
ServerURL
string
DataDir
string
NodeIP
string
NodeName
string
ClusterSecret
string
Docker
bool
ContainerRuntimeEndpoint
string
NoFlannel
bool
Debug
bool
AgentShared
}
...
...
@@ -48,6 +49,11 @@ var (
Usage
:
"(agent) Disable embedded flannel"
,
Destination
:
&
AgentConfig
.
NoFlannel
,
}
CRIEndpointFlag
=
cli
.
StringFlag
{
Name
:
"container-runtime-endpoint"
,
Usage
:
"(agent) Disable embedded containerd and use alternative CRI implementation"
,
Destination
:
&
AgentConfig
.
ContainerRuntimeEndpoint
,
}
)
func
NewAgentCommand
(
action
func
(
ctx
*
cli
.
Context
)
error
)
cli
.
Command
{
...
...
@@ -85,6 +91,7 @@ func NewAgentCommand(action func(ctx *cli.Context) error) cli.Command {
FlannelFlag
,
NodeNameFlag
,
NodeIPFlag
,
CRIEndpointFlag
,
},
}
}
pkg/cli/cmds/server.go
View file @
70e6ca4a
...
...
@@ -85,6 +85,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
NodeNameFlag
,
DockerFlag
,
FlannelFlag
,
CRIEndpointFlag
,
},
}
}
pkg/daemons/config/types.go
View file @
70e6ca4a
...
...
@@ -10,15 +10,16 @@ import (
)
type
Node
struct
{
Docker
bool
NoFlannel
bool
FlannelConf
string
LocalAddress
string
Containerd
Containerd
AgentConfig
Agent
CACerts
[]
byte
ServerAddress
string
Certificate
*
tls
.
Certificate
Docker
bool
ContainerRuntimeEndpoint
string
NoFlannel
bool
FlannelConf
string
LocalAddress
string
Containerd
Containerd
AgentConfig
Agent
CACerts
[]
byte
ServerAddress
string
Certificate
*
tls
.
Certificate
}
type
Containerd
struct
{
...
...
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