MCPcopy
hub / github.com/cortexlabs/cortex / getNodeCapacity

Function getNodeCapacity

pkg/operator/resources/validations.go:154–183  ·  view source on GitHub ↗
(instanceType string, maxMemMap map[string]kresource.Quantity)

Source from the content-addressed store, hash-verified

152}
153
154func getNodeCapacity(instanceType string, maxMemMap map[string]kresource.Quantity) (kresource.Quantity, kresource.Quantity, int64, int64) {
155 instanceMetadata := aws.InstanceMetadatas[config.ClusterConfig.Region][instanceType]
156
157 cpu := instanceMetadata.CPU.DeepCopy()
158 cpu.Sub(consts.CortexCPUPodReserved)
159 cpu.Sub(consts.CortexCPUK8sReserved)
160
161 mem := maxMemMap[instanceType].DeepCopy()
162 mem.Sub(consts.CortexMemPodReserved)
163 mem.Sub(consts.CortexMemK8sReserved)
164
165 gpu := instanceMetadata.GPU
166 if gpu > 0 {
167 // Reserve resources for nvidia device plugin daemonset
168 cpu.Sub(_nvidiaDevicePluginCPUReserve)
169 mem.Sub(_nvidiaDevicePluginMemReserve)
170 // Reserve resources for nvidia dcgm prometheus exporter
171 cpu.Sub(_nvidiaDCGMExporterCPUReserve)
172 mem.Sub(_nvidiaDCGMExporterMemReserve)
173 }
174
175 inf := instanceMetadata.Inf
176 if inf > 0 {
177 // Reserve resources for neuron device plugin daemonset
178 cpu.Sub(_neuronDevicePluginCPUReserve)
179 mem.Sub(_neuronDevicePluginMemReserve)
180 }
181
182 return cpu, mem, gpu, inf
183}
184
185func validateEndpointCollisions(api *userconfig.API, virtualServices []istioclientnetworking.VirtualService) error {
186 for i := range virtualServices {

Callers 2

validateK8sComputeFunction · 0.85
nodeGroupResourcesTableFunction · 0.85

Calls 2

SubMethod · 0.80
DeepCopyMethod · 0.45

Tested by

no test coverage detected