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
93ae257a
Commit
93ae257a
authored
Aug 21, 2015
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidate executor driver initialization code
parent
efdd7260
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
31 deletions
+24
-31
service.go
contrib/mesos/pkg/executor/service/service.go
+24
-31
No files found.
contrib/mesos/pkg/executor/service/service.go
View file @
93ae257a
...
@@ -25,7 +25,6 @@ import (
...
@@ -25,7 +25,6 @@ import (
"path/filepath"
"path/filepath"
"strconv"
"strconv"
"strings"
"strings"
"sync"
"time"
"time"
log
"github.com/golang/glog"
log
"github.com/golang/glog"
...
@@ -257,6 +256,7 @@ func (s *KubeletExecutorServer) Run(hks hyperkube.Interface, _ []string) error {
...
@@ -257,6 +256,7 @@ func (s *KubeletExecutorServer) Run(hks hyperkube.Interface, _ []string) error {
return
err
return
err
}
}
// start health check server
if
s
.
HealthzPort
>
0
{
if
s
.
HealthzPort
>
0
{
healthz
.
DefaultHealthz
()
healthz
.
DefaultHealthz
()
go
util
.
Until
(
func
()
{
go
util
.
Until
(
func
()
{
...
@@ -401,6 +401,29 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
...
@@ -401,6 +401,29 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
PodLW
:
cache
.
NewListWatchFromClient
(
kc
.
KubeClient
,
"pods"
,
api
.
NamespaceAll
,
fields
.
OneTermEqualSelector
(
client
.
PodHost
,
kc
.
NodeName
)),
PodLW
:
cache
.
NewListWatchFromClient
(
kc
.
KubeClient
,
"pods"
,
api
.
NamespaceAll
,
fields
.
OneTermEqualSelector
(
client
.
PodHost
,
kc
.
NodeName
)),
})
})
// initialize driver and initialize the executor with it
dconfig
:=
bindings
.
DriverConfig
{
Executor
:
exec
,
HostnameOverride
:
ks
.
HostnameOverride
,
BindingAddress
:
ks
.
Address
,
}
driver
,
err
:=
bindings
.
NewMesosExecutorDriver
(
dconfig
)
if
err
!=
nil
{
log
.
Fatalf
(
"failed to create executor driver: %v"
,
err
)
}
log
.
V
(
2
)
.
Infof
(
"Initialize executor driver..."
)
exec
.
Init
(
driver
)
// start the driver
go
func
()
{
if
_
,
err
:=
driver
.
Run
();
err
!=
nil
{
log
.
Fatalf
(
"executor driver failed: %v"
,
err
)
}
log
.
Info
(
"executor Run completed"
)
}()
<-
exec
.
InitialRegComplete
()
k
:=
&
kubeletExecutor
{
k
:=
&
kubeletExecutor
{
Kubelet
:
klet
,
Kubelet
:
klet
,
address
:
ks
.
Address
,
address
:
ks
.
Address
,
...
@@ -411,27 +434,9 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
...
@@ -411,27 +434,9 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
clientConfig
:
clientConfig
,
clientConfig
:
clientConfig
,
}
}
dconfig
:=
bindings
.
DriverConfig
{
Executor
:
exec
,
HostnameOverride
:
ks
.
HostnameOverride
,
BindingAddress
:
ks
.
Address
,
}
if
driver
,
err
:=
bindings
.
NewMesosExecutorDriver
(
dconfig
);
err
!=
nil
{
log
.
Fatalf
(
"failed to create executor driver: %v"
,
err
)
}
else
{
k
.
driver
=
driver
}
k
.
BirthCry
()
k
.
BirthCry
()
k
.
StartGarbageCollection
()
k
.
StartGarbageCollection
()
log
.
V
(
2
)
.
Infof
(
"Initialize executor driver..."
)
exec
.
Init
(
k
.
driver
)
<-
exec
.
InitialRegComplete
()
// from here the executor is registered with the Mesos master
// create static-pods directory file source
// create static-pods directory file source
log
.
V
(
2
)
.
Infof
(
"initializing static pods source factory, configured at path %q"
,
staticPodsConfigPath
)
log
.
V
(
2
)
.
Infof
(
"initializing static pods source factory, configured at path %q"
,
staticPodsConfigPath
)
fileSourceUpdates
:=
pc
.
Channel
(
kubetypes
.
FileSource
)
fileSourceUpdates
:=
pc
.
Channel
(
kubetypes
.
FileSource
)
...
@@ -443,8 +448,6 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
...
@@ -443,8 +448,6 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
// kubelet decorator
// kubelet decorator
type
kubeletExecutor
struct
{
type
kubeletExecutor
struct
{
*
kubelet
.
Kubelet
*
kubelet
.
Kubelet
initialize
sync
.
Once
driver
bindings
.
ExecutorDriver
address
net
.
IP
address
net
.
IP
dockerClient
dockertools
.
DockerInterface
dockerClient
dockertools
.
DockerInterface
hks
hyperkube
.
Interface
hks
hyperkube
.
Interface
...
@@ -454,16 +457,6 @@ type kubeletExecutor struct {
...
@@ -454,16 +457,6 @@ type kubeletExecutor struct {
}
}
func
(
kl
*
kubeletExecutor
)
ListenAndServe
(
address
net
.
IP
,
port
uint
,
tlsOptions
*
kubelet
.
TLSOptions
,
auth
kubelet
.
AuthInterface
,
enableDebuggingHandlers
bool
)
{
func
(
kl
*
kubeletExecutor
)
ListenAndServe
(
address
net
.
IP
,
port
uint
,
tlsOptions
*
kubelet
.
TLSOptions
,
auth
kubelet
.
AuthInterface
,
enableDebuggingHandlers
bool
)
{
// this func could be called many times, depending how often the HTTP server crashes,
// so only execute certain initialization procs once
kl
.
initialize
.
Do
(
func
()
{
go
func
()
{
if
_
,
err
:=
kl
.
driver
.
Run
();
err
!=
nil
{
log
.
Fatalf
(
"executor driver failed: %v"
,
err
)
}
log
.
Info
(
"executor Run completed"
)
}()
})
log
.
Infof
(
"Starting kubelet server..."
)
log
.
Infof
(
"Starting kubelet server..."
)
kubelet
.
ListenAndServeKubeletServer
(
kl
,
address
,
port
,
tlsOptions
,
auth
,
enableDebuggingHandlers
)
kubelet
.
ListenAndServeKubeletServer
(
kl
,
address
,
port
,
tlsOptions
,
auth
,
enableDebuggingHandlers
)
}
}
...
...
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