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
63f5f310
Commit
63f5f310
authored
Jun 22, 2018
by
Łukasz Osipiuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read gpu type from TESTED_GPU_TYPE env variable
parent
4905c339
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
78 deletions
+92
-78
cluster_size_autoscaling.go
test/e2e/autoscaling/cluster_size_autoscaling.go
+92
-78
No files found.
test/e2e/autoscaling/cluster_size_autoscaling.go
View file @
63f5f310
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
"io/ioutil"
"io/ioutil"
"math"
"math"
"net/http"
"net/http"
"os"
"os/exec"
"os/exec"
"regexp"
"regexp"
"strconv"
"strconv"
...
@@ -207,110 +208,123 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
...
@@ -207,110 +208,123 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
It
(
"should increase cluster size if pending pods are small [Feature:ClusterSizeAutoscalingScaleUp]"
,
It
(
"should increase cluster size if pending pods are small [Feature:ClusterSizeAutoscalingScaleUp]"
,
func
()
{
simpleScaleUpTest
(
0
)
})
func
()
{
simpleScaleUpTest
(
0
)
})
supportedGpuTypes
:=
[]
string
{
"nvidia-tesla-k80"
,
"nvidia-tesla-v100"
,
"nvidia-tesla-p100"
}
gpuType
:=
os
.
Getenv
(
"TESTED_GPU_TYPE"
)
for
_
,
gpuType
:=
range
supportedGpuTypes
{
gpuType
:=
gpuType
// create new variable for each iteration step
It
(
fmt
.
Sprintf
(
"Should scale up GPU pool from 0 [GpuType:%s] [Feature:ClusterSizeAutoscalingGpu]"
,
gpuType
),
func
()
{
It
(
fmt
.
Sprintf
(
"Should scale up GPU pool from 0 [GpuType:%s] [Feature:ClusterSizeAutoscalingGpu]"
,
gpuType
),
func
()
{
framework
.
SkipUnlessProviderIs
(
"gke"
)
framework
.
SkipUnlessProviderIs
(
"gke"
)
if
gpuType
==
""
{
framework
.
Failf
(
"TEST_GPU_TYPE not defined"
)
return
}
const
gpuPoolName
=
"gpu-pool"
const
gpuPoolName
=
"gpu-pool"
addGpuNodePool
(
gpuPoolName
,
gpuType
,
1
,
0
)
addGpuNodePool
(
gpuPoolName
,
gpuType
,
1
,
0
)
defer
deleteNodePool
(
gpuPoolName
)
defer
deleteNodePool
(
gpuPoolName
)
installNvidiaDriversDaemonSet
()
installNvidiaDriversDaemonSet
()
By
(
"Enable autoscaler"
)
By
(
"Enable autoscaler"
)
framework
.
ExpectNoError
(
enableAutoscaler
(
gpuPoolName
,
0
,
1
))
framework
.
ExpectNoError
(
enableAutoscaler
(
gpuPoolName
,
0
,
1
))
defer
disableAutoscaler
(
gpuPoolName
,
0
,
1
)
defer
disableAutoscaler
(
gpuPoolName
,
0
,
1
)
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
0
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
0
))
By
(
"Schedule a pod which requires GPU"
)
By
(
"Schedule a pod which requires GPU"
)
framework
.
ExpectNoError
(
scheduleGpuPod
(
f
,
"gpu-pod-rc"
))
framework
.
ExpectNoError
(
scheduleGpuPod
(
f
,
"gpu-pod-rc"
))
defer
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
)
defer
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
)
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
==
nodeCount
+
1
},
scaleUpTimeout
))
func
(
size
int
)
bool
{
return
size
==
nodeCount
+
1
},
scaleUpTimeout
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
1
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
1
))
})
})
It
(
fmt
.
Sprintf
(
"Should scale up GPU pool from 1 [GpuType:%s] [Feature:ClusterSizeAutoscalingGpu]"
,
gpuType
),
func
()
{
It
(
fmt
.
Sprintf
(
"Should scale up GPU pool from 1 [GpuType:%s] [Feature:ClusterSizeAutoscalingGpu]"
,
gpuType
),
func
()
{
framework
.
SkipUnlessProviderIs
(
"gke"
)
framework
.
SkipUnlessProviderIs
(
"gke"
)
if
gpuType
==
""
{
framework
.
Failf
(
"TEST_GPU_TYPE not defined"
)
return
}
const
gpuPoolName
=
"gpu-pool"
const
gpuPoolName
=
"gpu-pool"
addGpuNodePool
(
gpuPoolName
,
gpuType
,
1
,
1
)
addGpuNodePool
(
gpuPoolName
,
gpuType
,
1
,
1
)
defer
deleteNodePool
(
gpuPoolName
)
defer
deleteNodePool
(
gpuPoolName
)
installNvidiaDriversDaemonSet
()
installNvidiaDriversDaemonSet
()
By
(
"Schedule a single pod which requires GPU"
)
By
(
"Schedule a single pod which requires GPU"
)
framework
.
ExpectNoError
(
scheduleGpuPod
(
f
,
"gpu-pod-rc"
))
framework
.
ExpectNoError
(
scheduleGpuPod
(
f
,
"gpu-pod-rc"
))
defer
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
)
defer
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
)
By
(
"Enable autoscaler"
)
By
(
"Enable autoscaler"
)
framework
.
ExpectNoError
(
enableAutoscaler
(
gpuPoolName
,
0
,
2
))
framework
.
ExpectNoError
(
enableAutoscaler
(
gpuPoolName
,
0
,
2
))
defer
disableAutoscaler
(
gpuPoolName
,
0
,
2
)
defer
disableAutoscaler
(
gpuPoolName
,
0
,
2
)
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
1
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
1
))
By
(
"Scale GPU deployment"
)
By
(
"Scale GPU deployment"
)
framework
.
ScaleRC
(
f
.
ClientSet
,
f
.
ScalesGetter
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
,
2
,
true
)
framework
.
ScaleRC
(
f
.
ClientSet
,
f
.
ScalesGetter
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
,
2
,
true
)
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
==
nodeCount
+
2
},
scaleUpTimeout
))
func
(
size
int
)
bool
{
return
size
==
nodeCount
+
2
},
scaleUpTimeout
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
2
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
2
))
})
})
It
(
fmt
.
Sprintf
(
"Should not scale GPU pool up if pod does not require GPUs [GpuType:%s] [Feature:ClusterSizeAutoscalingGpu]"
,
gpuType
),
func
()
{
It
(
fmt
.
Sprintf
(
"Should not scale GPU pool up if pod does not require GPUs [GpuType:%s] [Feature:ClusterSizeAutoscalingGpu]"
,
gpuType
),
func
()
{
framework
.
SkipUnlessProviderIs
(
"gke"
)
framework
.
SkipUnlessProviderIs
(
"gke"
)
if
gpuType
==
""
{
framework
.
Failf
(
"TEST_GPU_TYPE not defined"
)
return
}
const
gpuPoolName
=
"gpu-pool"
const
gpuPoolName
=
"gpu-pool"
addGpuNodePool
(
gpuPoolName
,
gpuType
,
1
,
0
)
addGpuNodePool
(
gpuPoolName
,
gpuType
,
1
,
0
)
defer
deleteNodePool
(
gpuPoolName
)
defer
deleteNodePool
(
gpuPoolName
)
installNvidiaDriversDaemonSet
()
installNvidiaDriversDaemonSet
()
By
(
"Enable autoscaler"
)
By
(
"Enable autoscaler"
)
framework
.
ExpectNoError
(
enableAutoscaler
(
gpuPoolName
,
0
,
1
))
framework
.
ExpectNoError
(
enableAutoscaler
(
gpuPoolName
,
0
,
1
))
defer
disableAutoscaler
(
gpuPoolName
,
0
,
1
)
defer
disableAutoscaler
(
gpuPoolName
,
0
,
1
)
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
0
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
0
))
By
(
"Schedule bunch of pods beyond point of filling default pool but do not request any GPUs"
)
By
(
"Schedule bunch of pods beyond point of filling default pool but do not request any GPUs"
)
ReserveMemory
(
f
,
"memory-reservation"
,
100
,
nodeCount
*
memAllocatableMb
,
false
,
1
*
time
.
Second
)
ReserveMemory
(
f
,
"memory-reservation"
,
100
,
nodeCount
*
memAllocatableMb
,
false
,
1
*
time
.
Second
)
defer
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"memory-reservation"
)
defer
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"memory-reservation"
)
// Verify that cluster size is increased
// Verify that cluster size is increased
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
1
},
scaleUpTimeout
))
func
(
size
int
)
bool
{
return
size
>=
nodeCount
+
1
},
scaleUpTimeout
))
// Expect gpu pool to stay intact
// Expect gpu pool to stay intact
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
0
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
0
))
})
})
It
(
fmt
.
Sprintf
(
"Should scale down GPU pool from 1 [GpuType:%s] [Feature:ClusterSizeAutoscalingGpu]"
,
gpuType
),
func
()
{
It
(
fmt
.
Sprintf
(
"Should scale down GPU pool from 1 [GpuType:%s] [Feature:ClusterSizeAutoscalingGpu]"
,
gpuType
),
func
()
{
framework
.
SkipUnlessProviderIs
(
"gke"
)
framework
.
SkipUnlessProviderIs
(
"gke"
)
if
gpuType
==
""
{
framework
.
Failf
(
"TEST_GPU_TYPE not defined"
)
return
}
const
gpuPoolName
=
"gpu-pool"
const
gpuPoolName
=
"gpu-pool"
addGpuNodePool
(
gpuPoolName
,
gpuType
,
1
,
1
)
addGpuNodePool
(
gpuPoolName
,
gpuType
,
1
,
1
)
defer
deleteNodePool
(
gpuPoolName
)
defer
deleteNodePool
(
gpuPoolName
)
installNvidiaDriversDaemonSet
()
installNvidiaDriversDaemonSet
()
By
(
"Schedule a single pod which requires GPU"
)
By
(
"Schedule a single pod which requires GPU"
)
framework
.
ExpectNoError
(
scheduleGpuPod
(
f
,
"gpu-pod-rc"
))
framework
.
ExpectNoError
(
scheduleGpuPod
(
f
,
"gpu-pod-rc"
))
defer
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
)
defer
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
)
By
(
"Enable autoscaler"
)
By
(
"Enable autoscaler"
)
framework
.
ExpectNoError
(
enableAutoscaler
(
gpuPoolName
,
0
,
1
))
framework
.
ExpectNoError
(
enableAutoscaler
(
gpuPoolName
,
0
,
1
))
defer
disableAutoscaler
(
gpuPoolName
,
0
,
1
)
defer
disableAutoscaler
(
gpuPoolName
,
0
,
1
)
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
1
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
1
))
By
(
"Remove the only POD requiring GPU"
)
By
(
"Remove the only POD requiring GPU"
)
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
)
framework
.
DeleteRCAndWaitForGC
(
f
.
ClientSet
,
f
.
Namespace
.
Name
,
"gpu-pod-rc"
)
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
framework
.
ExpectNoError
(
WaitForClusterSizeFunc
(
f
.
ClientSet
,
func
(
size
int
)
bool
{
return
size
==
nodeCount
},
scaleDownTimeout
))
func
(
size
int
)
bool
{
return
size
==
nodeCount
},
scaleDownTimeout
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
0
))
Expect
(
len
(
getPoolNodes
(
f
,
gpuPoolName
)))
.
Should
(
Equal
(
0
))
})
})
}
// TODO consider moving to [Feature:ClusterSizeAutoscalingGpu] as soon as NAP goes out of beta. Currently
// TODO consider moving to [Feature:ClusterSizeAutoscalingGpu] as soon as NAP goes out of beta. Currently
// project needed to run the NAP tests require whitelisting for NAP alpha
// project needed to run the NAP tests require whitelisting for NAP alpha
...
...
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