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
66c82a22
Commit
66c82a22
authored
Oct 12, 2016
by
gmarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inject logFunc into RunPods
parent
3a882072
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
util.go
test/e2e/framework/util.go
+6
-4
scheduler_predicates.go
test/e2e/scheduler_predicates.go
+4
-4
ubernetes_lite.go
test/e2e/ubernetes_lite.go
+1
-1
No files found.
test/e2e/framework/util.go
View file @
66c82a22
...
@@ -2786,7 +2786,8 @@ func (config *RCConfig) start() error {
...
@@ -2786,7 +2786,8 @@ func (config *RCConfig) start() error {
// Simplified version of RunRC, that does not create RC, but creates plain Pods.
// Simplified version of RunRC, that does not create RC, but creates plain Pods.
// Optionally waits for pods to start running (if waitForRunning == true).
// Optionally waits for pods to start running (if waitForRunning == true).
// The number of replicas must be non-zero.
// The number of replicas must be non-zero.
func
StartPods
(
c
*
client
.
Client
,
replicas
int
,
namespace
string
,
podNamePrefix
string
,
pod
api
.
Pod
,
waitForRunning
bool
)
{
func
StartPods
(
c
*
client
.
Client
,
replicas
int
,
namespace
string
,
podNamePrefix
string
,
pod
api
.
Pod
,
waitForRunning
bool
,
logFunc
func
(
fmt
string
,
args
...
interface
{}))
error
{
// no pod to start
// no pod to start
if
replicas
<
1
{
if
replicas
<
1
{
panic
(
"StartPods: number of replicas must be non-zero"
)
panic
(
"StartPods: number of replicas must be non-zero"
)
...
@@ -2799,14 +2800,15 @@ func StartPods(c *client.Client, replicas int, namespace string, podNamePrefix s
...
@@ -2799,14 +2800,15 @@ func StartPods(c *client.Client, replicas int, namespace string, podNamePrefix s
pod
.
ObjectMeta
.
Labels
[
"startPodsID"
]
=
startPodsID
pod
.
ObjectMeta
.
Labels
[
"startPodsID"
]
=
startPodsID
pod
.
Spec
.
Containers
[
0
]
.
Name
=
podName
pod
.
Spec
.
Containers
[
0
]
.
Name
=
podName
_
,
err
:=
c
.
Pods
(
namespace
)
.
Create
(
&
pod
)
_
,
err
:=
c
.
Pods
(
namespace
)
.
Create
(
&
pod
)
ExpectNoError
(
err
)
return
err
}
}
Logf
(
"Waiting for running..."
)
logFunc
(
"Waiting for running..."
)
if
waitForRunning
{
if
waitForRunning
{
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"startPodsID"
:
startPodsID
}))
label
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"startPodsID"
:
startPodsID
}))
err
:=
WaitForPodsWithLabelRunning
(
c
,
namespace
,
label
)
err
:=
WaitForPodsWithLabelRunning
(
c
,
namespace
,
label
)
ExpectNoError
(
err
,
"Error waiting for %d pods to be running - probably a timeout"
,
replicas
)
return
fmt
.
Errorf
(
"Error waiting for %d pods to be running - probably a timeout: %v"
,
replicas
,
err
)
}
}
return
nil
}
}
type
EventsLister
func
(
opts
v1
.
ListOptions
,
ns
string
)
(
*
v1
.
EventList
,
error
)
type
EventsLister
func
(
opts
v1
.
ListOptions
,
ns
string
)
(
*
v1
.
EventList
,
error
)
...
...
test/e2e/scheduler_predicates.go
View file @
66c82a22
...
@@ -126,11 +126,11 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -126,11 +126,11 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
// and there is no need to create additional pods.
// and there is no need to create additional pods.
// StartPods requires at least one pod to replicate.
// StartPods requires at least one pod to replicate.
if
podsNeededForSaturation
>
0
{
if
podsNeededForSaturation
>
0
{
framework
.
StartPods
(
c
,
podsNeededForSaturation
,
ns
,
"maxp"
,
framework
.
ExpectNoError
(
framework
.
StartPods
(
c
,
podsNeededForSaturation
,
ns
,
"maxp"
,
*
initPausePod
(
f
,
pausePodConfig
{
*
initPausePod
(
f
,
pausePodConfig
{
Name
:
""
,
Name
:
""
,
Labels
:
map
[
string
]
string
{
"name"
:
""
},
Labels
:
map
[
string
]
string
{
"name"
:
""
},
}),
true
)
}),
true
,
framework
.
Logf
)
)
}
}
podName
:=
"additional-pod"
podName
:=
"additional-pod"
createPausePod
(
f
,
pausePodConfig
{
createPausePod
(
f
,
pausePodConfig
{
...
@@ -187,7 +187,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -187,7 +187,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
// and there is no need to create additional pods.
// and there is no need to create additional pods.
// StartPods requires at least one pod to replicate.
// StartPods requires at least one pod to replicate.
if
podsNeededForSaturation
>
0
{
if
podsNeededForSaturation
>
0
{
framework
.
StartPods
(
c
,
podsNeededForSaturation
,
ns
,
"overcommit"
,
framework
.
ExpectNoError
(
framework
.
StartPods
(
c
,
podsNeededForSaturation
,
ns
,
"overcommit"
,
*
initPausePod
(
f
,
pausePodConfig
{
*
initPausePod
(
f
,
pausePodConfig
{
Name
:
""
,
Name
:
""
,
Labels
:
map
[
string
]
string
{
"name"
:
""
},
Labels
:
map
[
string
]
string
{
"name"
:
""
},
...
@@ -199,7 +199,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -199,7 +199,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
"cpu"
:
*
resource
.
NewMilliQuantity
(
milliCpuPerPod
,
"DecimalSI"
),
"cpu"
:
*
resource
.
NewMilliQuantity
(
milliCpuPerPod
,
"DecimalSI"
),
},
},
},
},
}),
true
)
}),
true
,
framework
.
Logf
)
)
}
}
podName
:=
"additional-pod"
podName
:=
"additional-pod"
createPausePod
(
f
,
pausePodConfig
{
createPausePod
(
f
,
pausePodConfig
{
...
...
test/e2e/ubernetes_lite.go
View file @
66c82a22
...
@@ -98,7 +98,7 @@ func SpreadServiceOrFail(f *framework.Framework, replicaCount int, image string)
...
@@ -98,7 +98,7 @@ func SpreadServiceOrFail(f *framework.Framework, replicaCount int, image string)
// Based on the callers, replicas is always positive number: zoneCount >= 0 implies (2*zoneCount)+1 > 0.
// Based on the callers, replicas is always positive number: zoneCount >= 0 implies (2*zoneCount)+1 > 0.
// Thus, no need to test for it. Once the precondition changes to zero number of replicas,
// Thus, no need to test for it. Once the precondition changes to zero number of replicas,
// test for replicaCount > 0. Otherwise, StartPods panics.
// test for replicaCount > 0. Otherwise, StartPods panics.
framework
.
StartPods
(
f
.
Client
,
replicaCount
,
f
.
Namespace
.
Name
,
serviceName
,
*
podSpec
,
false
)
framework
.
ExpectNoError
(
framework
.
StartPods
(
f
.
Client
,
replicaCount
,
f
.
Namespace
.
Name
,
serviceName
,
*
podSpec
,
false
,
framework
.
Logf
)
)
// Wait for all of them to be scheduled
// Wait for all of them to be scheduled
selector
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"service"
:
serviceName
}))
selector
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
"service"
:
serviceName
}))
...
...
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