123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128 |
- /*
- Copyright 2015 The Kubernetes Authors.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- package compatibility
- import (
- "fmt"
- "net/http/httptest"
- "reflect"
- "testing"
- "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/informers"
- clientset "k8s.io/client-go/kubernetes"
- restclient "k8s.io/client-go/rest"
- utiltesting "k8s.io/client-go/util/testing"
- _ "k8s.io/kubernetes/pkg/apis/core/install"
- _ "k8s.io/kubernetes/pkg/scheduler/algorithmprovider/defaults"
- schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
- latestschedulerapi "k8s.io/kubernetes/pkg/scheduler/api/latest"
- "k8s.io/kubernetes/pkg/scheduler/factory"
- )
- func TestCompatibility_v1_Scheduler(t *testing.T) {
- // Add serialized versions of scheduler config that exercise available options to ensure compatibility between releases
- schedulerFiles := map[string]struct {
- JSON string
- ExpectedPolicy schedulerapi.Policy
- }{
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.0": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsPorts"},
- {"name": "NoDiskConflict"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "LeastRequestedPriority", "weight": 1},
- {"name": "ServiceSpreadingPriority", "weight": 2},
- {"name": "TestServiceAntiAffinity", "weight": 3, "argument": {"serviceAntiAffinity": {"label": "zone"}}},
- {"name": "TestLabelPreference", "weight": 4, "argument": {"labelPreference": {"label": "bar", "presence":true}}}
- ]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsPorts"},
- {Name: "NoDiskConflict"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "LeastRequestedPriority", Weight: 1},
- {Name: "ServiceSpreadingPriority", Weight: 2},
- {Name: "TestServiceAntiAffinity", Weight: 3, Argument: &schedulerapi.PriorityArgument{ServiceAntiAffinity: &schedulerapi.ServiceAntiAffinity{Label: "zone"}}},
- {Name: "TestLabelPreference", Weight: 4, Argument: &schedulerapi.PriorityArgument{LabelPreference: &schedulerapi.LabelPreference{Label: "bar", Presence: true}}},
- },
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.1": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsHostPorts"},
- {"name": "PodFitsResources"},
- {"name": "NoDiskConflict"},
- {"name": "HostName"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "TestServiceAntiAffinity", "weight": 3, "argument": {"serviceAntiAffinity": {"label": "zone"}}},
- {"name": "TestLabelPreference", "weight": 4, "argument": {"labelPreference": {"label": "bar", "presence":true}}}
- ]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsHostPorts"},
- {Name: "PodFitsResources"},
- {Name: "NoDiskConflict"},
- {Name: "HostName"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "TestServiceAntiAffinity", Weight: 3, Argument: &schedulerapi.PriorityArgument{ServiceAntiAffinity: &schedulerapi.ServiceAntiAffinity{Label: "zone"}}},
- {Name: "TestLabelPreference", Weight: 4, Argument: &schedulerapi.PriorityArgument{LabelPreference: &schedulerapi.LabelPreference{Label: "bar", Presence: true}}},
- },
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.2": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "TestServiceAntiAffinity", "weight": 3, "argument": {"serviceAntiAffinity": {"label": "zone"}}},
- {"name": "TestLabelPreference", "weight": 4, "argument": {"labelPreference": {"label": "bar", "presence":true}}}
- ]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "TestServiceAntiAffinity", Weight: 3, Argument: &schedulerapi.PriorityArgument{ServiceAntiAffinity: &schedulerapi.ServiceAntiAffinity{Label: "zone"}}},
- {Name: "TestLabelPreference", Weight: 4, Argument: &schedulerapi.PriorityArgument{LabelPreference: &schedulerapi.LabelPreference{Label: "bar", Presence: true}}},
- },
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.3": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "PodToleratesNodeTaints"},
- {"name": "CheckNodeMemoryPressure"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "MatchInterPodAffinity"},
- {"name": "GeneralPredicates"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "TaintTolerationPriority", "weight": 2},
- {"name": "InterPodAffinityPriority", "weight": 2}
- ]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "PodToleratesNodeTaints"},
- {Name: "CheckNodeMemoryPressure"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "MatchInterPodAffinity"},
- {Name: "GeneralPredicates"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "TaintTolerationPriority", Weight: 2},
- {Name: "InterPodAffinityPriority", Weight: 2},
- },
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.4": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "PodToleratesNodeTaints"},
- {"name": "CheckNodeMemoryPressure"},
- {"name": "CheckNodeDiskPressure"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "MatchInterPodAffinity"},
- {"name": "GeneralPredicates"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "NodePreferAvoidPodsPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "TaintTolerationPriority", "weight": 2},
- {"name": "InterPodAffinityPriority", "weight": 2},
- {"name": "MostRequestedPriority", "weight": 2}
- ]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "PodToleratesNodeTaints"},
- {Name: "CheckNodeMemoryPressure"},
- {Name: "CheckNodeDiskPressure"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "MatchInterPodAffinity"},
- {Name: "GeneralPredicates"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "NodePreferAvoidPodsPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "TaintTolerationPriority", Weight: 2},
- {Name: "InterPodAffinityPriority", Weight: 2},
- {Name: "MostRequestedPriority", Weight: 2},
- },
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.7": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "PodToleratesNodeTaints"},
- {"name": "CheckNodeMemoryPressure"},
- {"name": "CheckNodeDiskPressure"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "MatchInterPodAffinity"},
- {"name": "GeneralPredicates"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "NodePreferAvoidPodsPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "TaintTolerationPriority", "weight": 2},
- {"name": "InterPodAffinityPriority", "weight": 2},
- {"name": "MostRequestedPriority", "weight": 2}
- ],"extenders": [{
- "urlPrefix": "/prefix",
- "filterVerb": "filter",
- "prioritizeVerb": "prioritize",
- "weight": 1,
- "BindVerb": "bind",
- "enableHttps": true,
- "tlsConfig": {"Insecure":true},
- "httpTimeout": 1,
- "nodeCacheCapable": true
- }]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "PodToleratesNodeTaints"},
- {Name: "CheckNodeMemoryPressure"},
- {Name: "CheckNodeDiskPressure"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "MatchInterPodAffinity"},
- {Name: "GeneralPredicates"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "NodePreferAvoidPodsPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "TaintTolerationPriority", Weight: 2},
- {Name: "InterPodAffinityPriority", Weight: 2},
- {Name: "MostRequestedPriority", Weight: 2},
- },
- ExtenderConfigs: []schedulerapi.ExtenderConfig{{
- URLPrefix: "/prefix",
- FilterVerb: "filter",
- PrioritizeVerb: "prioritize",
- Weight: 1,
- BindVerb: "bind", // 1.7 was missing json tags on the BindVerb field and required "BindVerb"
- EnableHTTPS: true,
- TLSConfig: &schedulerapi.ExtenderTLSConfig{Insecure: true},
- HTTPTimeout: 1,
- NodeCacheCapable: true,
- }},
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.8": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "PodToleratesNodeTaints"},
- {"name": "CheckNodeMemoryPressure"},
- {"name": "CheckNodeDiskPressure"},
- {"name": "CheckNodeCondition"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "MatchInterPodAffinity"},
- {"name": "GeneralPredicates"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "NodePreferAvoidPodsPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "TaintTolerationPriority", "weight": 2},
- {"name": "InterPodAffinityPriority", "weight": 2},
- {"name": "MostRequestedPriority", "weight": 2}
- ],"extenders": [{
- "urlPrefix": "/prefix",
- "filterVerb": "filter",
- "prioritizeVerb": "prioritize",
- "weight": 1,
- "bindVerb": "bind",
- "enableHttps": true,
- "tlsConfig": {"Insecure":true},
- "httpTimeout": 1,
- "nodeCacheCapable": true
- }]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "PodToleratesNodeTaints"},
- {Name: "CheckNodeMemoryPressure"},
- {Name: "CheckNodeDiskPressure"},
- {Name: "CheckNodeCondition"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "MatchInterPodAffinity"},
- {Name: "GeneralPredicates"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "NodePreferAvoidPodsPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "TaintTolerationPriority", Weight: 2},
- {Name: "InterPodAffinityPriority", Weight: 2},
- {Name: "MostRequestedPriority", Weight: 2},
- },
- ExtenderConfigs: []schedulerapi.ExtenderConfig{{
- URLPrefix: "/prefix",
- FilterVerb: "filter",
- PrioritizeVerb: "prioritize",
- Weight: 1,
- BindVerb: "bind", // 1.8 became case-insensitive and tolerated "bindVerb"
- EnableHTTPS: true,
- TLSConfig: &schedulerapi.ExtenderTLSConfig{Insecure: true},
- HTTPTimeout: 1,
- NodeCacheCapable: true,
- }},
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.9": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "PodToleratesNodeTaints"},
- {"name": "CheckNodeMemoryPressure"},
- {"name": "CheckNodeDiskPressure"},
- {"name": "CheckNodeCondition"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "MatchInterPodAffinity"},
- {"name": "GeneralPredicates"},
- {"name": "CheckVolumeBinding"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "NodePreferAvoidPodsPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "TaintTolerationPriority", "weight": 2},
- {"name": "InterPodAffinityPriority", "weight": 2},
- {"name": "MostRequestedPriority", "weight": 2}
- ],"extenders": [{
- "urlPrefix": "/prefix",
- "filterVerb": "filter",
- "prioritizeVerb": "prioritize",
- "weight": 1,
- "bindVerb": "bind",
- "enableHttps": true,
- "tlsConfig": {"Insecure":true},
- "httpTimeout": 1,
- "nodeCacheCapable": true
- }]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "PodToleratesNodeTaints"},
- {Name: "CheckNodeMemoryPressure"},
- {Name: "CheckNodeDiskPressure"},
- {Name: "CheckNodeCondition"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "MatchInterPodAffinity"},
- {Name: "GeneralPredicates"},
- {Name: "CheckVolumeBinding"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "NodePreferAvoidPodsPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "TaintTolerationPriority", Weight: 2},
- {Name: "InterPodAffinityPriority", Weight: 2},
- {Name: "MostRequestedPriority", Weight: 2},
- },
- ExtenderConfigs: []schedulerapi.ExtenderConfig{{
- URLPrefix: "/prefix",
- FilterVerb: "filter",
- PrioritizeVerb: "prioritize",
- Weight: 1,
- BindVerb: "bind", // 1.9 was case-insensitive and tolerated "bindVerb"
- EnableHTTPS: true,
- TLSConfig: &schedulerapi.ExtenderTLSConfig{Insecure: true},
- HTTPTimeout: 1,
- NodeCacheCapable: true,
- }},
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.10": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "PodToleratesNodeTaints"},
- {"name": "CheckNodeMemoryPressure"},
- {"name": "CheckNodeDiskPressure"},
- {"name": "CheckNodePIDPressure"},
- {"name": "CheckNodeCondition"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "MatchInterPodAffinity"},
- {"name": "GeneralPredicates"},
- {"name": "CheckVolumeBinding"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "NodePreferAvoidPodsPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "TaintTolerationPriority", "weight": 2},
- {"name": "InterPodAffinityPriority", "weight": 2},
- {"name": "MostRequestedPriority", "weight": 2}
- ],"extenders": [{
- "urlPrefix": "/prefix",
- "filterVerb": "filter",
- "prioritizeVerb": "prioritize",
- "weight": 1,
- "bindVerb": "bind",
- "enableHttps": true,
- "tlsConfig": {"Insecure":true},
- "httpTimeout": 1,
- "nodeCacheCapable": true,
- "managedResources": [{"name":"example.com/foo","ignoredByScheduler":true}],
- "ignorable":true
- }]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "PodToleratesNodeTaints"},
- {Name: "CheckNodeMemoryPressure"},
- {Name: "CheckNodeDiskPressure"},
- {Name: "CheckNodePIDPressure"},
- {Name: "CheckNodeCondition"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "MatchInterPodAffinity"},
- {Name: "GeneralPredicates"},
- {Name: "CheckVolumeBinding"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "NodePreferAvoidPodsPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "TaintTolerationPriority", Weight: 2},
- {Name: "InterPodAffinityPriority", Weight: 2},
- {Name: "MostRequestedPriority", Weight: 2},
- },
- ExtenderConfigs: []schedulerapi.ExtenderConfig{{
- URLPrefix: "/prefix",
- FilterVerb: "filter",
- PrioritizeVerb: "prioritize",
- Weight: 1,
- BindVerb: "bind", // 1.10 was case-insensitive and tolerated "bindVerb"
- EnableHTTPS: true,
- TLSConfig: &schedulerapi.ExtenderTLSConfig{Insecure: true},
- HTTPTimeout: 1,
- NodeCacheCapable: true,
- ManagedResources: []schedulerapi.ExtenderManagedResource{{Name: v1.ResourceName("example.com/foo"), IgnoredByScheduler: true}},
- Ignorable: true,
- }},
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.11": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "PodToleratesNodeTaints"},
- {"name": "CheckNodeMemoryPressure"},
- {"name": "CheckNodeDiskPressure"},
- {"name": "CheckNodePIDPressure"},
- {"name": "CheckNodeCondition"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "MatchInterPodAffinity"},
- {"name": "GeneralPredicates"},
- {"name": "CheckVolumeBinding"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "NodePreferAvoidPodsPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "TaintTolerationPriority", "weight": 2},
- {"name": "InterPodAffinityPriority", "weight": 2},
- {"name": "MostRequestedPriority", "weight": 2},
- {
- "name": "RequestedToCapacityRatioPriority",
- "weight": 2,
- "argument": {
- "requestedToCapacityRatioArguments": {
- "shape": [
- {"utilization": 0, "score": 0},
- {"utilization": 50, "score": 7}
- ]
- }
- }}
- ],"extenders": [{
- "urlPrefix": "/prefix",
- "filterVerb": "filter",
- "prioritizeVerb": "prioritize",
- "weight": 1,
- "bindVerb": "bind",
- "enableHttps": true,
- "tlsConfig": {"Insecure":true},
- "httpTimeout": 1,
- "nodeCacheCapable": true,
- "managedResources": [{"name":"example.com/foo","ignoredByScheduler":true}],
- "ignorable":true
- }]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "PodToleratesNodeTaints"},
- {Name: "CheckNodeMemoryPressure"},
- {Name: "CheckNodeDiskPressure"},
- {Name: "CheckNodePIDPressure"},
- {Name: "CheckNodeCondition"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "MatchInterPodAffinity"},
- {Name: "GeneralPredicates"},
- {Name: "CheckVolumeBinding"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "NodePreferAvoidPodsPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "TaintTolerationPriority", Weight: 2},
- {Name: "InterPodAffinityPriority", Weight: 2},
- {Name: "MostRequestedPriority", Weight: 2},
- {
- Name: "RequestedToCapacityRatioPriority",
- Weight: 2,
- Argument: &schedulerapi.PriorityArgument{
- RequestedToCapacityRatioArguments: &schedulerapi.RequestedToCapacityRatioArguments{
- UtilizationShape: []schedulerapi.UtilizationShapePoint{
- {Utilization: 0, Score: 0},
- {Utilization: 50, Score: 7},
- }},
- },
- },
- },
- ExtenderConfigs: []schedulerapi.ExtenderConfig{{
- URLPrefix: "/prefix",
- FilterVerb: "filter",
- PrioritizeVerb: "prioritize",
- Weight: 1,
- BindVerb: "bind", // 1.11 restored case-sensitivity, but allowed either "BindVerb" or "bindVerb"
- EnableHTTPS: true,
- TLSConfig: &schedulerapi.ExtenderTLSConfig{Insecure: true},
- HTTPTimeout: 1,
- NodeCacheCapable: true,
- ManagedResources: []schedulerapi.ExtenderManagedResource{{Name: v1.ResourceName("example.com/foo"), IgnoredByScheduler: true}},
- Ignorable: true,
- }},
- },
- },
- // Do not change this JSON after the corresponding release has been tagged.
- // A failure indicates backwards compatibility with the specified release was broken.
- "1.12": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "PodToleratesNodeTaints"},
- {"name": "CheckNodeMemoryPressure"},
- {"name": "CheckNodeDiskPressure"},
- {"name": "CheckNodePIDPressure"},
- {"name": "CheckNodeCondition"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "MaxCSIVolumeCountPred"},
- {"name": "MatchInterPodAffinity"},
- {"name": "GeneralPredicates"},
- {"name": "CheckVolumeBinding"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "NodePreferAvoidPodsPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "TaintTolerationPriority", "weight": 2},
- {"name": "InterPodAffinityPriority", "weight": 2},
- {"name": "MostRequestedPriority", "weight": 2},
- {
- "name": "RequestedToCapacityRatioPriority",
- "weight": 2,
- "argument": {
- "requestedToCapacityRatioArguments": {
- "shape": [
- {"utilization": 0, "score": 0},
- {"utilization": 50, "score": 7}
- ]
- }
- }}
- ],"extenders": [{
- "urlPrefix": "/prefix",
- "filterVerb": "filter",
- "prioritizeVerb": "prioritize",
- "weight": 1,
- "bindVerb": "bind",
- "enableHttps": true,
- "tlsConfig": {"Insecure":true},
- "httpTimeout": 1,
- "nodeCacheCapable": true,
- "managedResources": [{"name":"example.com/foo","ignoredByScheduler":true}],
- "ignorable":true
- }]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "PodToleratesNodeTaints"},
- {Name: "CheckNodeMemoryPressure"},
- {Name: "CheckNodeDiskPressure"},
- {Name: "CheckNodePIDPressure"},
- {Name: "CheckNodeCondition"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "MaxCSIVolumeCountPred"},
- {Name: "MatchInterPodAffinity"},
- {Name: "GeneralPredicates"},
- {Name: "CheckVolumeBinding"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "NodePreferAvoidPodsPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "TaintTolerationPriority", Weight: 2},
- {Name: "InterPodAffinityPriority", Weight: 2},
- {Name: "MostRequestedPriority", Weight: 2},
- {
- Name: "RequestedToCapacityRatioPriority",
- Weight: 2,
- Argument: &schedulerapi.PriorityArgument{
- RequestedToCapacityRatioArguments: &schedulerapi.RequestedToCapacityRatioArguments{
- UtilizationShape: []schedulerapi.UtilizationShapePoint{
- {Utilization: 0, Score: 0},
- {Utilization: 50, Score: 7},
- }},
- },
- },
- },
- ExtenderConfigs: []schedulerapi.ExtenderConfig{{
- URLPrefix: "/prefix",
- FilterVerb: "filter",
- PrioritizeVerb: "prioritize",
- Weight: 1,
- BindVerb: "bind", // 1.11 restored case-sensitivity, but allowed either "BindVerb" or "bindVerb"
- EnableHTTPS: true,
- TLSConfig: &schedulerapi.ExtenderTLSConfig{Insecure: true},
- HTTPTimeout: 1,
- NodeCacheCapable: true,
- ManagedResources: []schedulerapi.ExtenderManagedResource{{Name: v1.ResourceName("example.com/foo"), IgnoredByScheduler: true}},
- Ignorable: true,
- }},
- },
- },
- "1.14": {
- JSON: `{
- "kind": "Policy",
- "apiVersion": "v1",
- "predicates": [
- {"name": "MatchNodeSelector"},
- {"name": "PodFitsResources"},
- {"name": "PodFitsHostPorts"},
- {"name": "HostName"},
- {"name": "NoDiskConflict"},
- {"name": "NoVolumeZoneConflict"},
- {"name": "PodToleratesNodeTaints"},
- {"name": "CheckNodeMemoryPressure"},
- {"name": "CheckNodeDiskPressure"},
- {"name": "CheckNodePIDPressure"},
- {"name": "CheckNodeCondition"},
- {"name": "MaxEBSVolumeCount"},
- {"name": "MaxGCEPDVolumeCount"},
- {"name": "MaxAzureDiskVolumeCount"},
- {"name": "MaxCSIVolumeCountPred"},
- {"name": "MaxCinderVolumeCount"},
- {"name": "MatchInterPodAffinity"},
- {"name": "GeneralPredicates"},
- {"name": "CheckVolumeBinding"},
- {"name": "TestServiceAffinity", "argument": {"serviceAffinity" : {"labels" : ["region"]}}},
- {"name": "TestLabelsPresence", "argument": {"labelsPresence" : {"labels" : ["foo"], "presence":true}}}
- ],"priorities": [
- {"name": "EqualPriority", "weight": 2},
- {"name": "ImageLocalityPriority", "weight": 2},
- {"name": "LeastRequestedPriority", "weight": 2},
- {"name": "BalancedResourceAllocation", "weight": 2},
- {"name": "SelectorSpreadPriority", "weight": 2},
- {"name": "NodePreferAvoidPodsPriority", "weight": 2},
- {"name": "NodeAffinityPriority", "weight": 2},
- {"name": "TaintTolerationPriority", "weight": 2},
- {"name": "InterPodAffinityPriority", "weight": 2},
- {"name": "MostRequestedPriority", "weight": 2},
- {
- "name": "RequestedToCapacityRatioPriority",
- "weight": 2,
- "argument": {
- "requestedToCapacityRatioArguments": {
- "shape": [
- {"utilization": 0, "score": 0},
- {"utilization": 50, "score": 7}
- ]
- }
- }}
- ],"extenders": [{
- "urlPrefix": "/prefix",
- "filterVerb": "filter",
- "prioritizeVerb": "prioritize",
- "weight": 1,
- "bindVerb": "bind",
- "enableHttps": true,
- "tlsConfig": {"Insecure":true},
- "httpTimeout": 1,
- "nodeCacheCapable": true,
- "managedResources": [{"name":"example.com/foo","ignoredByScheduler":true}],
- "ignorable":true
- }]
- }`,
- ExpectedPolicy: schedulerapi.Policy{
- Predicates: []schedulerapi.PredicatePolicy{
- {Name: "MatchNodeSelector"},
- {Name: "PodFitsResources"},
- {Name: "PodFitsHostPorts"},
- {Name: "HostName"},
- {Name: "NoDiskConflict"},
- {Name: "NoVolumeZoneConflict"},
- {Name: "PodToleratesNodeTaints"},
- {Name: "CheckNodeMemoryPressure"},
- {Name: "CheckNodeDiskPressure"},
- {Name: "CheckNodePIDPressure"},
- {Name: "CheckNodeCondition"},
- {Name: "MaxEBSVolumeCount"},
- {Name: "MaxGCEPDVolumeCount"},
- {Name: "MaxAzureDiskVolumeCount"},
- {Name: "MaxCSIVolumeCountPred"},
- {Name: "MaxCinderVolumeCount"},
- {Name: "MatchInterPodAffinity"},
- {Name: "GeneralPredicates"},
- {Name: "CheckVolumeBinding"},
- {Name: "TestServiceAffinity", Argument: &schedulerapi.PredicateArgument{ServiceAffinity: &schedulerapi.ServiceAffinity{Labels: []string{"region"}}}},
- {Name: "TestLabelsPresence", Argument: &schedulerapi.PredicateArgument{LabelsPresence: &schedulerapi.LabelsPresence{Labels: []string{"foo"}, Presence: true}}},
- },
- Priorities: []schedulerapi.PriorityPolicy{
- {Name: "EqualPriority", Weight: 2},
- {Name: "ImageLocalityPriority", Weight: 2},
- {Name: "LeastRequestedPriority", Weight: 2},
- {Name: "BalancedResourceAllocation", Weight: 2},
- {Name: "SelectorSpreadPriority", Weight: 2},
- {Name: "NodePreferAvoidPodsPriority", Weight: 2},
- {Name: "NodeAffinityPriority", Weight: 2},
- {Name: "TaintTolerationPriority", Weight: 2},
- {Name: "InterPodAffinityPriority", Weight: 2},
- {Name: "MostRequestedPriority", Weight: 2},
- {
- Name: "RequestedToCapacityRatioPriority",
- Weight: 2,
- Argument: &schedulerapi.PriorityArgument{
- RequestedToCapacityRatioArguments: &schedulerapi.RequestedToCapacityRatioArguments{
- UtilizationShape: []schedulerapi.UtilizationShapePoint{
- {Utilization: 0, Score: 0},
- {Utilization: 50, Score: 7},
- }},
- },
- },
- },
- ExtenderConfigs: []schedulerapi.ExtenderConfig{{
- URLPrefix: "/prefix",
- FilterVerb: "filter",
- PrioritizeVerb: "prioritize",
- Weight: 1,
- BindVerb: "bind", // 1.11 restored case-sensitivity, but allowed either "BindVerb" or "bindVerb"
- EnableHTTPS: true,
- TLSConfig: &schedulerapi.ExtenderTLSConfig{Insecure: true},
- HTTPTimeout: 1,
- NodeCacheCapable: true,
- ManagedResources: []schedulerapi.ExtenderManagedResource{{Name: v1.ResourceName("example.com/foo"), IgnoredByScheduler: true}},
- Ignorable: true,
- }},
- },
- },
- }
- registeredPredicates := sets.NewString(factory.ListRegisteredFitPredicates()...)
- registeredPriorities := sets.NewString(factory.ListRegisteredPriorityFunctions()...)
- seenPredicates := sets.NewString()
- seenPriorities := sets.NewString()
- for v, tc := range schedulerFiles {
- fmt.Printf("%s: Testing scheduler config\n", v)
- policy := schedulerapi.Policy{}
- if err := runtime.DecodeInto(latestschedulerapi.Codec, []byte(tc.JSON), &policy); err != nil {
- t.Errorf("%s: Error decoding: %v", v, err)
- continue
- }
- for _, predicate := range policy.Predicates {
- seenPredicates.Insert(predicate.Name)
- }
- for _, priority := range policy.Priorities {
- seenPriorities.Insert(priority.Name)
- }
- if !reflect.DeepEqual(policy, tc.ExpectedPolicy) {
- t.Errorf("%s: Expected:\n\t%#v\nGot:\n\t%#v", v, tc.ExpectedPolicy, policy)
- }
- handler := utiltesting.FakeHandler{
- StatusCode: 500,
- ResponseBody: "",
- T: t,
- }
- server := httptest.NewServer(&handler)
- defer server.Close()
- client := clientset.NewForConfigOrDie(&restclient.Config{Host: server.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
- informerFactory := informers.NewSharedInformerFactory(client, 0)
- if _, err := factory.NewConfigFactory(&factory.ConfigFactoryArgs{
- SchedulerName: "some-scheduler-name",
- Client: client,
- NodeInformer: informerFactory.Core().V1().Nodes(),
- PodInformer: informerFactory.Core().V1().Pods(),
- PvInformer: informerFactory.Core().V1().PersistentVolumes(),
- PvcInformer: informerFactory.Core().V1().PersistentVolumeClaims(),
- ReplicationControllerInformer: informerFactory.Core().V1().ReplicationControllers(),
- ReplicaSetInformer: informerFactory.Apps().V1().ReplicaSets(),
- StatefulSetInformer: informerFactory.Apps().V1().StatefulSets(),
- ServiceInformer: informerFactory.Core().V1().Services(),
- PdbInformer: informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
- StorageClassInformer: informerFactory.Storage().V1().StorageClasses(),
- HardPodAffinitySymmetricWeight: v1.DefaultHardPodAffinitySymmetricWeight,
- DisablePreemption: false,
- PercentageOfNodesToScore: schedulerapi.DefaultPercentageOfNodesToScore,
- }).CreateFromConfig(policy); err != nil {
- t.Errorf("%s: Error constructing: %v", v, err)
- continue
- }
- }
- if !seenPredicates.HasAll(registeredPredicates.List()...) {
- t.Errorf("Registered predicates are missing from compatibility test (add to test stanza for version currently in development): %#v", registeredPredicates.Difference(seenPredicates).List())
- }
- if !seenPriorities.HasAll(registeredPriorities.List()...) {
- t.Errorf("Registered priorities are missing from compatibility test (add to test stanza for version currently in development): %#v", registeredPriorities.Difference(seenPriorities).List())
- }
- }
|