(instanceType string, maxMemMap map[string]kresource.Quantity)
| 152 | } |
| 153 | |
| 154 | func 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 | |
| 185 | func validateEndpointCollisions(api *userconfig.API, virtualServices []istioclientnetworking.VirtualService) error { |
| 186 | for i := range virtualServices { |
no test coverage detected