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
c3b06f3e
Commit
c3b06f3e
authored
Aug 25, 2017
by
Irfan Ur Rehman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue fix in hpa e2e util
parent
eb33d1b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
22 deletions
+19
-22
autoscaling_utils.go
test/e2e/common/autoscaling_utils.go
+19
-22
No files found.
test/e2e/common/autoscaling_utils.go
View file @
c3b06f3e
...
...
@@ -101,15 +101,15 @@ func GetResourceConsumerImage() string {
return
resourceConsumerImage
}
func
NewDynamicResourceConsumer
(
name
,
nsName
,
kind
string
,
replicas
,
initCPUTotal
,
initMemoryTotal
,
initCustomMetric
int
,
cpuLimit
,
memLimit
int64
,
client
S
et
clientset
.
Interface
,
internalClientset
*
internalclientset
.
Clientset
)
*
ResourceConsumer
{
func
NewDynamicResourceConsumer
(
name
,
nsName
,
kind
string
,
replicas
,
initCPUTotal
,
initMemoryTotal
,
initCustomMetric
int
,
cpuLimit
,
memLimit
int64
,
client
s
et
clientset
.
Interface
,
internalClientset
*
internalclientset
.
Clientset
)
*
ResourceConsumer
{
return
newResourceConsumer
(
name
,
nsName
,
kind
,
replicas
,
initCPUTotal
,
initMemoryTotal
,
initCustomMetric
,
dynamicConsumptionTimeInSeconds
,
dynamicRequestSizeInMillicores
,
dynamicRequestSizeInMegabytes
,
dynamicRequestSizeCustomMetric
,
cpuLimit
,
memLimit
,
client
S
et
,
internalClientset
)
dynamicRequestSizeInMillicores
,
dynamicRequestSizeInMegabytes
,
dynamicRequestSizeCustomMetric
,
cpuLimit
,
memLimit
,
client
s
et
,
internalClientset
)
}
// TODO this still defaults to replication controller
func
NewStaticResourceConsumer
(
name
,
nsName
string
,
replicas
,
initCPUTotal
,
initMemoryTotal
,
initCustomMetric
int
,
cpuLimit
,
memLimit
int64
,
client
S
et
clientset
.
Interface
,
internalClientset
*
internalclientset
.
Clientset
)
*
ResourceConsumer
{
func
NewStaticResourceConsumer
(
name
,
nsName
string
,
replicas
,
initCPUTotal
,
initMemoryTotal
,
initCustomMetric
int
,
cpuLimit
,
memLimit
int64
,
client
s
et
clientset
.
Interface
,
internalClientset
*
internalclientset
.
Clientset
)
*
ResourceConsumer
{
return
newResourceConsumer
(
name
,
nsName
,
KindRC
,
replicas
,
initCPUTotal
,
initMemoryTotal
,
initCustomMetric
,
staticConsumptionTimeInSeconds
,
initCPUTotal
/
replicas
,
initMemoryTotal
/
replicas
,
initCustomMetric
/
replicas
,
cpuLimit
,
memLimit
,
client
S
et
,
internalClientset
)
initCPUTotal
/
replicas
,
initMemoryTotal
/
replicas
,
initCustomMetric
/
replicas
,
cpuLimit
,
memLimit
,
client
s
et
,
internalClientset
)
}
/*
...
...
@@ -120,15 +120,15 @@ memLimit argument is in megabytes, memLimit is a maximum amount of memory that c
cpuLimit argument is in millicores, cpuLimit is a maximum amount of cpu that can be consumed by a single pod
*/
func
newResourceConsumer
(
name
,
nsName
,
kind
string
,
replicas
,
initCPUTotal
,
initMemoryTotal
,
initCustomMetric
,
consumptionTimeInSeconds
,
requestSizeInMillicores
,
requestSizeInMegabytes
int
,
requestSizeCustomMetric
int
,
cpuLimit
,
memLimit
int64
,
client
S
et
clientset
.
Interface
,
internalClientset
*
internalclientset
.
Clientset
)
*
ResourceConsumer
{
requestSizeInMegabytes
int
,
requestSizeCustomMetric
int
,
cpuLimit
,
memLimit
int64
,
client
s
et
clientset
.
Interface
,
internalClientset
*
internalclientset
.
Clientset
)
*
ResourceConsumer
{
runServiceAndWorkloadForResourceConsumer
(
client
S
et
,
internalClientset
,
nsName
,
name
,
kind
,
replicas
,
cpuLimit
,
memLimit
)
runServiceAndWorkloadForResourceConsumer
(
client
s
et
,
internalClientset
,
nsName
,
name
,
kind
,
replicas
,
cpuLimit
,
memLimit
)
rc
:=
&
ResourceConsumer
{
name
:
name
,
controllerName
:
name
+
"-ctrl"
,
kind
:
kind
,
nsName
:
nsName
,
clientSet
:
client
S
et
,
clientSet
:
client
s
et
,
internalClientset
:
internalClientset
,
cpu
:
make
(
chan
int
),
mem
:
make
(
chan
int
),
...
...
@@ -235,13 +235,12 @@ func (rc *ResourceConsumer) makeConsumeCustomMetric() {
}
func
(
rc
*
ResourceConsumer
)
sendConsumeCPURequest
(
millicores
int
)
{
proxyRequest
,
err
:=
framework
.
GetServicesProxyRequest
(
rc
.
clientSet
,
rc
.
clientSet
.
Core
()
.
RESTClient
()
.
Post
())
framework
.
ExpectNoError
(
err
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
framework
.
SingleCallTimeout
)
defer
cancel
()
err
=
wait
.
PollImmediate
(
serviceInitializationInterval
,
serviceInitializationTimeout
,
func
()
(
bool
,
error
)
{
err
:=
wait
.
PollImmediate
(
serviceInitializationInterval
,
serviceInitializationTimeout
,
func
()
(
bool
,
error
)
{
proxyRequest
,
err
:=
framework
.
GetServicesProxyRequest
(
rc
.
clientSet
,
rc
.
clientSet
.
Core
()
.
RESTClient
()
.
Post
())
framework
.
ExpectNoError
(
err
)
req
:=
proxyRequest
.
Namespace
(
rc
.
nsName
)
.
Context
(
ctx
)
.
Name
(
rc
.
controllerName
)
.
...
...
@@ -250,7 +249,7 @@ func (rc *ResourceConsumer) sendConsumeCPURequest(millicores int) {
Param
(
"durationSec"
,
strconv
.
Itoa
(
rc
.
consumptionTimeInSeconds
))
.
Param
(
"requestSizeMillicores"
,
strconv
.
Itoa
(
rc
.
requestSizeInMillicores
))
framework
.
Logf
(
"ConsumeCPU URL: %v"
,
*
req
.
URL
())
_
,
err
:
=
req
.
DoRaw
()
_
,
err
=
req
.
DoRaw
()
if
err
!=
nil
{
framework
.
Logf
(
"ConsumeCPU failure: %v"
,
err
)
return
false
,
nil
...
...
@@ -263,13 +262,12 @@ func (rc *ResourceConsumer) sendConsumeCPURequest(millicores int) {
// sendConsumeMemRequest sends POST request for memory consumption
func
(
rc
*
ResourceConsumer
)
sendConsumeMemRequest
(
megabytes
int
)
{
proxyRequest
,
err
:=
framework
.
GetServicesProxyRequest
(
rc
.
clientSet
,
rc
.
clientSet
.
Core
()
.
RESTClient
()
.
Post
())
framework
.
ExpectNoError
(
err
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
framework
.
SingleCallTimeout
)
defer
cancel
()
err
=
wait
.
PollImmediate
(
serviceInitializationInterval
,
serviceInitializationTimeout
,
func
()
(
bool
,
error
)
{
err
:=
wait
.
PollImmediate
(
serviceInitializationInterval
,
serviceInitializationTimeout
,
func
()
(
bool
,
error
)
{
proxyRequest
,
err
:=
framework
.
GetServicesProxyRequest
(
rc
.
clientSet
,
rc
.
clientSet
.
Core
()
.
RESTClient
()
.
Post
())
framework
.
ExpectNoError
(
err
)
req
:=
proxyRequest
.
Namespace
(
rc
.
nsName
)
.
Context
(
ctx
)
.
Name
(
rc
.
controllerName
)
.
...
...
@@ -278,7 +276,7 @@ func (rc *ResourceConsumer) sendConsumeMemRequest(megabytes int) {
Param
(
"durationSec"
,
strconv
.
Itoa
(
rc
.
consumptionTimeInSeconds
))
.
Param
(
"requestSizeMegabytes"
,
strconv
.
Itoa
(
rc
.
requestSizeInMegabytes
))
framework
.
Logf
(
"ConsumeMem URL: %v"
,
*
req
.
URL
())
_
,
err
:
=
req
.
DoRaw
()
_
,
err
=
req
.
DoRaw
()
if
err
!=
nil
{
framework
.
Logf
(
"ConsumeMem failure: %v"
,
err
)
return
false
,
nil
...
...
@@ -291,13 +289,12 @@ func (rc *ResourceConsumer) sendConsumeMemRequest(megabytes int) {
// sendConsumeCustomMetric sends POST request for custom metric consumption
func
(
rc
*
ResourceConsumer
)
sendConsumeCustomMetric
(
delta
int
)
{
proxyRequest
,
err
:=
framework
.
GetServicesProxyRequest
(
rc
.
clientSet
,
rc
.
clientSet
.
Core
()
.
RESTClient
()
.
Post
())
framework
.
ExpectNoError
(
err
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
framework
.
SingleCallTimeout
)
defer
cancel
()
err
=
wait
.
PollImmediate
(
serviceInitializationInterval
,
serviceInitializationTimeout
,
func
()
(
bool
,
error
)
{
err
:=
wait
.
PollImmediate
(
serviceInitializationInterval
,
serviceInitializationTimeout
,
func
()
(
bool
,
error
)
{
proxyRequest
,
err
:=
framework
.
GetServicesProxyRequest
(
rc
.
clientSet
,
rc
.
clientSet
.
Core
()
.
RESTClient
()
.
Post
())
framework
.
ExpectNoError
(
err
)
req
:=
proxyRequest
.
Namespace
(
rc
.
nsName
)
.
Context
(
ctx
)
.
Name
(
rc
.
controllerName
)
.
...
...
@@ -307,7 +304,7 @@ func (rc *ResourceConsumer) sendConsumeCustomMetric(delta int) {
Param
(
"durationSec"
,
strconv
.
Itoa
(
rc
.
consumptionTimeInSeconds
))
.
Param
(
"requestSizeMetrics"
,
strconv
.
Itoa
(
rc
.
requestSizeCustomMetric
))
framework
.
Logf
(
"ConsumeCustomMetric URL: %v"
,
*
req
.
URL
())
_
,
err
:
=
req
.
DoRaw
()
_
,
err
=
req
.
DoRaw
()
if
err
!=
nil
{
framework
.
Logf
(
"ConsumeCustomMetric failure: %v"
,
err
)
return
false
,
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