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
aeed9cab
Commit
aeed9cab
authored
Oct 10, 2016
by
derekwaynecarr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix edge case in qos evaluation
parent
cf707989
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
qos.go
pkg/kubelet/qos/qos.go
+4
-1
qos_test.go
pkg/kubelet/qos/qos_test.go
+13
-0
No files found.
pkg/kubelet/qos/qos.go
View file @
aeed9cab
...
@@ -68,11 +68,13 @@ func GetPodQOS(pod *api.Pod) QOSClass {
...
@@ -68,11 +68,13 @@ func GetPodQOS(pod *api.Pod) QOSClass {
}
}
}
}
// process limits
// process limits
qosLimitsFound
:=
sets
.
NewString
()
for
name
,
quantity
:=
range
container
.
Resources
.
Limits
{
for
name
,
quantity
:=
range
container
.
Resources
.
Limits
{
if
!
supportedQoSComputeResources
.
Has
(
string
(
name
))
{
if
!
supportedQoSComputeResources
.
Has
(
string
(
name
))
{
continue
continue
}
}
if
quantity
.
Cmp
(
zeroQuantity
)
==
1
{
if
quantity
.
Cmp
(
zeroQuantity
)
==
1
{
qosLimitsFound
.
Insert
(
string
(
name
))
delta
:=
quantity
.
Copy
()
delta
:=
quantity
.
Copy
()
if
_
,
exists
:=
limits
[
name
];
!
exists
{
if
_
,
exists
:=
limits
[
name
];
!
exists
{
limits
[
name
]
=
*
delta
limits
[
name
]
=
*
delta
...
@@ -82,7 +84,8 @@ func GetPodQOS(pod *api.Pod) QOSClass {
...
@@ -82,7 +84,8 @@ func GetPodQOS(pod *api.Pod) QOSClass {
}
}
}
}
}
}
if
len
(
limits
)
!=
len
(
supportedQoSComputeResources
)
{
if
len
(
qosLimitsFound
)
!=
len
(
supportedQoSComputeResources
)
{
isGuaranteed
=
false
isGuaranteed
=
false
}
}
}
}
...
...
pkg/kubelet/qos/qos_test.go
View file @
aeed9cab
...
@@ -136,6 +136,12 @@ func TestGetPodQOS(t *testing.T) {
...
@@ -136,6 +136,12 @@ func TestGetPodQOS(t *testing.T) {
expected
:
Burstable
,
expected
:
Burstable
,
},
},
{
{
pod
:
newPod
(
"burstable-no-limits"
,
[]
api
.
Container
{
newContainer
(
"burstable"
,
getResourceList
(
"100m"
,
"100Mi"
),
getResourceList
(
""
,
""
)),
}),
expected
:
Burstable
,
},
{
pod
:
newPod
(
"burstable-guaranteed"
,
[]
api
.
Container
{
pod
:
newPod
(
"burstable-guaranteed"
,
[]
api
.
Container
{
newContainer
(
"burstable"
,
getResourceList
(
"1"
,
"100Mi"
),
getResourceList
(
"2"
,
"100Mi"
)),
newContainer
(
"burstable"
,
getResourceList
(
"1"
,
"100Mi"
),
getResourceList
(
"2"
,
"100Mi"
)),
newContainer
(
"guaranteed"
,
getResourceList
(
"100m"
,
"100Mi"
),
getResourceList
(
"100m"
,
"100Mi"
)),
newContainer
(
"guaranteed"
,
getResourceList
(
"100m"
,
"100Mi"
),
getResourceList
(
"100m"
,
"100Mi"
)),
...
@@ -143,6 +149,13 @@ func TestGetPodQOS(t *testing.T) {
...
@@ -143,6 +149,13 @@ func TestGetPodQOS(t *testing.T) {
expected
:
Burstable
,
expected
:
Burstable
,
},
},
{
{
pod
:
newPod
(
"burstable-unbounded-but-requests-match-limits"
,
[]
api
.
Container
{
newContainer
(
"burstable"
,
getResourceList
(
"100m"
,
"100Mi"
),
getResourceList
(
"200m"
,
"200Mi"
)),
newContainer
(
"burstable-unbounded"
,
getResourceList
(
"100m"
,
"100Mi"
),
getResourceList
(
""
,
""
)),
}),
expected
:
Burstable
,
},
{
pod
:
newPod
(
"burstable-1"
,
[]
api
.
Container
{
pod
:
newPod
(
"burstable-1"
,
[]
api
.
Container
{
newContainer
(
"burstable"
,
getResourceList
(
"10m"
,
"100Mi"
),
getResourceList
(
"100m"
,
"200Mi"
)),
newContainer
(
"burstable"
,
getResourceList
(
"10m"
,
"100Mi"
),
getResourceList
(
"100m"
,
"200Mi"
)),
}),
}),
...
...
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