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
7072a50a
Commit
7072a50a
authored
Jun 20, 2017
by
Maciej Pytel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further reduce cluster-autoscaler e2e flakiness
Add pdbs for additional kube-system pod, move adding pdbs to separate function, as it will need to be reused in new tests we're working on.
parent
46fe7f06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
26 deletions
+49
-26
cluster_size_autoscaling.go
test/e2e/autoscaling/cluster_size_autoscaling.go
+49
-26
No files found.
test/e2e/autoscaling/cluster_size_autoscaling.go
View file @
7072a50a
...
...
@@ -346,32 +346,9 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
})
simpleScaleDownTest
:=
func
(
unready
int
)
{
// This is a temporary fix to allow CA to migrate some kube-system pods
// TODO: Remove this when the PDB is added for those components
By
(
"Create PodDisruptionBudgets for kube-system components, so they can be migrated if required"
)
pdbsToAdd
:=
[]
string
{
"kube-dns-autoscaler"
,
"kube-dns"
}
for
_
,
pdbLabel
:=
range
pdbsToAdd
{
By
(
fmt
.
Sprintf
(
"Create PodDisruptionBudget for %v"
,
pdbLabel
))
labelMap
:=
map
[
string
]
string
{
"k8s-app"
:
pdbLabel
}
pdbName
:=
fmt
.
Sprintf
(
"test-pdb-for-%v"
,
pdbLabel
)
minAvailable
:=
intstr
.
FromInt
(
1
)
pdb
:=
&
policy
.
PodDisruptionBudget
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
pdbName
,
Namespace
:
"kube-system"
,
},
Spec
:
policy
.
PodDisruptionBudgetSpec
{
Selector
:
&
metav1
.
LabelSelector
{
MatchLabels
:
labelMap
},
MinAvailable
:
&
minAvailable
,
},
}
_
,
err
:=
f
.
StagingClient
.
Policy
()
.
PodDisruptionBudgets
(
"kube-system"
)
.
Create
(
pdb
)
defer
func
()
{
f
.
StagingClient
.
Policy
()
.
PodDisruptionBudgets
(
"kube-system"
)
.
Delete
(
pdbName
,
&
metav1
.
DeleteOptions
{})
}()
framework
.
ExpectNoError
(
err
)
}
cleanup
,
err
:=
addKubeSystemPdbs
(
f
)
defer
cleanup
()
framework
.
ExpectNoError
(
err
)
By
(
"Manually increase cluster size"
)
increasedSize
:=
0
...
...
@@ -1081,3 +1058,49 @@ func waitForScaleUpStatus(c clientset.Interface, expected string, timeout time.D
}
return
nil
,
fmt
.
Errorf
(
"ScaleUp status did not reach expected value: %v"
,
expected
)
}
// This is a temporary fix to allow CA to migrate some kube-system pods
// TODO: Remove this when the PDB is added for those components
func
addKubeSystemPdbs
(
f
*
framework
.
Framework
)
(
func
(),
error
)
{
By
(
"Create PodDisruptionBudgets for kube-system components, so they can be migrated if required"
)
newPdbs
:=
make
([]
string
,
0
)
cleanup
:=
func
()
{
for
_
,
newPdbName
:=
range
newPdbs
{
f
.
StagingClient
.
Policy
()
.
PodDisruptionBudgets
(
"kube-system"
)
.
Delete
(
newPdbName
,
&
metav1
.
DeleteOptions
{})
}
}
type
pdbInfo
struct
{
label
string
min_available
int
}
pdbsToAdd
:=
[]
pdbInfo
{
{
label
:
"kube-dns-autoscaler"
,
min_available
:
1
},
{
label
:
"kube-dns"
,
min_available
:
1
},
{
label
:
"event-exporter"
,
min_available
:
0
},
}
for
_
,
pdbData
:=
range
pdbsToAdd
{
By
(
fmt
.
Sprintf
(
"Create PodDisruptionBudget for %v"
,
pdbData
.
label
))
labelMap
:=
map
[
string
]
string
{
"k8s-app"
:
pdbData
.
label
}
pdbName
:=
fmt
.
Sprintf
(
"test-pdb-for-%v"
,
pdbData
.
label
)
minAvailable
:=
intstr
.
FromInt
(
pdbData
.
min_available
)
pdb
:=
&
policy
.
PodDisruptionBudget
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
pdbName
,
Namespace
:
"kube-system"
,
},
Spec
:
policy
.
PodDisruptionBudgetSpec
{
Selector
:
&
metav1
.
LabelSelector
{
MatchLabels
:
labelMap
},
MinAvailable
:
&
minAvailable
,
},
}
_
,
err
:=
f
.
StagingClient
.
Policy
()
.
PodDisruptionBudgets
(
"kube-system"
)
.
Create
(
pdb
)
newPdbs
=
append
(
newPdbs
,
pdbName
)
if
err
!=
nil
{
return
cleanup
,
err
}
}
return
cleanup
,
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