Skip to content

Commit

Permalink
Fix timeSinceToBeDeletedTaintAdded
Browse files Browse the repository at this point in the history
  • Loading branch information
dippynark committed Dec 20, 2024
1 parent f901691 commit d4c87c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/cloudprovider/gcp/cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func timeSinceToBeDeletedTaintAdded(node *corev1.Node, now time.Time) time.Durat
// Retrieve taint value
toBeDeletedTaintAddedValue := ""
for _, taint := range node.Spec.Taints {
if taint.Key == kubernetes.ToBeDeletedTaint && taint.Value == "ToBeDeletedByClusterAutoscaler" {
if taint.Key == kubernetes.ToBeDeletedTaint && taint.Effect == corev1.TaintEffectNoSchedule {
toBeDeletedTaintAddedValue = taint.Value
break
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/cloudprovider/gcp/cloud_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ func TestTimeSinceToBeDeletedTaintAdded(t *testing.T) {
},
},
},
now: time.Date(0, 0, 0, 0, 0, 60, 0, time.UTC),
timeSinceToBeDeletedTaintAdded: 60 * time.Second,
now: time.Date(0, 0, 0, 0, 1, 0, 0, time.UTC),
timeSinceToBeDeletedTaintAdded: time.Minute,
},
"futureTaint": {
node: &corev1.Node{
Spec: corev1.NodeSpec{
Taints: []corev1.Taint{
{
Key: "ToBeDeletedByClusterAutoscaler",
Value: fmt.Sprint(time.Date(0, 0, 0, 0, 0, 60, 0, time.UTC).Unix()),
Value: fmt.Sprint(time.Date(0, 0, 0, 0, 1, 0, 0, time.UTC).Unix()),
Effect: corev1.TaintEffectNoSchedule,
},
},
Expand Down

0 comments on commit d4c87c8

Please sign in to comment.