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
63e51dc6
Commit
63e51dc6
authored
May 15, 2017
by
Anirudh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PDB MaxUnavailable: e2e tests
parent
078f9566
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
21 deletions
+63
-21
cluster_size_autoscaling.go
test/e2e/autoscaling/cluster_size_autoscaling.go
+2
-1
disruption.go
test/e2e/disruption.go
+60
-19
evictions_test.go
test/integration/evictions/evictions_test.go
+1
-1
No files found.
test/e2e/autoscaling/cluster_size_autoscaling.go
View file @
63e51dc6
...
...
@@ -478,6 +478,7 @@ func runDrainTest(f *framework.Framework, migSizes map[string]int, podsPerNode,
defer
framework
.
DeleteRCAndPods
(
f
.
ClientSet
,
f
.
InternalClientset
,
f
.
Namespace
.
Name
,
"reschedulable-pods"
)
By
(
"Create a PodDisruptionBudget"
)
minAvailable
:=
intstr
.
FromInt
(
numPods
-
pdbSize
)
pdb
:=
&
policy
.
PodDisruptionBudget
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"test_pdb"
,
...
...
@@ -485,7 +486,7 @@ func runDrainTest(f *framework.Framework, migSizes map[string]int, podsPerNode,
},
Spec
:
policy
.
PodDisruptionBudgetSpec
{
Selector
:
&
metav1
.
LabelSelector
{
MatchLabels
:
labelMap
},
MinAvailable
:
intstr
.
FromInt
(
numPods
-
pdbSize
)
,
MinAvailable
:
&
minAvailable
,
},
}
_
,
err
=
f
.
StagingClient
.
Policy
()
.
PodDisruptionBudgets
(
namespace
)
.
Create
(
pdb
)
...
...
test/e2e/disruption.go
View file @
63e51dc6
...
...
@@ -52,11 +52,11 @@ var _ = framework.KubeDescribe("DisruptionController", func() {
})
It
(
"should create a PodDisruptionBudget"
,
func
()
{
createP
odDisruptionBudget
OrDie
(
cs
,
ns
,
intstr
.
FromString
(
"1%"
))
createP
DBMinAvailable
OrDie
(
cs
,
ns
,
intstr
.
FromString
(
"1%"
))
})
It
(
"should update PodDisruptionBudget status"
,
func
()
{
createP
odDisruptionBudget
OrDie
(
cs
,
ns
,
intstr
.
FromInt
(
2
))
createP
DBMinAvailable
OrDie
(
cs
,
ns
,
intstr
.
FromInt
(
2
))
createPodsOrDie
(
cs
,
ns
,
3
)
waitForPodsOrDie
(
cs
,
ns
,
3
)
...
...
@@ -71,12 +71,12 @@ var _ = framework.KubeDescribe("DisruptionController", func() {
return
pdb
.
Status
.
PodDisruptionsAllowed
>
0
,
nil
})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
})
evictionCases
:=
[]
struct
{
description
string
minAvailable
intstr
.
IntOrString
maxUnavailable
intstr
.
IntOrString
podCount
int
replicaSetSize
int32
shouldDeny
bool
...
...
@@ -84,29 +84,52 @@ var _ = framework.KubeDescribe("DisruptionController", func() {
skipForBigClusters
bool
}{
{
description
:
"no PDB"
,
minAvailable
:
intstr
.
FromString
(
""
),
podCount
:
1
,
shouldDeny
:
false
,
description
:
"no PDB"
,
minAvailable
:
intstr
.
FromString
(
""
),
maxUnavailable
:
intstr
.
FromString
(
""
),
podCount
:
1
,
shouldDeny
:
false
,
},
{
description
:
"too few pods, absolute"
,
minAvailable
:
intstr
.
FromInt
(
2
),
podCount
:
2
,
shouldDeny
:
true
,
description
:
"too few pods, absolute"
,
minAvailable
:
intstr
.
FromInt
(
2
),
maxUnavailable
:
intstr
.
FromString
(
""
),
podCount
:
2
,
shouldDeny
:
true
,
},
{
description
:
"enough pods, absolute"
,
minAvailable
:
intstr
.
FromInt
(
2
),
podCount
:
3
,
shouldDeny
:
false
,
description
:
"enough pods, absolute"
,
minAvailable
:
intstr
.
FromInt
(
2
),
maxUnavailable
:
intstr
.
FromString
(
""
),
podCount
:
3
,
shouldDeny
:
false
,
},
{
description
:
"enough pods, replicaSet, percentage"
,
minAvailable
:
intstr
.
FromString
(
"90%"
),
maxUnavailable
:
intstr
.
FromString
(
""
),
replicaSetSize
:
10
,
exclusive
:
false
,
shouldDeny
:
false
,
},
{
description
:
"too few pods, replicaSet, percentage"
,
minAvailable
:
intstr
.
FromString
(
"90%"
),
maxUnavailable
:
intstr
.
FromString
(
""
),
replicaSetSize
:
10
,
exclusive
:
true
,
shouldDeny
:
true
,
// This tests assumes that there is less than replicaSetSize nodes in the cluster.
skipForBigClusters
:
true
,
},
{
description
:
"maxUnavailable allow single eviction, percentage"
,
minAvailable
:
intstr
.
FromString
(
""
),
maxUnavailable
:
intstr
.
FromString
(
"10%"
),
replicaSetSize
:
10
,
exclusive
:
false
,
shouldDeny
:
false
,
},
{
description
:
"maxUnavailable deny evictions, integer"
,
minAvailable
:
intstr
.
FromString
(
""
),
maxUnavailable
:
intstr
.
FromInt
(
1
),
replicaSetSize
:
10
,
exclusive
:
true
,
shouldDeny
:
true
,
...
...
@@ -130,7 +153,11 @@ var _ = framework.KubeDescribe("DisruptionController", func() {
}
if
c
.
minAvailable
.
String
()
!=
""
{
createPodDisruptionBudgetOrDie
(
cs
,
ns
,
c
.
minAvailable
)
createPDBMinAvailableOrDie
(
cs
,
ns
,
c
.
minAvailable
)
}
if
c
.
maxUnavailable
.
String
()
!=
""
{
createPDBMaxUnavailableOrDie
(
cs
,
ns
,
c
.
maxUnavailable
)
}
// Locate a running pod.
...
...
@@ -186,10 +213,9 @@ var _ = framework.KubeDescribe("DisruptionController", func() {
}
})
}
})
func
createP
odDisruptionBudget
OrDie
(
cs
*
kubernetes
.
Clientset
,
ns
string
,
minAvailable
intstr
.
IntOrString
)
{
func
createP
DBMinAvailable
OrDie
(
cs
*
kubernetes
.
Clientset
,
ns
string
,
minAvailable
intstr
.
IntOrString
)
{
pdb
:=
policy
.
PodDisruptionBudget
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
,
...
...
@@ -197,7 +223,22 @@ func createPodDisruptionBudgetOrDie(cs *kubernetes.Clientset, ns string, minAvai
},
Spec
:
policy
.
PodDisruptionBudgetSpec
{
Selector
:
&
metav1
.
LabelSelector
{
MatchLabels
:
map
[
string
]
string
{
"foo"
:
"bar"
}},
MinAvailable
:
minAvailable
,
MinAvailable
:
&
minAvailable
,
},
}
_
,
err
:=
cs
.
Policy
()
.
PodDisruptionBudgets
(
ns
)
.
Create
(
&
pdb
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
func
createPDBMaxUnavailableOrDie
(
cs
*
kubernetes
.
Clientset
,
ns
string
,
maxUnavailable
intstr
.
IntOrString
)
{
pdb
:=
policy
.
PodDisruptionBudget
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
,
Namespace
:
ns
,
},
Spec
:
policy
.
PodDisruptionBudgetSpec
{
Selector
:
&
metav1
.
LabelSelector
{
MatchLabels
:
map
[
string
]
string
{
"foo"
:
"bar"
}},
MaxUnavailable
:
&
maxUnavailable
,
},
}
_
,
err
:=
cs
.
Policy
()
.
PodDisruptionBudgets
(
ns
)
.
Create
(
&
pdb
)
...
...
test/integration/evictions/evictions_test.go
View file @
63e51dc6
...
...
@@ -200,7 +200,7 @@ func newPDB() *v1beta1.PodDisruptionBudget {
Name
:
"test-pdb"
,
},
Spec
:
v1beta1
.
PodDisruptionBudgetSpec
{
MinAvailable
:
intstr
.
IntOrString
{
MinAvailable
:
&
intstr
.
IntOrString
{
Type
:
intstr
.
Int
,
IntVal
:
0
,
},
...
...
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