mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
Cleanup work to enable feature gating annotations
This commit is contained in:
@@ -47,6 +47,7 @@ go_test(
|
||||
"//vendor:k8s.io/apimachinery/pkg/api/resource",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/labels",
|
||||
"//vendor:k8s.io/apiserver/pkg/util/feature",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ func podMatchesNodeLabels(pod *v1.Pod, node *v1.Node) bool {
|
||||
// 5. zero-length non-nil []NodeSelectorRequirement matches no nodes also, just for simplicity
|
||||
// 6. non-nil empty NodeSelectorRequirement is not allowed
|
||||
nodeAffinityMatches := true
|
||||
affinity := v1.ReconcileAffinity(pod)
|
||||
affinity := schedulercache.ReconcileAffinity(pod)
|
||||
if affinity != nil && affinity.NodeAffinity != nil {
|
||||
nodeAffinity := affinity.NodeAffinity
|
||||
// if no required NodeAffinity requirements, will do no-op, means select all nodes.
|
||||
@@ -897,7 +897,7 @@ func (c *PodAffinityChecker) InterPodAffinityMatches(pod *v1.Pod, meta interface
|
||||
}
|
||||
|
||||
// Now check if <pod> requirements will be satisfied on this node.
|
||||
affinity := v1.ReconcileAffinity(pod)
|
||||
affinity := schedulercache.ReconcileAffinity(pod)
|
||||
if affinity == nil || (affinity.PodAffinity == nil && affinity.PodAntiAffinity == nil) {
|
||||
return true, nil, nil
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ func getMatchingAntiAffinityTerms(pod *v1.Pod, nodeInfoMap map[string]*scheduler
|
||||
}
|
||||
var nodeResult []matchingPodAntiAffinityTerm
|
||||
for _, existingPod := range nodeInfo.PodsWithAffinity() {
|
||||
affinity := v1.ReconcileAffinity(existingPod)
|
||||
affinity := schedulercache.ReconcileAffinity(existingPod)
|
||||
if affinity == nil {
|
||||
continue
|
||||
}
|
||||
@@ -1029,7 +1029,7 @@ func getMatchingAntiAffinityTerms(pod *v1.Pod, nodeInfoMap map[string]*scheduler
|
||||
func (c *PodAffinityChecker) getMatchingAntiAffinityTerms(pod *v1.Pod, allPods []*v1.Pod) ([]matchingPodAntiAffinityTerm, error) {
|
||||
var result []matchingPodAntiAffinityTerm
|
||||
for _, existingPod := range allPods {
|
||||
affinity := v1.ReconcileAffinity(existingPod)
|
||||
affinity := schedulercache.ReconcileAffinity(existingPod)
|
||||
if affinity != nil && affinity.PodAntiAffinity != nil {
|
||||
existingPodNode, err := c.info.GetNodeInfo(existingPod.Spec.NodeName)
|
||||
if err != nil {
|
||||
|
||||
@@ -3581,7 +3581,7 @@ func TestVolumeZonePredicate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO remove for 1.7
|
||||
// TODO: remove when alpha support for affinity is removed
|
||||
func TestPodAnnotationFitsSelector(t *testing.T) {
|
||||
utilfeature.DefaultFeatureGate.Set("AffinityInAnnotations=true")
|
||||
tests := []struct {
|
||||
@@ -4000,7 +4000,7 @@ func TestPodAnnotationFitsSelector(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO remove for 1.7
|
||||
// TODO: remove when alpha support for affinity is removed
|
||||
func TestInterPodAffinityAnnotations(t *testing.T) {
|
||||
utilfeature.DefaultFeatureGate.Set("AffinityInAnnotations=true")
|
||||
podLabel := map[string]string{"service": "securityscan"}
|
||||
@@ -4555,7 +4555,7 @@ func TestInterPodAffinityAnnotations(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO remove for 1.7
|
||||
// TODO: remove when alpha support for affinity is removed
|
||||
func TestInterPodAffinityAnnotationsWithMultipleNodes(t *testing.T) {
|
||||
utilfeature.DefaultFeatureGate.Set("AffinityInAnnotations=true")
|
||||
podLabelA := map[string]string{
|
||||
|
||||
@@ -67,6 +67,7 @@ go_test(
|
||||
"//plugin/pkg/scheduler/schedulercache:go_default_library",
|
||||
"//vendor:k8s.io/apimachinery/pkg/api/resource",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apiserver/pkg/util/feature",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ func (p *podAffinityPriorityMap) processTerms(terms []v1.WeightedPodAffinityTerm
|
||||
// Symmetry need to be considered for preferredDuringSchedulingIgnoredDuringExecution from podAffinity & podAntiAffinity,
|
||||
// symmetry need to be considered for hard requirements from podAffinity
|
||||
func (ipa *InterPodAffinity) CalculateInterPodAffinityPriority(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo, nodes []*v1.Node) (schedulerapi.HostPriorityList, error) {
|
||||
affinity := v1.ReconcileAffinity(pod)
|
||||
affinity := schedulercache.ReconcileAffinity(pod)
|
||||
hasAffinityConstraints := affinity != nil && affinity.PodAffinity != nil
|
||||
hasAntiAffinityConstraints := affinity != nil && affinity.PodAntiAffinity != nil
|
||||
|
||||
@@ -137,7 +137,7 @@ func (ipa *InterPodAffinity) CalculateInterPodAffinityPriority(pod *v1.Pod, node
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
existingPodAffinity := v1.ReconcileAffinity(existingPod)
|
||||
existingPodAffinity := schedulercache.ReconcileAffinity(existingPod)
|
||||
existingHasAffinityConstraints := existingPodAffinity != nil && existingPodAffinity.PodAffinity != nil
|
||||
existingHasAntiAffinityConstraints := existingPodAffinity != nil && existingPodAffinity.PodAntiAffinity != nil
|
||||
|
||||
|
||||
@@ -615,7 +615,7 @@ func TestHardPodAffinitySymmetricWeight(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO remove for 1.7
|
||||
// TODO: remove when alpha support for affinity is removed
|
||||
func TestInterPodAffinityAnnotationsPriority(t *testing.T) {
|
||||
utilfeature.DefaultFeatureGate.Set("AffinityInAnnotations=true")
|
||||
labelRgChina := map[string]string{
|
||||
@@ -1089,7 +1089,7 @@ func TestInterPodAffinityAnnotationsPriority(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO remove for 1.7
|
||||
// TODO: remove when alpha support for affinity is removed
|
||||
func TestHardPodAffinityAnnotationsSymmetricWeight(t *testing.T) {
|
||||
utilfeature.DefaultFeatureGate.Set("AffinityInAnnotations=true")
|
||||
podLabelServiceS1 := map[string]string{
|
||||
|
||||
@@ -41,6 +41,6 @@ func PriorityMetadata(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.Nod
|
||||
return &priorityMetadata{
|
||||
nonZeroRequest: getNonZeroRequests(pod),
|
||||
podTolerations: tolerations,
|
||||
affinity: v1.ReconcileAffinity(pod),
|
||||
affinity: schedulercache.ReconcileAffinity(pod),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func CalculateNodeAffinityPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *s
|
||||
affinity = priorityMeta.affinity
|
||||
} else {
|
||||
// We couldn't parse metadata - fallback to the podspec.
|
||||
affinity = v1.ReconcileAffinity(pod)
|
||||
affinity = schedulercache.ReconcileAffinity(pod)
|
||||
}
|
||||
|
||||
var count int32
|
||||
|
||||
@@ -179,6 +179,7 @@ func TestNodeAffinityPriority(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: remove when alpha support for affinity is removed
|
||||
func TestNodeAffinityAnnotationsPriority(t *testing.T) {
|
||||
utilfeature.DefaultFeatureGate.Set("AffinityInAnnotations=true")
|
||||
label1 := map[string]string{"foo": "bar"}
|
||||
|
||||
Reference in New Issue
Block a user