diff --git a/cluster-autoscaler/Makefile b/cluster-autoscaler/Makefile index dd099058f31c..7524cc192010 100644 --- a/cluster-autoscaler/Makefile +++ b/cluster-autoscaler/Makefile @@ -9,6 +9,7 @@ GOOS?=linux GOARCH?=$(shell go env GOARCH) REGISTRY?=staging-k8s.gcr.io DOCKER_NETWORK?=default +LEADER_ELECT?=false ifdef BUILD_TAGS TAGS_FLAG=--tags ${BUILD_TAGS} PROVIDER=-${BUILD_TAGS} diff --git a/cluster-autoscaler/expander/priority/priority.go b/cluster-autoscaler/expander/priority/priority.go index 64456db86c8f..25a32fff9c5b 100644 --- a/cluster-autoscaler/expander/priority/priority.go +++ b/cluster-autoscaler/expander/priority/priority.go @@ -61,7 +61,10 @@ func NewFilter(configMapLister v1lister.ConfigMapNamespaceLister, func (p *priority) reloadConfigMap() (priorities, *apiv1.ConfigMap, error) { cm, err := p.configMapLister.Get(PriorityConfigMapName) if err != nil { - return nil, nil, fmt.Errorf("Priority expander config map %s not found: %v", PriorityConfigMapName, err) + // FORK-CHANGE: logged warning to simplify debugging. + msg := fmt.Sprintf("Priority expander config map %q not found: %v", PriorityConfigMapName, err) + klog.Warning(msg) + return nil, nil, errors.New(msg) } prioString, found := cm.Data[ConfigMapKey] @@ -123,7 +126,7 @@ func (p *priority) BestOptions(expansionOptions []expander.Option, nodeInfo map[ priorities, cm, err := p.reloadConfigMap() if err != nil { - return nil + return expansionOptions } maxPrio := -1 diff --git a/cluster-autoscaler/expander/priority/priority_test.go b/cluster-autoscaler/expander/priority/priority_test.go index c4cbf2dad71b..35515a16b1e4 100644 --- a/cluster-autoscaler/expander/priority/priority_test.go +++ b/cluster-autoscaler/expander/priority/priority_test.go @@ -87,7 +87,7 @@ var ( } ) -func getFilterInstance(t *testing.T, config string) (expander.Filter, *record.FakeRecorder, *apiv1.ConfigMap, error) { +func getFilterInstance(t *testing.T, config string) (expander.Filter, *record.FakeRecorder, *apiv1.ConfigMap) { cm := &apiv1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Namespace: testNamespace, @@ -101,41 +101,41 @@ func getFilterInstance(t *testing.T, config string) (expander.Filter, *record.Fa assert.Nil(t, err) r := record.NewFakeRecorder(100) s := NewFilter(lister.ConfigMaps(testNamespace), r) - return s, r, cm, err + return s, r, cm } func TestPriorityExpanderCorrecltyFiltersSingleMatchingOptionOutOfOne(t *testing.T) { - s, _, _, _ := getFilterInstance(t, config) + s, _, _ := getFilterInstance(t, config) ret := s.BestOptions([]expander.Option{eoT2Large}, nil) assert.Equal(t, ret, []expander.Option{eoT2Large}) } func TestPriorityExpanderCorrecltyFiltersSingleMatchingOptionOutOfMany(t *testing.T) { - s, _, _, _ := getFilterInstance(t, config) + s, _, _ := getFilterInstance(t, config) ret := s.BestOptions([]expander.Option{eoT2Large, eoM44XLarge}, nil) assert.Equal(t, ret, []expander.Option{eoM44XLarge}) } func TestPriorityExpanderFiltersToHigherPriorityMatch(t *testing.T) { - s, _, _, _ := getFilterInstance(t, wildcardMatchConfig) + s, _, _ := getFilterInstance(t, wildcardMatchConfig) ret := s.BestOptions([]expander.Option{eoT2Large, eoT2Micro}, nil) assert.Equal(t, ret, []expander.Option{eoT2Large}) } func TestPriorityExpanderCorrecltyFiltersTwoMatchingOptionsOutOfMany(t *testing.T) { - s, _, _, _ := getFilterInstance(t, config) + s, _, _ := getFilterInstance(t, config) ret := s.BestOptions([]expander.Option{eoT2Large, eoT3Large, eoT2Micro}, nil) assert.Equal(t, ret, []expander.Option{eoT2Large, eoT3Large}) } func TestPriorityExpanderCorrecltyFallsBackToAllWhenNoMatches(t *testing.T) { - s, _, _, _ := getFilterInstance(t, config) + s, _, _ := getFilterInstance(t, config) ret := s.BestOptions([]expander.Option{eoT2Large, eoT3Large}, nil) assert.Equal(t, ret, []expander.Option{eoT2Large, eoT3Large}) } func TestPriorityExpanderCorrecltyHandlesConfigUpdate(t *testing.T) { - s, r, cm, _ := getFilterInstance(t, oneEntryConfig) + s, r, cm := getFilterInstance(t, oneEntryConfig) ret := s.BestOptions([]expander.Option{eoT2Large, eoT3Large, eoM44XLarge}, nil) assert.Equal(t, ret, []expander.Option{eoT2Large}) @@ -154,7 +154,7 @@ func TestPriorityExpanderCorrecltyHandlesConfigUpdate(t *testing.T) { } func TestPriorityExpanderCorrecltySkipsBadChangeConfig(t *testing.T) { - s, r, cm, _ := getFilterInstance(t, oneEntryConfig) + s, r, cm := getFilterInstance(t, oneEntryConfig) priority := s.(*priority) assert.Equal(t, 0, priority.okConfigUpdates) @@ -165,5 +165,5 @@ func TestPriorityExpanderCorrecltySkipsBadChangeConfig(t *testing.T) { event := <-r.Events assert.EqualValues(t, configWarnConfigMapEmpty, event) - assert.Empty(t, ret) + assert.Equal(t, ret, []expander.Option{eoT2Large, eoT3Large, eoM44XLarge}) }