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
c9964aa5
Unverified
Commit
c9964aa5
authored
Feb 11, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 11, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73342 from szuecs/fix/period-not-reset-if-gate-not-set
cpuPeriod was not reset
parents
73dc138c
fd0cff9c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
helpers_linux.go
pkg/kubelet/kuberuntime/helpers_linux.go
+0
-8
kuberuntime_container_linux.go
pkg/kubelet/kuberuntime/kuberuntime_container_linux.go
+6
-1
No files found.
pkg/kubelet/kuberuntime/helpers_linux.go
View file @
c9964aa5
...
@@ -18,11 +18,6 @@ limitations under the License.
...
@@ -18,11 +18,6 @@ limitations under the License.
package
kuberuntime
package
kuberuntime
import
(
utilfeature
"k8s.io/apiserver/pkg/util/feature"
kubefeatures
"k8s.io/kubernetes/pkg/features"
)
const
(
const
(
// Taken from lmctfy https://github.com/google/lmctfy/blob/master/lmctfy/controllers/cpu_controller.cc
// Taken from lmctfy https://github.com/google/lmctfy/blob/master/lmctfy/controllers/cpu_controller.cc
minShares
=
2
minShares
=
2
...
@@ -59,9 +54,6 @@ func milliCPUToQuota(milliCPU int64, period int64) (quota int64) {
...
@@ -59,9 +54,6 @@ func milliCPUToQuota(milliCPU int64, period int64) (quota int64) {
if
milliCPU
==
0
{
if
milliCPU
==
0
{
return
return
}
}
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
kubefeatures
.
CPUCFSQuotaPeriod
)
{
period
=
quotaPeriod
}
// we then convert your milliCPU to a value normalized over a period
// we then convert your milliCPU to a value normalized over a period
quota
=
(
milliCPU
*
period
)
/
milliCPUToCPU
quota
=
(
milliCPU
*
period
)
/
milliCPUToCPU
...
...
pkg/kubelet/kuberuntime/kuberuntime_container_linux.go
View file @
c9964aa5
...
@@ -22,6 +22,8 @@ import (
...
@@ -22,6 +22,8 @@ import (
"time"
"time"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
kubefeatures
"k8s.io/kubernetes/pkg/features"
runtimeapi
"k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
runtimeapi
"k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
"k8s.io/kubernetes/pkg/kubelet/qos"
"k8s.io/kubernetes/pkg/kubelet/qos"
)
)
...
@@ -67,7 +69,10 @@ func (m *kubeGenericRuntimeManager) generateLinuxContainerConfig(container *v1.C
...
@@ -67,7 +69,10 @@ func (m *kubeGenericRuntimeManager) generateLinuxContainerConfig(container *v1.C
if
m
.
cpuCFSQuota
{
if
m
.
cpuCFSQuota
{
// if cpuLimit.Amount is nil, then the appropriate default value is returned
// if cpuLimit.Amount is nil, then the appropriate default value is returned
// to allow full usage of cpu resource.
// to allow full usage of cpu resource.
cpuPeriod
:=
int64
(
m
.
cpuCFSQuotaPeriod
.
Duration
/
time
.
Microsecond
)
cpuPeriod
:=
int64
(
quotaPeriod
)
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
kubefeatures
.
CPUCFSQuotaPeriod
)
{
cpuPeriod
=
int64
(
m
.
cpuCFSQuotaPeriod
.
Duration
/
time
.
Microsecond
)
}
cpuQuota
:=
milliCPUToQuota
(
cpuLimit
.
MilliValue
(),
cpuPeriod
)
cpuQuota
:=
milliCPUToQuota
(
cpuLimit
.
MilliValue
(),
cpuPeriod
)
lc
.
Resources
.
CpuQuota
=
cpuQuota
lc
.
Resources
.
CpuQuota
=
cpuQuota
lc
.
Resources
.
CpuPeriod
=
cpuPeriod
lc
.
Resources
.
CpuPeriod
=
cpuPeriod
...
...
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