// defaultContainerResourceRequirements returns the default requirements for a container // the requirement.Limits are taken from the LimitRange defaults (if specified) // the requirement.Requests are taken from the LimitRange min (if specified) func defaultContainerResourceRequirements(limitRange *api.LimitRange) api.ResourceRequirements { requirements := api.ResourceRequirements{} requirements.Limits = api.ResourceList{} requirements.Requests = api.ResourceList{} for i := range limitRange.Spec.Limits { limit := limitRange.Spec.Limits[i] if limit.Type == api.LimitTypeContainer { for k, v := range limit.Default { value := v.Copy() requirements.Limits[k] = *value } } } return requirements }
func getResourceRequirements(limits, requests api.ResourceList) api.ResourceRequirements { res := api.ResourceRequirements{} res.Limits = limits res.Requests = requests return res }