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
0daedee0
Commit
0daedee0
authored
Jun 28, 2018
by
Bobby (Babak) Salamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change our tests to ensure that critical system pods are created in the system namespace
parent
28df1f0d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
predicates.go
test/e2e/scheduling/predicates.go
+13
-5
preemption.go
test/e2e/scheduling/preemption.go
+8
-0
kube_dns_template.yaml
test/kubemark/resources/kube_dns_template.yaml
+0
-1
No files found.
test/e2e/scheduling/predicates.go
View file @
0daedee0
...
@@ -47,6 +47,7 @@ var masterNodes sets.String
...
@@ -47,6 +47,7 @@ var masterNodes sets.String
type
pausePodConfig
struct
{
type
pausePodConfig
struct
{
Name
string
Name
string
Namespace
string
Affinity
*
v1
.
Affinity
Affinity
*
v1
.
Affinity
Annotations
,
Labels
,
NodeSelector
map
[
string
]
string
Annotations
,
Labels
,
NodeSelector
map
[
string
]
string
Resources
*
v1
.
ResourceRequirements
Resources
*
v1
.
ResourceRequirements
...
@@ -602,9 +603,11 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
...
@@ -602,9 +603,11 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() {
})
})
func
initPausePod
(
f
*
framework
.
Framework
,
conf
pausePodConfig
)
*
v1
.
Pod
{
func
initPausePod
(
f
*
framework
.
Framework
,
conf
pausePodConfig
)
*
v1
.
Pod
{
var
gracePeriod
=
int64
(
1
)
pod
:=
&
v1
.
Pod
{
pod
:=
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
conf
.
Name
,
Name
:
conf
.
Name
,
Namespace
:
conf
.
Namespace
,
Labels
:
conf
.
Labels
,
Labels
:
conf
.
Labels
,
Annotations
:
conf
.
Annotations
,
Annotations
:
conf
.
Annotations
,
OwnerReferences
:
conf
.
OwnerReferences
,
OwnerReferences
:
conf
.
OwnerReferences
,
...
@@ -619,9 +622,10 @@ func initPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
...
@@ -619,9 +622,10 @@ func initPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
Ports
:
conf
.
Ports
,
Ports
:
conf
.
Ports
,
},
},
},
},
Tolerations
:
conf
.
Tolerations
,
Tolerations
:
conf
.
Tolerations
,
NodeName
:
conf
.
NodeName
,
NodeName
:
conf
.
NodeName
,
PriorityClassName
:
conf
.
PriorityClassName
,
PriorityClassName
:
conf
.
PriorityClassName
,
TerminationGracePeriodSeconds
:
&
gracePeriod
,
},
},
}
}
if
conf
.
Resources
!=
nil
{
if
conf
.
Resources
!=
nil
{
...
@@ -631,7 +635,11 @@ func initPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
...
@@ -631,7 +635,11 @@ func initPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
}
}
func
createPausePod
(
f
*
framework
.
Framework
,
conf
pausePodConfig
)
*
v1
.
Pod
{
func
createPausePod
(
f
*
framework
.
Framework
,
conf
pausePodConfig
)
*
v1
.
Pod
{
pod
,
err
:=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
initPausePod
(
f
,
conf
))
namespace
:=
conf
.
Namespace
if
len
(
namespace
)
==
0
{
namespace
=
f
.
Namespace
.
Name
}
pod
,
err
:=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
namespace
)
.
Create
(
initPausePod
(
f
,
conf
))
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
return
pod
return
pod
}
}
...
@@ -639,7 +647,7 @@ func createPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
...
@@ -639,7 +647,7 @@ func createPausePod(f *framework.Framework, conf pausePodConfig) *v1.Pod {
func
runPausePod
(
f
*
framework
.
Framework
,
conf
pausePodConfig
)
*
v1
.
Pod
{
func
runPausePod
(
f
*
framework
.
Framework
,
conf
pausePodConfig
)
*
v1
.
Pod
{
pod
:=
createPausePod
(
f
,
conf
)
pod
:=
createPausePod
(
f
,
conf
)
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
ClientSet
,
pod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
ClientSet
,
pod
))
pod
,
err
:=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
f
.
Namespace
.
Nam
e
)
.
Get
(
conf
.
Name
,
metav1
.
GetOptions
{})
pod
,
err
:=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
pod
.
Namespac
e
)
.
Get
(
conf
.
Name
,
metav1
.
GetOptions
{})
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
return
pod
return
pod
}
}
...
...
test/e2e/scheduling/preemption.go
View file @
0daedee0
...
@@ -167,6 +167,7 @@ var _ = SIGDescribe("SchedulerPreemption [Serial] [Feature:PodPreemption]", func
...
@@ -167,6 +167,7 @@ var _ = SIGDescribe("SchedulerPreemption [Serial] [Feature:PodPreemption]", func
// Create a critical pod and make sure it is scheduled.
// Create a critical pod and make sure it is scheduled.
runPausePod
(
f
,
pausePodConfig
{
runPausePod
(
f
,
pausePodConfig
{
Name
:
"critical-pod"
,
Name
:
"critical-pod"
,
Namespace
:
metav1
.
NamespaceSystem
,
PriorityClassName
:
scheduling
.
SystemClusterCritical
,
PriorityClassName
:
scheduling
.
SystemClusterCritical
,
Resources
:
&
v1
.
ResourceRequirements
{
Resources
:
&
v1
.
ResourceRequirements
{
Requests
:
podRes
,
Requests
:
podRes
,
...
@@ -183,6 +184,9 @@ var _ = SIGDescribe("SchedulerPreemption [Serial] [Feature:PodPreemption]", func
...
@@ -183,6 +184,9 @@ var _ = SIGDescribe("SchedulerPreemption [Serial] [Feature:PodPreemption]", func
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
err
)
Expect
(
livePod
.
DeletionTimestamp
)
.
To
(
BeNil
())
Expect
(
livePod
.
DeletionTimestamp
)
.
To
(
BeNil
())
}
}
// Clean-up the critical pod
err
=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
metav1
.
NamespaceSystem
)
.
Delete
(
"critical-pod"
,
metav1
.
NewDeleteOptions
(
0
))
framework
.
ExpectNoError
(
err
)
})
})
// This test verifies that when a high priority pod is pending and its
// This test verifies that when a high priority pod is pending and its
...
@@ -334,10 +338,14 @@ var _ = SIGDescribe("PodPriorityResolution [Serial] [Feature:PodPreemption]", fu
...
@@ -334,10 +338,14 @@ var _ = SIGDescribe("PodPriorityResolution [Serial] [Feature:PodPreemption]", fu
for
i
,
spc
:=
range
systemPriorityClasses
{
for
i
,
spc
:=
range
systemPriorityClasses
{
pod
:=
createPausePod
(
f
,
pausePodConfig
{
pod
:=
createPausePod
(
f
,
pausePodConfig
{
Name
:
fmt
.
Sprintf
(
"pod%d-%v"
,
i
,
spc
),
Name
:
fmt
.
Sprintf
(
"pod%d-%v"
,
i
,
spc
),
Namespace
:
metav1
.
NamespaceSystem
,
PriorityClassName
:
spc
,
PriorityClassName
:
spc
,
})
})
Expect
(
pod
.
Spec
.
Priority
)
.
NotTo
(
BeNil
())
Expect
(
pod
.
Spec
.
Priority
)
.
NotTo
(
BeNil
())
framework
.
Logf
(
"Created pod: %v"
,
pod
.
Name
)
framework
.
Logf
(
"Created pod: %v"
,
pod
.
Name
)
// Clean-up the pod.
err
:=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
pod
.
Namespace
)
.
Delete
(
pod
.
Name
,
metav1
.
NewDeleteOptions
(
0
))
framework
.
ExpectNoError
(
err
)
}
}
})
})
})
})
test/kubemark/resources/kube_dns_template.yaml
View file @
0daedee0
...
@@ -60,7 +60,6 @@ spec:
...
@@ -60,7 +60,6 @@ spec:
annotations
:
annotations
:
scheduler.alpha.kubernetes.io/critical-pod
:
'
'
scheduler.alpha.kubernetes.io/critical-pod
:
'
'
spec
:
spec
:
priorityClassName
:
system-cluster-critical
tolerations
:
tolerations
:
-
key
:
"
CriticalAddonsOnly"
-
key
:
"
CriticalAddonsOnly"
operator
:
"
Exists"
operator
:
"
Exists"
...
...
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