mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
commit
b4a088f1cf
@ -25,7 +25,6 @@ pkg/apis/certificates/v1beta1
|
|||||||
pkg/apis/certificates/validation
|
pkg/apis/certificates/validation
|
||||||
pkg/apis/core/helper/qos
|
pkg/apis/core/helper/qos
|
||||||
pkg/apis/core/v1
|
pkg/apis/core/v1
|
||||||
pkg/apis/core/v1/helper
|
|
||||||
pkg/apis/core/v1/helper/qos
|
pkg/apis/core/v1/helper/qos
|
||||||
pkg/apis/core/validation
|
pkg/apis/core/validation
|
||||||
pkg/apis/discovery/v1alpha1
|
pkg/apis/discovery/v1alpha1
|
||||||
|
@ -131,22 +131,25 @@ func IsOvercommitAllowed(name v1.ResourceName) bool {
|
|||||||
!IsHugePageResourceName(name)
|
!IsHugePageResourceName(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsAttachableVolumeResourceName returns true when the resource name is prefixed in attachable volume
|
||||||
func IsAttachableVolumeResourceName(name v1.ResourceName) bool {
|
func IsAttachableVolumeResourceName(name v1.ResourceName) bool {
|
||||||
return strings.HasPrefix(string(name), v1.ResourceAttachableVolumesPrefix)
|
return strings.HasPrefix(string(name), v1.ResourceAttachableVolumesPrefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extended and Hugepages resources
|
// IsScalarResourceName validates the resource for Extended, Hugepages, Native and AttachableVolume resources
|
||||||
func IsScalarResourceName(name v1.ResourceName) bool {
|
func IsScalarResourceName(name v1.ResourceName) bool {
|
||||||
return IsExtendedResourceName(name) || IsHugePageResourceName(name) ||
|
return IsExtendedResourceName(name) || IsHugePageResourceName(name) ||
|
||||||
IsPrefixedNativeResource(name) || IsAttachableVolumeResourceName(name)
|
IsPrefixedNativeResource(name) || IsAttachableVolumeResourceName(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function aims to check if the service's ClusterIP is set or not
|
// IsServiceIPSet aims to check if the service's ClusterIP is set or not
|
||||||
// the objective is not to perform validation here
|
// the objective is not to perform validation here
|
||||||
func IsServiceIPSet(service *v1.Service) bool {
|
func IsServiceIPSet(service *v1.Service) bool {
|
||||||
return service.Spec.ClusterIP != v1.ClusterIPNone && service.Spec.ClusterIP != ""
|
return service.Spec.ClusterIP != v1.ClusterIPNone && service.Spec.ClusterIP != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadBalancerStatusEqual evaluates the given load balancers' ingress IP addresses
|
||||||
|
// and hostnames and returns true if equal or false if otherwise
|
||||||
// TODO: make method on LoadBalancerStatus?
|
// TODO: make method on LoadBalancerStatus?
|
||||||
func LoadBalancerStatusEqual(l, r *v1.LoadBalancerStatus) bool {
|
func LoadBalancerStatusEqual(l, r *v1.LoadBalancerStatus) bool {
|
||||||
return ingressSliceEqual(l.Ingress, r.Ingress)
|
return ingressSliceEqual(l.Ingress, r.Ingress)
|
||||||
@ -191,7 +194,7 @@ func GetAccessModesAsString(modes []v1.PersistentVolumeAccessMode) string {
|
|||||||
return strings.Join(modesStr, ",")
|
return strings.Join(modesStr, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAccessModesAsString returns an array of AccessModes from a string created by GetAccessModesAsString
|
// GetAccessModesFromString returns an array of AccessModes from a string created by GetAccessModesAsString
|
||||||
func GetAccessModesFromString(modes string) []v1.PersistentVolumeAccessMode {
|
func GetAccessModesFromString(modes string) []v1.PersistentVolumeAccessMode {
|
||||||
strmodes := strings.Split(modes, ",")
|
strmodes := strings.Split(modes, ",")
|
||||||
accessModes := []v1.PersistentVolumeAccessMode{}
|
accessModes := []v1.PersistentVolumeAccessMode{}
|
||||||
@ -467,7 +470,7 @@ func getFilteredTaints(taints []v1.Taint, inclusionFilter taintsFilterFunc) []v1
|
|||||||
return filteredTaints
|
return filteredTaints
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true and list of Tolerations matching all Taints if all are tolerated, or false otherwise.
|
// GetMatchingTolerations returns true and list of Tolerations matching all Taints if all are tolerated, or false otherwise.
|
||||||
func GetMatchingTolerations(taints []v1.Taint, tolerations []v1.Toleration) (bool, []v1.Toleration) {
|
func GetMatchingTolerations(taints []v1.Taint, tolerations []v1.Toleration) (bool, []v1.Toleration) {
|
||||||
if len(taints) == 0 {
|
if len(taints) == 0 {
|
||||||
return true, []v1.Toleration{}
|
return true, []v1.Toleration{}
|
||||||
@ -492,6 +495,8 @@ func GetMatchingTolerations(taints []v1.Taint, tolerations []v1.Toleration) (boo
|
|||||||
return true, result
|
return true, result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAvoidPodsFromNodeAnnotations scans the list of annotations and
|
||||||
|
// returns the pods that needs to be avoided for this node from scheduling
|
||||||
func GetAvoidPodsFromNodeAnnotations(annotations map[string]string) (v1.AvoidPods, error) {
|
func GetAvoidPodsFromNodeAnnotations(annotations map[string]string) (v1.AvoidPods, error) {
|
||||||
var avoidPods v1.AvoidPods
|
var avoidPods v1.AvoidPods
|
||||||
if len(annotations) > 0 && annotations[v1.PreferAvoidPodsAnnotationKey] != "" {
|
if len(annotations) > 0 && annotations[v1.PreferAvoidPodsAnnotationKey] != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user