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
e10524a6
Commit
e10524a6
authored
May 11, 2021
by
Brad Davidson
Committed by
Brad Davidson
May 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add executor.Bootstrap hook for pre-execution setup
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
bcd8b67d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
run.go
pkg/agent/run.go
+5
-0
embed.go
pkg/daemons/executor/embed.go
+6
-0
executor.go
pkg/daemons/executor/executor.go
+7
-0
No files found.
pkg/agent/run.go
View file @
e10524a6
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
cp
"github.com/rancher/k3s/pkg/cloudprovider"
cp
"github.com/rancher/k3s/pkg/cloudprovider"
"github.com/rancher/k3s/pkg/daemons/agent"
"github.com/rancher/k3s/pkg/daemons/agent"
daemonconfig
"github.com/rancher/k3s/pkg/daemons/config"
daemonconfig
"github.com/rancher/k3s/pkg/daemons/config"
"github.com/rancher/k3s/pkg/daemons/executor"
"github.com/rancher/k3s/pkg/nodeconfig"
"github.com/rancher/k3s/pkg/nodeconfig"
"github.com/rancher/k3s/pkg/rootless"
"github.com/rancher/k3s/pkg/rootless"
"github.com/rancher/k3s/pkg/util"
"github.com/rancher/k3s/pkg/util"
...
@@ -91,6 +92,10 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
...
@@ -91,6 +92,10 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
return
err
return
err
}
}
if
err
:=
executor
.
Bootstrap
(
ctx
,
nodeConfig
,
cfg
);
err
!=
nil
{
return
err
}
if
!
nodeConfig
.
NoFlannel
{
if
!
nodeConfig
.
NoFlannel
{
if
err
:=
flannel
.
Prepare
(
ctx
,
nodeConfig
);
err
!=
nil
{
if
err
:=
flannel
.
Prepare
(
ctx
,
nodeConfig
);
err
!=
nil
{
return
err
return
err
...
...
pkg/daemons/executor/embed.go
View file @
e10524a6
...
@@ -11,6 +11,8 @@ import (
...
@@ -11,6 +11,8 @@ import (
proxy
"k8s.io/kubernetes/cmd/kube-proxy/app"
proxy
"k8s.io/kubernetes/cmd/kube-proxy/app"
kubelet
"k8s.io/kubernetes/cmd/kubelet/app"
kubelet
"k8s.io/kubernetes/cmd/kubelet/app"
"github.com/rancher/k3s/pkg/cli/cmds"
daemonconfig
"github.com/rancher/k3s/pkg/daemons/config"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus"
"k8s.io/kubernetes/cmd/kube-apiserver/app"
"k8s.io/kubernetes/cmd/kube-apiserver/app"
cmapp
"k8s.io/kubernetes/cmd/kube-controller-manager/app"
cmapp
"k8s.io/kubernetes/cmd/kube-controller-manager/app"
...
@@ -23,6 +25,10 @@ func init() {
...
@@ -23,6 +25,10 @@ func init() {
type
Embedded
struct
{}
type
Embedded
struct
{}
func
(
Embedded
)
Bootstrap
(
ctx
context
.
Context
,
nodeConfig
*
daemonconfig
.
Node
,
cfg
cmds
.
Agent
)
error
{
return
nil
}
func
(
Embedded
)
Kubelet
(
args
[]
string
)
error
{
func
(
Embedded
)
Kubelet
(
args
[]
string
)
error
{
command
:=
kubelet
.
NewKubeletCommand
(
context
.
Background
())
command
:=
kubelet
.
NewKubeletCommand
(
context
.
Background
())
command
.
SetArgs
(
args
)
command
.
SetArgs
(
args
)
...
...
pkg/daemons/executor/executor.go
View file @
e10524a6
...
@@ -9,6 +9,8 @@ import (
...
@@ -9,6 +9,8 @@ import (
"sigs.k8s.io/yaml"
"sigs.k8s.io/yaml"
"github.com/rancher/k3s/pkg/cli/cmds"
daemonconfig
"github.com/rancher/k3s/pkg/daemons/config"
"k8s.io/apiserver/pkg/authentication/authenticator"
"k8s.io/apiserver/pkg/authentication/authenticator"
)
)
...
@@ -17,6 +19,7 @@ var (
...
@@ -17,6 +19,7 @@ var (
)
)
type
Executor
interface
{
type
Executor
interface
{
Bootstrap
(
ctx
context
.
Context
,
nodeConfig
*
daemonconfig
.
Node
,
cfg
cmds
.
Agent
)
error
Kubelet
(
args
[]
string
)
error
Kubelet
(
args
[]
string
)
error
KubeProxy
(
args
[]
string
)
error
KubeProxy
(
args
[]
string
)
error
APIServer
(
ctx
context
.
Context
,
etcdReady
<-
chan
struct
{},
args
[]
string
)
(
authenticator
.
Request
,
http
.
Handler
,
error
)
APIServer
(
ctx
context
.
Context
,
etcdReady
<-
chan
struct
{},
args
[]
string
)
(
authenticator
.
Request
,
http
.
Handler
,
error
)
...
@@ -81,6 +84,10 @@ func Set(driver Executor) {
...
@@ -81,6 +84,10 @@ func Set(driver Executor) {
executor
=
driver
executor
=
driver
}
}
func
Bootstrap
(
ctx
context
.
Context
,
nodeConfig
*
daemonconfig
.
Node
,
cfg
cmds
.
Agent
)
error
{
return
executor
.
Bootstrap
(
ctx
,
nodeConfig
,
cfg
)
}
func
Kubelet
(
args
[]
string
)
error
{
func
Kubelet
(
args
[]
string
)
error
{
return
executor
.
Kubelet
(
args
)
return
executor
.
Kubelet
(
args
)
}
}
...
...
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