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
b47018e3
Commit
b47018e3
authored
Mar 14, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Schedule ReplicationControllers in pod-startup-time test.
parent
323f5c4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
27 deletions
+35
-27
density.go
test/e2e/density.go
+35
-27
No files found.
test/e2e/density.go
View file @
b47018e3
...
@@ -398,15 +398,15 @@ var _ = Describe("Density", func() {
...
@@ -398,15 +398,15 @@ var _ = Describe("Density", func() {
}
}
}
}
additionalPodsPrefix
=
"density-latency-pod
-"
+
string
(
util
.
NewUUID
())
additionalPodsPrefix
=
"density-latency-pod
"
latencyPodsStore
,
controller
:=
controllerframework
.
NewInformer
(
latencyPodsStore
,
controller
:=
controllerframework
.
NewInformer
(
&
cache
.
ListWatch
{
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
options
.
LabelSelector
=
labels
.
SelectorFromSet
(
labels
.
Set
{
"
nam
e"
:
additionalPodsPrefix
})
options
.
LabelSelector
=
labels
.
SelectorFromSet
(
labels
.
Set
{
"
typ
e"
:
additionalPodsPrefix
})
return
c
.
Pods
(
ns
)
.
List
(
options
)
return
c
.
Pods
(
ns
)
.
List
(
options
)
},
},
WatchFunc
:
func
(
options
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
WatchFunc
:
func
(
options
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
options
.
LabelSelector
=
labels
.
SelectorFromSet
(
labels
.
Set
{
"
nam
e"
:
additionalPodsPrefix
})
options
.
LabelSelector
=
labels
.
SelectorFromSet
(
labels
.
Set
{
"
typ
e"
:
additionalPodsPrefix
})
return
c
.
Pods
(
ns
)
.
Watch
(
options
)
return
c
.
Pods
(
ns
)
.
Watch
(
options
)
},
},
},
},
...
@@ -432,9 +432,6 @@ var _ = Describe("Density", func() {
...
@@ -432,9 +432,6 @@ var _ = Describe("Density", func() {
// Create some additional pods with throughput ~5 pods/sec.
// Create some additional pods with throughput ~5 pods/sec.
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
wg
.
Add
(
nodeCount
)
wg
.
Add
(
nodeCount
)
podLabels
:=
map
[
string
]
string
{
"name"
:
additionalPodsPrefix
,
}
// Explicitly set requests here.
// Explicitly set requests here.
// Thanks to it we trigger increasing priority function by scheduling
// Thanks to it we trigger increasing priority function by scheduling
// a pod to a node, which in turn will result in spreading latency pods
// a pod to a node, which in turn will result in spreading latency pods
...
@@ -449,7 +446,7 @@ var _ = Describe("Density", func() {
...
@@ -449,7 +446,7 @@ var _ = Describe("Density", func() {
}
}
for
i
:=
1
;
i
<=
nodeCount
;
i
++
{
for
i
:=
1
;
i
<=
nodeCount
;
i
++
{
name
:=
additionalPodsPrefix
+
"-"
+
strconv
.
Itoa
(
i
)
name
:=
additionalPodsPrefix
+
"-"
+
strconv
.
Itoa
(
i
)
go
createRunningPod
(
&
wg
,
c
,
name
,
ns
,
"gcr.io/google_containers/pause:2.0"
,
podLabels
,
cpuRequest
,
memRequest
)
go
createRunningPod
FromRC
(
&
wg
,
c
,
name
,
ns
,
"gcr.io/google_containers/pause:2.0"
,
additionalPodsPrefix
,
cpuRequest
,
memRequest
)
time
.
Sleep
(
200
*
time
.
Millisecond
)
time
.
Sleep
(
200
*
time
.
Millisecond
)
}
}
wg
.
Wait
()
wg
.
Wait
()
...
@@ -540,7 +537,7 @@ var _ = Describe("Density", func() {
...
@@ -540,7 +537,7 @@ var _ = Describe("Density", func() {
float64
(
nodeCount
)
/
(
e2eLag
[
len
(
e2eLag
)
-
1
]
.
Latency
.
Minutes
()))
float64
(
nodeCount
)
/
(
e2eLag
[
len
(
e2eLag
)
-
1
]
.
Latency
.
Minutes
()))
}
}
By
(
"Deleting ReplicationController
and all additional Pods
"
)
By
(
"Deleting ReplicationController"
)
// We explicitly delete all pods to have API calls necessary for deletion accounted in metrics.
// We explicitly delete all pods to have API calls necessary for deletion accounted in metrics.
rc
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Get
(
RCName
)
rc
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Get
(
RCName
)
if
err
==
nil
&&
rc
.
Spec
.
Replicas
!=
0
{
if
err
==
nil
&&
rc
.
Spec
.
Replicas
!=
0
{
...
@@ -549,43 +546,54 @@ var _ = Describe("Density", func() {
...
@@ -549,43 +546,54 @@ var _ = Describe("Density", func() {
expectNoError
(
err
)
expectNoError
(
err
)
}
}
By
(
"Removing additional
pod
s if any"
)
By
(
"Removing additional
replication controller
s if any"
)
for
i
:=
1
;
i
<=
nodeCount
;
i
++
{
for
i
:=
1
;
i
<=
nodeCount
;
i
++
{
name
:=
additionalPodsPrefix
+
"-"
+
strconv
.
Itoa
(
i
)
name
:=
additionalPodsPrefix
+
"-"
+
strconv
.
Itoa
(
i
)
c
.
Pods
(
ns
)
.
Delete
(
name
,
nil
)
c
.
ReplicationControllers
(
ns
)
.
Delete
(
name
)
}
}
})
})
}
}
})
})
func
createRunningPod
(
wg
*
sync
.
WaitGroup
,
c
*
client
.
Client
,
name
,
ns
,
image
string
,
labels
map
[
string
]
string
,
cpuRequest
,
memRequest
resource
.
Quantity
)
{
func
createRunningPod
FromRC
(
wg
*
sync
.
WaitGroup
,
c
*
client
.
Client
,
name
,
ns
,
image
,
podType
string
,
cpuRequest
,
memRequest
resource
.
Quantity
)
{
defer
GinkgoRecover
()
defer
GinkgoRecover
()
defer
wg
.
Done
()
defer
wg
.
Done
()
pod
:=
&
api
.
Pod
{
labels
:=
map
[
string
]
string
{
TypeMeta
:
unversioned
.
TypeMeta
{
"type"
:
podType
,
Kind
:
"Pod"
,
"name"
:
name
,
},
}
rc
:=
&
api
.
ReplicationController
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
name
,
Name
:
name
,
Labels
:
labels
,
Labels
:
labels
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
ReplicationControllerSpec
{
Containers
:
[]
api
.
Container
{
Replicas
:
1
,
{
Selector
:
labels
,
Name
:
name
,
Template
:
&
api
.
PodTemplateSpec
{
Image
:
image
,
ObjectMeta
:
api
.
ObjectMeta
{
Resources
:
api
.
ResourceRequirements
{
Labels
:
labels
,
Requests
:
api
.
ResourceList
{
},
api
.
ResourceCPU
:
cpuRequest
,
Spec
:
api
.
PodSpec
{
api
.
ResourceMemory
:
memRequest
,
Containers
:
[]
api
.
Container
{
{
Name
:
name
,
Image
:
image
,
Resources
:
api
.
ResourceRequirements
{
Requests
:
api
.
ResourceList
{
api
.
ResourceCPU
:
cpuRequest
,
api
.
ResourceMemory
:
memRequest
,
},
},
},
},
},
},
DNSPolicy
:
api
.
DNSDefault
,
},
},
},
},
DNSPolicy
:
api
.
DNSDefault
,
},
},
}
}
_
,
err
:=
c
.
Pods
(
ns
)
.
Create
(
pod
)
_
,
err
:=
c
.
ReplicationControllers
(
ns
)
.
Create
(
rc
)
expectNoError
(
err
)
expectNoError
(
err
)
expectNoError
(
waitForPodRunningInNamespace
(
c
,
name
,
ns
))
expectNoError
(
waitForRCPodsRunning
(
c
,
ns
,
name
))
Logf
(
"Found pod '%s' running"
,
name
)
}
}
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