Merge pull request #34548 from kargakis/estimate-available-from-rs
Automatic merge from submit-queue controller: set minReadySeconds in deployment's replica sets * Estimate available pods for a deployment by using minReadySeconds on the replica set. * Stop requeueing deployments on pod events, superseded by following the replica set status. * Cleanup redundant deployment utilities Fixes https://github.com/kubernetes/kubernetes/issues/26079 @kubernetes/deployment ptal
This commit is contained in:
@@ -98,40 +98,6 @@ func newPod(now time.Time, ready bool, beforeSec int) api.Pod {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCountAvailablePods(t *testing.T) {
|
||||
now := time.Now()
|
||||
tests := []struct {
|
||||
pods []api.Pod
|
||||
minReadySeconds int
|
||||
expected int
|
||||
}{
|
||||
{
|
||||
[]api.Pod{
|
||||
newPod(now, true, 0),
|
||||
newPod(now, true, 2),
|
||||
newPod(now, false, 1),
|
||||
},
|
||||
1,
|
||||
1,
|
||||
},
|
||||
{
|
||||
[]api.Pod{
|
||||
newPod(now, true, 2),
|
||||
newPod(now, true, 11),
|
||||
newPod(now, true, 5),
|
||||
},
|
||||
10,
|
||||
1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
if count := countAvailablePods(test.pods, int32(test.minReadySeconds)); int(count) != test.expected {
|
||||
t.Errorf("Pods = %#v, minReadySeconds = %d, expected %d, got %d", test.pods, test.minReadySeconds, test.expected, count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// generatePodFromRS creates a pod, with the input ReplicaSet's selector and its template
|
||||
func generatePodFromRS(rs extensions.ReplicaSet) api.Pod {
|
||||
return api.Pod{
|
||||
|
Reference in New Issue
Block a user