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
efdd7260
Commit
efdd7260
authored
Aug 21, 2015
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Un-knot static pods creation in executor
parent
686b767f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
20 deletions
+26
-20
executor.go
contrib/mesos/pkg/executor/executor.go
+0
-1
executor_test.go
contrib/mesos/pkg/executor/executor_test.go
+8
-8
service.go
contrib/mesos/pkg/executor/service/service.go
+18
-11
No files found.
contrib/mesos/pkg/executor/executor.go
View file @
efdd7260
...
...
@@ -39,7 +39,6 @@ import (
"k8s.io/kubernetes/pkg/client/cache"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/controller/framework"
"k8s.io/kubernetes/pkg/kubelet"
"k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/kubelet/dockertools"
kubetypes
"k8s.io/kubernetes/pkg/kubelet/types"
...
...
contrib/mesos/pkg/executor/executor_test.go
View file @
efdd7260
...
...
@@ -144,7 +144,7 @@ func TestExecutorLaunchAndKillTask(t *testing.T) {
Host
:
testApiServer
.
server
.
URL
,
Version
:
testapi
.
Default
.
Version
(),
}),
PodStatusFunc
:
func
(
kl
KubeletInterface
,
pod
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
PodStatusFunc
:
func
(
pod
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
return
&
api
.
PodStatus
{
ContainerStatuses
:
[]
api
.
ContainerStatus
{
{
...
...
@@ -300,7 +300,6 @@ func TestExecutorStaticPods(t *testing.T) {
defer
os
.
RemoveAll
(
staticPodsConfigPath
)
mockDriver
:=
&
MockExecutorDriver
{}
updates
:=
make
(
chan
interface
{},
1024
)
config
:=
Config
{
Docker
:
dockertools
.
ConnectToDockerOrDie
(
"fake://"
),
Updates
:
make
(
chan
interface
{},
1
),
// allow kube-executor source to proceed past init
...
...
@@ -308,7 +307,7 @@ func TestExecutorStaticPods(t *testing.T) {
Host
:
testApiServer
.
server
.
URL
,
Version
:
testapi
.
Default
.
Version
(),
}),
PodStatusFunc
:
func
(
kl
KubeletInterface
,
pod
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
PodStatusFunc
:
func
(
pod
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
return
&
api
.
PodStatus
{
ContainerStatuses
:
[]
api
.
ContainerStatus
{
{
...
...
@@ -325,10 +324,11 @@ func TestExecutorStaticPods(t *testing.T) {
PodLW
:
&
NewMockPodsListWatch
(
api
.
PodList
{})
.
ListWatch
,
}
executor
:=
New
(
config
)
// register static pod source
hostname
:=
"h1"
go
executor
.
InitializeStaticPodsSource
(
func
()
{
kconfig
.
NewSourceFile
(
staticPodsConfigPath
,
hostname
,
1
*
time
.
Second
,
updates
)
})
fileSourceUpdates
:=
make
(
chan
interface
{},
1024
)
kconfig
.
NewSourceFile
(
staticPodsConfigPath
,
hostname
,
1
*
time
.
Second
,
fileSourceUpdates
)
// create ExecutorInfo with static pod zip in data field
executorInfo
:=
mesosutil
.
NewExecutorInfo
(
...
...
@@ -350,7 +350,7 @@ func TestExecutorStaticPods(t *testing.T) {
select
{
case
<-
timeout
:
t
.
Fatalf
(
"Executor should send pod updates for %v pods, only saw %v"
,
expectedStaticPodsNum
,
len
(
seenPods
))
case
update
,
ok
:=
<-
u
pdates
:
case
update
,
ok
:=
<-
fileSourceU
pdates
:
if
!
ok
{
return
}
...
...
@@ -389,7 +389,7 @@ func TestExecutorFrameworkMessage(t *testing.T) {
Host
:
testApiServer
.
server
.
URL
,
Version
:
testapi
.
Default
.
Version
(),
}),
PodStatusFunc
:
func
(
kl
KubeletInterface
,
pod
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
PodStatusFunc
:
func
(
pod
*
api
.
Pod
)
(
*
api
.
PodStatus
,
error
)
{
return
&
api
.
PodStatus
{
ContainerStatuses
:
[]
api
.
ContainerStatus
{
{
...
...
contrib/mesos/pkg/executor/service/service.go
View file @
efdd7260
...
...
@@ -363,10 +363,16 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
return
nil
,
nil
,
err
}
// create static pods directory
staticPodsConfigPath
:=
filepath
.
Join
(
kc
.
RootDirectory
,
"static-pods"
)
err
=
os
.
Mkdir
(
staticPodsConfigPath
,
0755
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
//TODO(jdef) either configure Watch here with something useful, or else
// get rid of it from executor.Config
kubeletFinished
:=
make
(
chan
struct
{})
staticPodsConfigPath
:=
filepath
.
Join
(
kc
.
RootDirectory
,
"static-pods"
)
exec
:=
executor
.
New
(
executor
.
Config
{
Updates
:
updates
,
SourceName
:
MESOS_CFG_SOURCE
,
...
...
@@ -395,13 +401,6 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
PodLW
:
cache
.
NewListWatchFromClient
(
kc
.
KubeClient
,
"pods"
,
api
.
NamespaceAll
,
fields
.
OneTermEqualSelector
(
client
.
PodHost
,
kc
.
NodeName
)),
})
go
exec
.
InitializeStaticPodsSource
(
func
()
{
// Create file source only when we are called back. Otherwise, it is never marked unseen.
fileSourceUpdates
:=
pc
.
Channel
(
kubetypes
.
FileSource
)
kconfig
.
NewSourceFile
(
staticPodsConfigPath
,
kc
.
Hostname
,
kc
.
FileCheckFrequency
,
fileSourceUpdates
)
})
k
:=
&
kubeletExecutor
{
Kubelet
:
klet
,
address
:
ks
.
Address
,
...
...
@@ -423,12 +422,20 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
k
.
driver
=
driver
}
log
.
V
(
2
)
.
Infof
(
"Initialize executor driver..."
)
k
.
BirthCry
()
k
.
StartGarbageCollection
()
log
.
V
(
2
)
.
Infof
(
"Initialize executor driver..."
)
exec
.
Init
(
k
.
driver
)
k
.
StartGarbageCollection
()
<-
exec
.
InitialRegComplete
()
// from here the executor is registered with the Mesos master
// create static-pods directory file source
log
.
V
(
2
)
.
Infof
(
"initializing static pods source factory, configured at path %q"
,
staticPodsConfigPath
)
fileSourceUpdates
:=
pc
.
Channel
(
kubetypes
.
FileSource
)
kconfig
.
NewSourceFile
(
staticPodsConfigPath
,
kc
.
Hostname
,
kc
.
FileCheckFrequency
,
fileSourceUpdates
)
return
k
,
pc
,
nil
}
...
...
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