mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Container limits are not applied to InitContainers
InitContainers should be checked against limit rangers
This commit is contained in:
		@@ -448,6 +448,24 @@ func PodLimitFunc(limitRange *api.LimitRange, pod *api.Pod) error {
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			for j := range pod.Spec.InitContainers {
 | 
			
		||||
				container := &pod.Spec.InitContainers[j]
 | 
			
		||||
				for k, v := range limit.Min {
 | 
			
		||||
					if err := minConstraint(limitType, k, v, container.Resources.Requests, container.Resources.Limits); err != nil {
 | 
			
		||||
						errs = append(errs, err)
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				for k, v := range limit.Max {
 | 
			
		||||
					if err := maxConstraint(limitType, k, v, container.Resources.Requests, container.Resources.Limits); err != nil {
 | 
			
		||||
						errs = append(errs, err)
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				for k, v := range limit.MaxLimitRequestRatio {
 | 
			
		||||
					if err := limitRequestRatioConstraint(limitType, k, v, container.Resources.Requests, container.Resources.Limits); err != nil {
 | 
			
		||||
						errs = append(errs, err)
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// enforce pod limits on init containers
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user