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
9989b675
Commit
9989b675
authored
Oct 05, 2018
by
Darren Shepherd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove BalanceAttachedNodeVolumes
parent
e5009634
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
71 deletions
+8
-71
kube_features.go
pkg/features/kube_features.go
+0
-9
predicates.go
pkg/scheduler/algorithm/predicates/predicates.go
+0
-6
balanced_resource_allocation.go
...uler/algorithm/priorities/balanced_resource_allocation.go
+0
-16
resource_allocation.go
pkg/scheduler/algorithm/priorities/resource_allocation.go
+8
-25
node_info.go
pkg/scheduler/cache/node_info.go
+0
-9
cache.go
pkg/scheduler/internal/cache/cache.go
+0
-6
No files found.
pkg/features/kube_features.go
View file @
9989b675
...
@@ -231,14 +231,6 @@ const (
...
@@ -231,14 +231,6 @@ const (
// volume limits
// volume limits
AttachVolumeLimit
utilfeature
.
Feature
=
"AttachVolumeLimit"
AttachVolumeLimit
utilfeature
.
Feature
=
"AttachVolumeLimit"
// owner: @ravig
// alpha: v1.11
//
// Include volume count on node to be considered for balanced resource allocation while scheduling.
// A node which has closer cpu,memory utilization and volume count is favoured by scheduler
// while making decisions.
BalanceAttachedNodeVolumes
utilfeature
.
Feature
=
"BalanceAttachedNodeVolumes"
// owner @freehan
// owner @freehan
// beta: v1.11
// beta: v1.11
//
//
...
@@ -349,7 +341,6 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
...
@@ -349,7 +341,6 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
GCERegionalPersistentDisk
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
GCERegionalPersistentDisk
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
RunAsGroup
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
RunAsGroup
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
VolumeSubpath
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
VolumeSubpath
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
BalanceAttachedNodeVolumes
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
PodReadinessGates
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
PodReadinessGates
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
VolumeSubpathEnvExpansion
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
VolumeSubpathEnvExpansion
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
KubeletPluginsWatcher
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
KubeletPluginsWatcher
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
...
...
pkg/scheduler/algorithm/predicates/predicates.go
View file @
9989b675
...
@@ -494,12 +494,6 @@ func (c *MaxPDVolumeCountChecker) predicate(pod *v1.Pod, meta algorithm.Predicat
...
@@ -494,12 +494,6 @@ func (c *MaxPDVolumeCountChecker) predicate(pod *v1.Pod, meta algorithm.Predicat
// violates MaxEBSVolumeCount or MaxGCEPDVolumeCount
// violates MaxEBSVolumeCount or MaxGCEPDVolumeCount
return
false
,
[]
algorithm
.
PredicateFailureReason
{
ErrMaxVolumeCountExceeded
},
nil
return
false
,
[]
algorithm
.
PredicateFailureReason
{
ErrMaxVolumeCountExceeded
},
nil
}
}
if
nodeInfo
!=
nil
&&
nodeInfo
.
TransientInfo
!=
nil
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
BalanceAttachedNodeVolumes
)
{
nodeInfo
.
TransientInfo
.
TransientLock
.
Lock
()
defer
nodeInfo
.
TransientInfo
.
TransientLock
.
Unlock
()
nodeInfo
.
TransientInfo
.
TransNodeInfo
.
AllocatableVolumesCount
=
maxAttachLimit
-
numExistingVolumes
nodeInfo
.
TransientInfo
.
TransNodeInfo
.
RequestedVolumes
=
numNewVolumes
}
return
true
,
nil
,
nil
return
true
,
nil
,
nil
}
}
...
...
pkg/scheduler/algorithm/priorities/balanced_resource_allocation.go
View file @
9989b675
...
@@ -19,8 +19,6 @@ package priorities
...
@@ -19,8 +19,6 @@ package priorities
import
(
import
(
"math"
"math"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/kubernetes/pkg/features"
schedulerapi
"k8s.io/kubernetes/pkg/scheduler/api"
schedulerapi
"k8s.io/kubernetes/pkg/scheduler/api"
schedulercache
"k8s.io/kubernetes/pkg/scheduler/cache"
schedulercache
"k8s.io/kubernetes/pkg/scheduler/cache"
)
)
...
@@ -42,20 +40,6 @@ func balancedResourceScorer(requested, allocable *schedulercache.Resource, inclu
...
@@ -42,20 +40,6 @@ func balancedResourceScorer(requested, allocable *schedulercache.Resource, inclu
cpuFraction
:=
fractionOfCapacity
(
requested
.
MilliCPU
,
allocable
.
MilliCPU
)
cpuFraction
:=
fractionOfCapacity
(
requested
.
MilliCPU
,
allocable
.
MilliCPU
)
memoryFraction
:=
fractionOfCapacity
(
requested
.
Memory
,
allocable
.
Memory
)
memoryFraction
:=
fractionOfCapacity
(
requested
.
Memory
,
allocable
.
Memory
)
// This to find a node which has most balanced CPU, memory and volume usage.
// This to find a node which has most balanced CPU, memory and volume usage.
if
includeVolumes
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
BalanceAttachedNodeVolumes
)
&&
allocatableVolumes
>
0
{
volumeFraction
:=
float64
(
requestedVolumes
)
/
float64
(
allocatableVolumes
)
if
cpuFraction
>=
1
||
memoryFraction
>=
1
||
volumeFraction
>=
1
{
// if requested >= capacity, the corresponding host should never be preferred.
return
0
}
// Compute variance for all the three fractions.
mean
:=
(
cpuFraction
+
memoryFraction
+
volumeFraction
)
/
float64
(
3
)
variance
:=
float64
((((
cpuFraction
-
mean
)
*
(
cpuFraction
-
mean
))
+
((
memoryFraction
-
mean
)
*
(
memoryFraction
-
mean
))
+
((
volumeFraction
-
mean
)
*
(
volumeFraction
-
mean
)))
/
float64
(
3
))
// Since the variance is between positive fractions, it will be positive fraction. 1-variance lets the
// score to be higher for node which has least variance and multiplying it with 10 provides the scaling
// factor needed.
return
int64
((
1
-
variance
)
*
float64
(
schedulerapi
.
MaxPriority
))
}
if
cpuFraction
>=
1
||
memoryFraction
>=
1
{
if
cpuFraction
>=
1
||
memoryFraction
>=
1
{
// if requested >= capacity, the corresponding host should never be preferred.
// if requested >= capacity, the corresponding host should never be preferred.
...
...
pkg/scheduler/algorithm/priorities/resource_allocation.go
View file @
9989b675
...
@@ -20,9 +20,7 @@ import (
...
@@ -20,9 +20,7 @@ import (
"fmt"
"fmt"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/features"
priorityutil
"k8s.io/kubernetes/pkg/scheduler/algorithm/priorities/util"
priorityutil
"k8s.io/kubernetes/pkg/scheduler/algorithm/priorities/util"
schedulerapi
"k8s.io/kubernetes/pkg/scheduler/api"
schedulerapi
"k8s.io/kubernetes/pkg/scheduler/api"
schedulercache
"k8s.io/kubernetes/pkg/scheduler/cache"
schedulercache
"k8s.io/kubernetes/pkg/scheduler/cache"
...
@@ -58,31 +56,16 @@ func (r *ResourceAllocationPriority) PriorityMap(
...
@@ -58,31 +56,16 @@ func (r *ResourceAllocationPriority) PriorityMap(
requested
.
Memory
+=
nodeInfo
.
NonZeroRequest
()
.
Memory
requested
.
Memory
+=
nodeInfo
.
NonZeroRequest
()
.
Memory
var
score
int64
var
score
int64
// Check if the pod has volumes and this could be added to scorer function for balanced resource allocation.
// Check if the pod has volumes and this could be added to scorer function for balanced resource allocation.
if
len
(
pod
.
Spec
.
Volumes
)
>=
0
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
BalanceAttachedNodeVolumes
)
&&
nodeInfo
.
TransientInfo
!=
nil
{
score
=
r
.
scorer
(
&
requested
,
&
allocatable
,
false
,
0
,
0
)
score
=
r
.
scorer
(
&
requested
,
&
allocatable
,
true
,
nodeInfo
.
TransientInfo
.
TransNodeInfo
.
RequestedVolumes
,
nodeInfo
.
TransientInfo
.
TransNodeInfo
.
AllocatableVolumesCount
)
}
else
{
score
=
r
.
scorer
(
&
requested
,
&
allocatable
,
false
,
0
,
0
)
}
if
klog
.
V
(
10
)
{
if
klog
.
V
(
10
)
{
if
len
(
pod
.
Spec
.
Volumes
)
>=
0
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
BalanceAttachedNodeVolumes
)
&&
nodeInfo
.
TransientInfo
!=
nil
{
klog
.
Infof
(
klog
.
Infof
(
"%v -> %v: %v, capacity %d millicores %d memory bytes, total request %d millicores %d memory bytes, score %d"
,
"%v -> %v: %v, capacity %d millicores %d memory bytes, %d volumes, total request %d millicores %d memory bytes %d volumes, score %d"
,
pod
.
Name
,
node
.
Name
,
r
.
Name
,
pod
.
Name
,
node
.
Name
,
r
.
Name
,
allocatable
.
MilliCPU
,
allocatable
.
Memory
,
allocatable
.
MilliCPU
,
allocatable
.
Memory
,
nodeInfo
.
TransientInfo
.
TransNodeInfo
.
AllocatableVolumesCount
,
requested
.
MilliCPU
,
requested
.
Memory
,
requested
.
MilliCPU
,
requested
.
Memory
,
score
,
nodeInfo
.
TransientInfo
.
TransNodeInfo
.
RequestedVolumes
,
)
score
,
)
}
else
{
klog
.
Infof
(
"%v -> %v: %v, capacity %d millicores %d memory bytes, total request %d millicores %d memory bytes, score %d"
,
pod
.
Name
,
node
.
Name
,
r
.
Name
,
allocatable
.
MilliCPU
,
allocatable
.
Memory
,
requested
.
MilliCPU
,
requested
.
Memory
,
score
,
)
}
}
}
return
schedulerapi
.
HostPriority
{
return
schedulerapi
.
HostPriority
{
...
...
pkg/scheduler/cache/node_info.go
View file @
9989b675
...
@@ -126,15 +126,6 @@ func NewTransientSchedulerInfo() *TransientSchedulerInfo {
...
@@ -126,15 +126,6 @@ func NewTransientSchedulerInfo() *TransientSchedulerInfo {
return
tsi
return
tsi
}
}
// ResetTransientSchedulerInfo resets the TransientSchedulerInfo.
func
(
transientSchedInfo
*
TransientSchedulerInfo
)
ResetTransientSchedulerInfo
()
{
transientSchedInfo
.
TransientLock
.
Lock
()
defer
transientSchedInfo
.
TransientLock
.
Unlock
()
// Reset TransientNodeInfo.
transientSchedInfo
.
TransNodeInfo
.
AllocatableVolumesCount
=
0
transientSchedInfo
.
TransNodeInfo
.
RequestedVolumes
=
0
}
// Resource is a collection of compute resource.
// Resource is a collection of compute resource.
type
Resource
struct
{
type
Resource
struct
{
MilliCPU
int64
MilliCPU
int64
...
...
pkg/scheduler/internal/cache/cache.go
View file @
9989b675
...
@@ -25,8 +25,6 @@ import (
...
@@ -25,8 +25,6 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/scheduler/algorithm"
"k8s.io/kubernetes/pkg/scheduler/algorithm"
schedulercache
"k8s.io/kubernetes/pkg/scheduler/cache"
schedulercache
"k8s.io/kubernetes/pkg/scheduler/cache"
...
@@ -129,10 +127,6 @@ func (cache *schedulerCache) UpdateNodeNameToInfoMap(nodeNameToInfo map[string]*
...
@@ -129,10 +127,6 @@ func (cache *schedulerCache) UpdateNodeNameToInfoMap(nodeNameToInfo map[string]*
defer
cache
.
mu
.
Unlock
()
defer
cache
.
mu
.
Unlock
()
for
name
,
info
:=
range
cache
.
nodes
{
for
name
,
info
:=
range
cache
.
nodes
{
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
BalanceAttachedNodeVolumes
)
&&
info
.
TransientInfo
!=
nil
{
// Transient scheduler info is reset here.
info
.
TransientInfo
.
ResetTransientSchedulerInfo
()
}
if
current
,
ok
:=
nodeNameToInfo
[
name
];
!
ok
||
current
.
GetGeneration
()
!=
info
.
GetGeneration
()
{
if
current
,
ok
:=
nodeNameToInfo
[
name
];
!
ok
||
current
.
GetGeneration
()
!=
info
.
GetGeneration
()
{
nodeNameToInfo
[
name
]
=
info
.
Clone
()
nodeNameToInfo
[
name
]
=
info
.
Clone
()
}
}
...
...
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