mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Merge pull request #6824 from derekwaynecarr/fix_quota_bug
Fix quota bug in LimitRanger
This commit is contained in:
commit
9b1b5c5447
@ -2,7 +2,7 @@
|
||||
"apiVersion": "v1beta3",
|
||||
"kind": "ResourceQuota",
|
||||
"metadata": {
|
||||
"name": "quota",
|
||||
"name": "quota"
|
||||
},
|
||||
"spec": {
|
||||
"hard": {
|
||||
@ -11,7 +11,7 @@
|
||||
"pods": "10",
|
||||
"services": "5",
|
||||
"replicationcontrollers":"20",
|
||||
"resourcequotas":"1",
|
||||
},
|
||||
"resourcequotas":"1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,13 @@ func defaultContainerResourceRequirements(limitRange *api.LimitRange) api.Resour
|
||||
// mergePodResourceRequirements merges enumerated requirements with default requirements
|
||||
func mergePodResourceRequirements(pod *api.Pod, defaultRequirements *api.ResourceRequirements) {
|
||||
for i := range pod.Spec.Containers {
|
||||
container := pod.Spec.Containers[i]
|
||||
container := &pod.Spec.Containers[i]
|
||||
if container.Resources.Limits == nil {
|
||||
container.Resources.Limits = api.ResourceList{}
|
||||
}
|
||||
if container.Resources.Requests == nil {
|
||||
container.Resources.Requests = api.ResourceList{}
|
||||
}
|
||||
for k, v := range defaultRequirements.Limits {
|
||||
_, found := container.Resources.Limits[k]
|
||||
if !found {
|
||||
@ -185,7 +191,7 @@ func PodLimitFunc(limitRange *api.LimitRange, pod *api.Pod) error {
|
||||
maxContainerMem := int64(0)
|
||||
|
||||
for i := range pod.Spec.Containers {
|
||||
container := pod.Spec.Containers[i]
|
||||
container := &pod.Spec.Containers[i]
|
||||
containerCPU := container.Resources.Limits.Cpu().MilliValue()
|
||||
containerMem := container.Resources.Limits.Memory().Value()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user