Skip to content

Commit

Permalink
Merge pull request #5868 from dineshba/remove-unused-func-scaleFromZe…
Browse files Browse the repository at this point in the history
…roAnnotationsEnabled

chore: remove unused func scaleFromZeroAnnotationsEnabled
  • Loading branch information
k8s-ci-robot authored Jun 26, 2023
2 parents c51dc16 + 1107280 commit 0733535
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
10 changes: 0 additions & 10 deletions cluster-autoscaler/cloudprovider/clusterapi/clusterapi_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,6 @@ func normalizedProviderString(s string) normalizedProviderID {
return normalizedProviderID(split[len(split)-1])
}

func scaleFromZeroAnnotationsEnabled(annotations map[string]string) bool {
cpu := annotations[cpuKey]
mem := annotations[memoryKey]

if cpu != "" && mem != "" {
return true
}
return false
}

func parseKey(annotations map[string]string, key string) (resource.Quantity, error) {
if val, exists := annotations[key]; exists && val != "" {
return resource.ParseQuantity(val)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,47 +430,6 @@ func TestUtilNormalizedProviderID(t *testing.T) {
}
}

func TestScaleFromZeroEnabled(t *testing.T) {
for _, tc := range []struct {
description string
enabled bool
annotations map[string]string
}{{
description: "nil annotations",
enabled: false,
}, {
description: "empty annotations",
annotations: map[string]string{},
enabled: false,
}, {
description: "non-matching annotation",
annotations: map[string]string{"foo": "bar"},
enabled: false,
}, {
description: "matching key, incomplete annotations",
annotations: map[string]string{
"foo": "bar",
cpuKey: "1",
},
enabled: false,
}, {
description: "matching key, complete annotations",
annotations: map[string]string{
"foo": "bar",
cpuKey: "1",
memoryKey: "2Mi",
},
enabled: true,
}} {
t.Run(tc.description, func(t *testing.T) {
got := scaleFromZeroAnnotationsEnabled(tc.annotations)
if tc.enabled != got {
t.Errorf("expected %t, got %t", tc.enabled, got)
}
})
}
}

func TestParseCPUCapacity(t *testing.T) {
for _, tc := range []struct {
description string
Expand Down

0 comments on commit 0733535

Please sign in to comment.