@@ -423,7 +423,7 @@ func TestTooManyUnready(t *testing.T) {
423423 clusterstate := NewClusterStateRegistry (provider , ClusterStateRegistryConfig {
424424 MaxTotalUnreadyPercentage : 10 ,
425425 OkTotalUnreadyCount : 1 ,
426- }, fakeLogRecorder , newBackoff (), nodegroupconfig .NewDefaultNodeGroupConfigProcessor (config.NodeGroupAutoscalingOptions {MaxNodeProvisionTime : 15 * time .Minute }), asyncnodegroups .NewDefaultAsyncNodeGroupStateChecker ())
426+ }, fakeLogRecorder , newBackoff (), nodegroupconfig .NewDefaultNodeGroupConfigProcessor (config.NodeGroupAutoscalingOptions {MaxNodeProvisionTime : 15 * time .Minute , MaxNodeStartupTime : 35 * time . Minute }), asyncnodegroups .NewDefaultAsyncNodeGroupStateChecker ())
427427 err := clusterstate .UpdateNodes ([]* apiv1.Node {ng1_1 , ng2_1 }, nil , now )
428428 assert .NoError (t , err )
429429 assert .False (t , clusterstate .IsClusterHealthy ())
@@ -462,6 +462,37 @@ func TestUnreadyLongAfterCreation(t *testing.T) {
462462 assert .Empty (t , upcomingRegistered ["ng1" ])
463463}
464464
465+ func TestUnreadyAfterCreationWithIncreasedStartupTime (t * testing.T ) {
466+ now := time .Now ()
467+
468+ ng1_1 := BuildTestNode ("ng1-1" , 1000 , 1000 )
469+ SetNodeReadyState (ng1_1 , true , now .Add (- time .Minute ))
470+ ng2_1 := BuildTestNode ("ng2-1" , 1000 , 1000 )
471+ SetNodeReadyState (ng2_1 , false , now .Add (- time .Minute ))
472+ ng2_1 .CreationTimestamp = metav1.Time {Time : now .Add (- 30 * time .Minute )}
473+
474+ provider := testprovider .NewTestCloudProviderBuilder ().Build ()
475+ provider .AddNodeGroup ("ng1" , 1 , 10 , 1 )
476+ provider .AddNodeGroup ("ng2" , 1 , 10 , 1 )
477+ provider .AddNode ("ng1" , ng1_1 )
478+ provider .AddNode ("ng2" , ng2_1 )
479+
480+ assert .NotNil (t , provider )
481+ fakeClient := & fake.Clientset {}
482+ fakeLogRecorder , _ := utils .NewStatusMapRecorder (fakeClient , "kube-system" , kube_record .NewFakeRecorder (5 ), false , "some-map" )
483+ clusterstate := NewClusterStateRegistry (provider , ClusterStateRegistryConfig {
484+ MaxTotalUnreadyPercentage : 10 ,
485+ OkTotalUnreadyCount : 1 ,
486+ }, fakeLogRecorder , newBackoff (), nodegroupconfig .NewDefaultNodeGroupConfigProcessor (config.NodeGroupAutoscalingOptions {MaxNodeProvisionTime : 15 * time .Minute , MaxNodeStartupTime : 35 * time .Minute }), asyncnodegroups .NewDefaultAsyncNodeGroupStateChecker ())
487+ err := clusterstate .UpdateNodes ([]* apiv1.Node {ng1_1 , ng2_1 }, nil , now )
488+ assert .NoError (t , err )
489+ assert .Equal (t , 0 , len (clusterstate .GetClusterReadiness ().Unready ))
490+ assert .Equal (t , 1 , len (clusterstate .GetClusterReadiness ().NotStarted ))
491+ upcoming , upcomingRegistered := clusterstate .GetUpcomingNodes ()
492+ assert .Equal (t , 0 , upcoming ["ng1" ])
493+ assert .Empty (t , upcomingRegistered ["ng1" ])
494+ }
495+
465496func TestNotStarted (t * testing.T ) {
466497 now := time .Now ()
467498
@@ -484,7 +515,7 @@ func TestNotStarted(t *testing.T) {
484515 clusterstate := NewClusterStateRegistry (provider , ClusterStateRegistryConfig {
485516 MaxTotalUnreadyPercentage : 10 ,
486517 OkTotalUnreadyCount : 1 ,
487- }, fakeLogRecorder , newBackoff (), nodegroupconfig .NewDefaultNodeGroupConfigProcessor (config.NodeGroupAutoscalingOptions {MaxNodeProvisionTime : 15 * time .Minute }), asyncnodegroups .NewDefaultAsyncNodeGroupStateChecker ())
518+ }, fakeLogRecorder , newBackoff (), nodegroupconfig .NewDefaultNodeGroupConfigProcessor (config.NodeGroupAutoscalingOptions {MaxNodeProvisionTime : 15 * time .Minute , MaxNodeStartupTime : 35 * time . Minute }), asyncnodegroups .NewDefaultAsyncNodeGroupStateChecker ())
488519 err := clusterstate .UpdateNodes ([]* apiv1.Node {ng1_1 , ng2_1 }, nil , now )
489520 assert .NoError (t , err )
490521 assert .Equal (t , 1 , len (clusterstate .GetClusterReadiness ().NotStarted ))
@@ -546,7 +577,7 @@ func TestRegisterScaleDown(t *testing.T) {
546577 clusterstate := NewClusterStateRegistry (provider , ClusterStateRegistryConfig {
547578 MaxTotalUnreadyPercentage : 10 ,
548579 OkTotalUnreadyCount : 1 ,
549- }, fakeLogRecorder , newBackoff (), nodegroupconfig .NewDefaultNodeGroupConfigProcessor (config.NodeGroupAutoscalingOptions {MaxNodeProvisionTime : 15 * time .Minute }), asyncnodegroups .NewDefaultAsyncNodeGroupStateChecker ())
580+ }, fakeLogRecorder , newBackoff (), nodegroupconfig .NewDefaultNodeGroupConfigProcessor (config.NodeGroupAutoscalingOptions {MaxNodeProvisionTime : 15 * time .Minute , MaxNodeStartupTime : 35 * time . Minute }), asyncnodegroups .NewDefaultAsyncNodeGroupStateChecker ())
550581 now := time .Now ()
551582 clusterstate .RegisterScaleDown (provider .GetNodeGroup ("ng1" ), "ng1-1" , now .Add (time .Minute ), now )
552583 assert .Equal (t , 1 , len (clusterstate .scaleDownRequests ))
@@ -639,7 +670,7 @@ func TestUpcomingNodes(t *testing.T) {
639670 clusterstate := NewClusterStateRegistry (provider , ClusterStateRegistryConfig {
640671 MaxTotalUnreadyPercentage : 10 ,
641672 OkTotalUnreadyCount : 1 ,
642- }, fakeLogRecorder , newBackoff (), nodegroupconfig .NewDefaultNodeGroupConfigProcessor (config.NodeGroupAutoscalingOptions {MaxNodeProvisionTime : 15 * time .Minute }), asyncnodegroups .NewDefaultAsyncNodeGroupStateChecker ())
673+ }, fakeLogRecorder , newBackoff (), nodegroupconfig .NewDefaultNodeGroupConfigProcessor (config.NodeGroupAutoscalingOptions {MaxNodeProvisionTime : 15 * time .Minute , MaxNodeStartupTime : 15 * time . Minute }), asyncnodegroups .NewDefaultAsyncNodeGroupStateChecker ())
643674 err := clusterstate .UpdateNodes ([]* apiv1.Node {ng1_1 , ng2_1 , ng3_1 , ng4_1 , ng5_1 , ng5_2 }, nil , now )
644675 assert .NoError (t , err )
645676 assert .Empty (t , clusterstate .GetScaleUpFailures ())
0 commit comments