Documentation ¶
Index ¶
- Constants
- Variables
- func EmptyTenantResourceQuota() corev1.ResourceList
- func GetDefaultEnvironmentLimitRange() []corev1.LimitRangeItem
- func GetDefaultEnvironmentResourceQuota() corev1.ResourceList
- func GetDefaultTeantResourceQuota() corev1.ResourceList
- func IsLimitRangeInvalid(limitRangeItems []corev1.LimitRangeItem) ([]string, bool)
- func ResourceEnough(total, used, need corev1.ResourceList) (bool, []string)
- func ResourceIsEnough(total, used, need corev1.ResourceList, resources []corev1.ResourceName) (bool, []string)
- func SubResource(oldres, newres corev1.ResourceList) corev1.ResourceList
Constants ¶
View Source
const ( ResourceNvidiaGPU = "nvidia.com/gpu" RequestsNvdiaGPUs = corev1.DefaultResourceRequestsPrefix + ResourceNvidiaGPU LimitsNvdiaGPUs = "limits." + ResourceNvidiaGPU )
View Source
const ( DefaultResourceQuotaName = "default" DefaultLimitRangeName = "default" )
Variables ¶
View Source
var ( ResourceDeployments corev1.ResourceName = "count/deployments.apps" ResourceStatefulSets corev1.ResourceName = "count/statefulsets.apps" ResourceJobs corev1.ResourceName = "count/jobs.batch" ResourceCronJobs corev1.ResourceName = "count/cronjobs.batch" ResourceSecrets corev1.ResourceName = "count/secrets" ResourceConfigMaps corev1.ResourceName = "count/configmaps" ResourceServices corev1.ResourceName = "count/services" ResourcePersistentVolumeClaims corev1.ResourceName = "count/persistentvolumeclaims" ResourceDaemonsets corev1.ResourceName = "count/daemonsets.apps" ResourceIngresses corev1.ResourceName = "count/ingresses.extensions" )
View Source
var ( TenantLimitResources = []corev1.ResourceName{ corev1.ResourceLimitsCPU, corev1.ResourceLimitsMemory, corev1.ResourceRequestsStorage, RequestsNvdiaGPUs, } EnvironmentLimitResources = []corev1.ResourceName{ corev1.ResourceCPU, corev1.ResourceMemory, corev1.ResourceRequestsStorage, corev1.ResourcePods, ResourceDeployments, ResourceStatefulSets, ResourceServices, ResourceConfigMaps, ResourceSecrets, ResourceJobs, ResourceCronJobs, ResourcePersistentVolumeClaims, RequestsNvdiaGPUs, } )
Functions ¶
func EmptyTenantResourceQuota ¶
func EmptyTenantResourceQuota() corev1.ResourceList
func GetDefaultEnvironmentLimitRange ¶
func GetDefaultEnvironmentLimitRange() []corev1.LimitRangeItem
GetDefaultEnvironmentLimitRange 环境默认的limitranger
func GetDefaultEnvironmentResourceQuota ¶
func GetDefaultEnvironmentResourceQuota() corev1.ResourceList
GetDefaultEnvironmentResourceQuota 环境的默认资源限制
func GetDefaultTeantResourceQuota ¶
func GetDefaultTeantResourceQuota() corev1.ResourceList
GetDefaultTeantResourceQuota 获取默认的ResourceQuota
func IsLimitRangeInvalid ¶
func IsLimitRangeInvalid(limitRangeItems []corev1.LimitRangeItem) ([]string, bool)
func ResourceEnough ¶
func ResourceEnough(total, used, need corev1.ResourceList) (bool, []string)
ResourceEnough 资源 是否足够,不够给出不够的错误项
func ResourceIsEnough ¶
func ResourceIsEnough(total, used, need corev1.ResourceList, resources []corev1.ResourceName) (bool, []string)
func SubResource ¶
func SubResource(oldres, newres corev1.ResourceList) corev1.ResourceList
SubResource 用新的值去减去旧的,得到差
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.