practo/k8s-worker-pod-autoscaler

min=0, max=0 should not lead to scale up of deployments

alok87 opened this issue · 1 comments

WPA should not scale deployments if max and min both are 0. It was found the worker deployment to still scale to one with this setting when the queue received job.

This case is required mostly when you want to debug a deployment.

Could not reproduce with

// TestMin0Max0
// when min is zero and max is zero, scale up should not happen
// even when messages come in the queue
// #133
func TestMin0Max0(t *testing.T) {
	c := desiredWorkerTester{
		queueName:               "q",
		queueMessages:           5,            // queued jobs=0, in process=0
		messagesSentPerMinute:   float64(120), // rpm averaged over 10mins
		secondsToProcessOneJob:  float64(0),   // not set
		targetMessagesPerWorker: 60,
		currentWorkers:          0,
		idleWorkers:             0,
		minWorkers:              0,
		maxWorkers:              0,
		maxDisruption:           "100%",
	}

	c.test(t, 0)
}