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
eac24430
Commit
eac24430
authored
Oct 05, 2018
by
Darren Shepherd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ResourceLimitsPriorityFunction
parent
76f4937f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
114 deletions
+0
-114
kube_features.go
pkg/features/kube_features.go
+0
-7
resource_limits.go
pkg/scheduler/algorithm/priorities/resource_limits.go
+0
-99
defaults.go
pkg/scheduler/algorithmprovider/defaults/defaults.go
+0
-8
No files found.
pkg/features/kube_features.go
View file @
eac24430
...
@@ -167,12 +167,6 @@ const (
...
@@ -167,12 +167,6 @@ const (
// Postpone deletion of a PV or a PVC when they are being used
// Postpone deletion of a PV or a PVC when they are being used
StorageObjectInUseProtection
utilfeature
.
Feature
=
"StorageObjectInUseProtection"
StorageObjectInUseProtection
utilfeature
.
Feature
=
"StorageObjectInUseProtection"
// owner: @aveshagarwal
// alpha: v1.9
//
// Enable resource limits priority function
ResourceLimitsPriorityFunction
utilfeature
.
Feature
=
"ResourceLimitsPriorityFunction"
// owner: @m1093782566
// owner: @m1093782566
// GA: v1.11
// GA: v1.11
//
//
...
@@ -358,7 +352,6 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
...
@@ -358,7 +352,6 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
CustomPodDNS
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
CustomPodDNS
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
BlockVolume
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
BlockVolume
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
StorageObjectInUseProtection
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
StorageObjectInUseProtection
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
ResourceLimitsPriorityFunction
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
SupportIPVSProxyMode
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
SupportIPVSProxyMode
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
SupportPodPidsLimit
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
SupportPodPidsLimit
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
HyperVContainer
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
HyperVContainer
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
...
...
pkg/scheduler/algorithm/priorities/resource_limits.go
deleted
100644 → 0
View file @
76f4937f
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
priorities
import
(
"fmt"
"k8s.io/api/core/v1"
schedulerapi
"k8s.io/kubernetes/pkg/scheduler/api"
schedulercache
"k8s.io/kubernetes/pkg/scheduler/cache"
"k8s.io/klog"
)
// ResourceLimitsPriorityMap is a priority function that increases score of input node by 1 if the node satisfies
// input pod's resource limits. In detail, this priority function works as follows: If a node does not publish its
// allocatable resources (cpu and memory both), the node score is not affected. If a pod does not specify
// its cpu and memory limits both, the node score is not affected. If one or both of cpu and memory limits
// of the pod are satisfied, the node is assigned a score of 1.
// Rationale of choosing the lowest score of 1 is that this is mainly selected to break ties between nodes that have
// same scores assigned by one of least and most requested priority functions.
func
ResourceLimitsPriorityMap
(
pod
*
v1
.
Pod
,
meta
interface
{},
nodeInfo
*
schedulercache
.
NodeInfo
)
(
schedulerapi
.
HostPriority
,
error
)
{
node
:=
nodeInfo
.
Node
()
if
node
==
nil
{
return
schedulerapi
.
HostPriority
{},
fmt
.
Errorf
(
"node not found"
)
}
allocatableResources
:=
nodeInfo
.
AllocatableResource
()
// compute pod limits
podLimits
:=
getResourceLimits
(
pod
)
cpuScore
:=
computeScore
(
podLimits
.
MilliCPU
,
allocatableResources
.
MilliCPU
)
memScore
:=
computeScore
(
podLimits
.
Memory
,
allocatableResources
.
Memory
)
score
:=
int
(
0
)
if
cpuScore
==
1
||
memScore
==
1
{
score
=
1
}
if
klog
.
V
(
10
)
{
// We explicitly don't do klog.V(10).Infof() to avoid computing all the parameters if this is
// not logged. There is visible performance gain from it.
klog
.
Infof
(
"%v -> %v: Resource Limits Priority, allocatable %d millicores %d memory bytes, pod limits %d millicores %d memory bytes, score %d"
,
pod
.
Name
,
node
.
Name
,
allocatableResources
.
MilliCPU
,
allocatableResources
.
Memory
,
podLimits
.
MilliCPU
,
podLimits
.
Memory
,
score
,
)
}
return
schedulerapi
.
HostPriority
{
Host
:
node
.
Name
,
Score
:
score
,
},
nil
}
// computeScore returns 1 if limit value is less than or equal to allocatable
// value, otherwise it returns 0.
func
computeScore
(
limit
,
allocatable
int64
)
int64
{
if
limit
!=
0
&&
allocatable
!=
0
&&
limit
<=
allocatable
{
return
1
}
return
0
}
// getResourceLimits computes resource limits for input pod.
// The reason to create this new function is to be consistent with other
// priority functions because most or perhaps all priority functions work
// with schedulercache.Resource.
// TODO: cache it as part of metadata passed to priority functions.
func
getResourceLimits
(
pod
*
v1
.
Pod
)
*
schedulercache
.
Resource
{
result
:=
&
schedulercache
.
Resource
{}
for
_
,
container
:=
range
pod
.
Spec
.
Containers
{
result
.
Add
(
container
.
Resources
.
Limits
)
}
// take max_resource(sum_pod, any_init_container)
for
_
,
container
:=
range
pod
.
Spec
.
InitContainers
{
result
.
SetMaxResource
(
container
.
Resources
.
Limits
)
}
return
result
}
pkg/scheduler/algorithmprovider/defaults/defaults.go
View file @
eac24430
...
@@ -209,14 +209,6 @@ func ApplyFeatureGates() {
...
@@ -209,14 +209,6 @@ func ApplyFeatureGates() {
klog
.
Infof
(
"TaintNodesByCondition is enabled, PodToleratesNodeTaints predicate is mandatory"
)
klog
.
Infof
(
"TaintNodesByCondition is enabled, PodToleratesNodeTaints predicate is mandatory"
)
}
}
// Prioritizes nodes that satisfy pod's resource limits
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
ResourceLimitsPriorityFunction
)
{
klog
.
Infof
(
"Registering resourcelimits priority function"
)
factory
.
RegisterPriorityFunction2
(
"ResourceLimitsPriority"
,
priorities
.
ResourceLimitsPriorityMap
,
nil
,
1
)
// Register the priority function to specific provider too.
factory
.
InsertPriorityKeyToAlgorithmProviderMap
(
factory
.
RegisterPriorityFunction2
(
"ResourceLimitsPriority"
,
priorities
.
ResourceLimitsPriorityMap
,
nil
,
1
))
}
}
}
func
registerAlgorithmProvider
(
predSet
,
priSet
sets
.
String
)
{
func
registerAlgorithmProvider
(
predSet
,
priSet
sets
.
String
)
{
...
...
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