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
4acb64f8
Commit
4acb64f8
authored
Jun 26, 2016
by
Buddha Prakash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Qos naming consistent across the codebase
parent
ff7c2802
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
22 additions
and
22 deletions
+22
-22
describe.go
pkg/kubectl/describe.go
+1
-1
sorted_resource_name_list.go
pkg/kubectl/sorted_resource_name_list.go
+1
-1
eviction_manager.go
pkg/kubelet/eviction/eviction_manager.go
+1
-1
helpers.go
pkg/kubelet/eviction/helpers.go
+3
-3
policy.go
pkg/kubelet/qos/policy.go
+1
-1
qos.go
pkg/kubelet/qos/qos.go
+11
-11
qos_test.go
pkg/kubelet/qos/qos_test.go
+2
-2
pods.go
pkg/quota/evaluator/core/pods.go
+1
-1
predicates.go
plugin/pkg/scheduler/algorithm/predicates/predicates.go
+1
-1
No files found.
pkg/kubectl/describe.go
View file @
4acb64f8
...
...
@@ -540,7 +540,7 @@ func describePod(pod *api.Pod, events *api.EventList) (string, error) {
}
}
describeVolumes
(
pod
.
Spec
.
Volumes
,
out
,
""
)
fmt
.
Fprintf
(
out
,
"QoS Class:
\t
%s
\n
"
,
qos
.
GetPodQ
os
(
pod
))
fmt
.
Fprintf
(
out
,
"QoS Class:
\t
%s
\n
"
,
qos
.
GetPodQ
OS
(
pod
))
if
events
!=
nil
{
DescribeEvents
(
events
,
out
)
}
...
...
pkg/kubectl/sorted_resource_name_list.go
View file @
4acb64f8
...
...
@@ -62,7 +62,7 @@ func (list SortableResourceQuotas) Less(i, j int) bool {
}
// SortedQoSResourceNames returns the sorted resource names of a QoS list.
func
SortedQoSResourceNames
(
list
qos
.
Q
o
SList
)
[]
api
.
ResourceName
{
func
SortedQoSResourceNames
(
list
qos
.
Q
O
SList
)
[]
api
.
ResourceName
{
resources
:=
make
([]
api
.
ResourceName
,
0
,
len
(
list
))
for
res
:=
range
list
{
resources
=
append
(
resources
,
res
)
...
...
pkg/kubelet/eviction/eviction_manager.go
View file @
4acb64f8
...
...
@@ -87,7 +87,7 @@ func (m *managerImpl) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.PodAd
if
len
(
m
.
nodeConditions
)
==
0
{
return
lifecycle
.
PodAdmitResult
{
Admit
:
true
}
}
notBestEffort
:=
qos
.
BestEffort
!=
qos
.
GetPodQ
os
(
attrs
.
Pod
)
notBestEffort
:=
qos
.
BestEffort
!=
qos
.
GetPodQ
OS
(
attrs
.
Pod
)
if
notBestEffort
{
return
lifecycle
.
PodAdmitResult
{
Admit
:
true
}
}
...
...
pkg/kubelet/eviction/helpers.go
View file @
4acb64f8
...
...
@@ -299,10 +299,10 @@ func (ms *multiSorter) Less(i, j int) bool {
return
ms
.
cmp
[
k
](
p1
,
p2
)
<
0
}
// qos compares pods by QoS (BestEffort < Burstable < Guaranteed)
// qos
Comparator
compares pods by QoS (BestEffort < Burstable < Guaranteed)
func
qosComparator
(
p1
,
p2
*
api
.
Pod
)
int
{
qosP1
:=
qos
.
GetPodQ
os
(
p1
)
qosP2
:=
qos
.
GetPodQ
os
(
p2
)
qosP1
:=
qos
.
GetPodQ
OS
(
p1
)
qosP2
:=
qos
.
GetPodQ
OS
(
p2
)
// its a tie
if
qosP1
==
qosP2
{
return
0
...
...
pkg/kubelet/qos/policy.go
View file @
4acb64f8
...
...
@@ -35,7 +35,7 @@ const (
// and 1000. Containers with higher OOM scores are killed if the system runs out of memory.
// See https://lwn.net/Articles/391222/ for more information.
func
GetContainerOOMScoreAdjust
(
pod
*
api
.
Pod
,
container
*
api
.
Container
,
memoryCapacity
int64
)
int
{
switch
GetPodQ
os
(
pod
)
{
switch
GetPodQ
OS
(
pod
)
{
case
Guaranteed
:
// Guaranteed containers should be the last to get killed.
return
guaranteedOOMScoreAdj
...
...
pkg/kubelet/qos/qos.go
View file @
4acb64f8
...
...
@@ -41,11 +41,11 @@ func isResourceBestEffort(container *api.Container, resource api.ResourceName) b
return
!
hasReq
||
req
.
Value
()
==
0
}
// GetPodQ
os
returns the QoS class of a pod.
// GetPodQ
OS
returns the QoS class of a pod.
// A pod is besteffort if none of its containers have specified any requests or limits.
// A pod is guaranteed only when requests and limits are specified for all the containers and they are equal.
// A pod is burstable if limits and requests do not match across all containers.
func
GetPodQ
os
(
pod
*
api
.
Pod
)
QOSClass
{
func
GetPodQ
OS
(
pod
*
api
.
Pod
)
QOSClass
{
requests
:=
api
.
ResourceList
{}
limits
:=
api
.
ResourceList
{}
zeroQuantity
:=
resource
.
MustParse
(
"0"
)
...
...
@@ -99,23 +99,23 @@ func GetPodQos(pod *api.Pod) QOSClass {
return
Burstable
}
// Q
o
SList is a set of (resource name, QoS class) pairs.
type
Q
o
SList
map
[
api
.
ResourceName
]
QOSClass
// Q
O
SList is a set of (resource name, QoS class) pairs.
type
Q
O
SList
map
[
api
.
ResourceName
]
QOSClass
// GetQ
o
S returns a mapping of resource name to QoS class of a container
func
GetQ
oS
(
container
*
api
.
Container
)
Qo
SList
{
resourceToQ
oS
:=
Qo
SList
{}
// GetQ
O
S returns a mapping of resource name to QoS class of a container
func
GetQ
OS
(
container
*
api
.
Container
)
QO
SList
{
resourceToQ
OS
:=
QO
SList
{}
for
resource
:=
range
allResources
(
container
)
{
switch
{
case
isResourceGuaranteed
(
container
,
resource
)
:
resourceToQ
o
S
[
resource
]
=
Guaranteed
resourceToQ
O
S
[
resource
]
=
Guaranteed
case
isResourceBestEffort
(
container
,
resource
)
:
resourceToQ
o
S
[
resource
]
=
BestEffort
resourceToQ
O
S
[
resource
]
=
BestEffort
default
:
resourceToQ
o
S
[
resource
]
=
Burstable
resourceToQ
O
S
[
resource
]
=
Burstable
}
}
return
resourceToQ
o
S
return
resourceToQ
O
S
}
// supportedComputeResources is the list of supported compute resources
...
...
pkg/kubelet/qos/qos_test.go
View file @
4acb64f8
...
...
@@ -59,7 +59,7 @@ func newPod(name string, containers []api.Container) *api.Pod {
}
}
func
TestGetPodQ
os
(
t
*
testing
.
T
)
{
func
TestGetPodQ
OS
(
t
*
testing
.
T
)
{
testCases
:=
[]
struct
{
pod
*
api
.
Pod
expected
QOSClass
...
...
@@ -125,7 +125,7 @@ func TestGetPodQos(t *testing.T) {
},
}
for
_
,
testCase
:=
range
testCases
{
if
actual
:=
GetPodQ
os
(
testCase
.
pod
);
testCase
.
expected
!=
actual
{
if
actual
:=
GetPodQ
OS
(
testCase
.
pod
);
testCase
.
expected
!=
actual
{
t
.
Errorf
(
"invalid qos pod %s, expected: %s, actual: %s"
,
testCase
.
pod
.
Name
,
testCase
.
expected
,
actual
)
}
}
...
...
pkg/quota/evaluator/core/pods.go
View file @
4acb64f8
...
...
@@ -172,7 +172,7 @@ func PodMatchesScopeFunc(scope api.ResourceQuotaScope, object runtime.Object) bo
}
func
isBestEffort
(
pod
*
api
.
Pod
)
bool
{
return
qos
.
GetPodQ
os
(
pod
)
==
qos
.
BestEffort
return
qos
.
GetPodQ
OS
(
pod
)
==
qos
.
BestEffort
}
func
isTerminating
(
pod
*
api
.
Pod
)
bool
{
...
...
plugin/pkg/scheduler/algorithm/predicates/predicates.go
View file @
4acb64f8
...
...
@@ -1020,7 +1020,7 @@ func tolerationsToleratesTaints(tolerations []api.Toleration, taints []api.Taint
// Determine if a pod is scheduled with best-effort QoS
func
isPodBestEffort
(
pod
*
api
.
Pod
)
bool
{
return
qos
.
GetPodQ
os
(
pod
)
==
qos
.
BestEffort
return
qos
.
GetPodQ
OS
(
pod
)
==
qos
.
BestEffort
}
// CheckNodeMemoryPressurePredicate checks if a pod can be scheduled on a node
...
...
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