mirror of https://github.com/kubernetes/kops.git
				
				
				
			Increase timeout for IAM instance propagation
From 1 minute -> 5 minutes Should help with issue #591
This commit is contained in:
		
							parent
							
								
									fd8cf63b02
								
							
						
					
					
						commit
						dfb2a40dd5
					
				|  | @ -30,6 +30,9 @@ import ( | |||
| 	"time" | ||||
| ) | ||||
| 
 | ||||
| const IAMPropagationRetryAttempts = 30 | ||||
| const IAMPropagationRetryInterval = 10 * time.Second | ||||
| 
 | ||||
| //go:generate fitask -type=LaunchConfiguration
 | ||||
| type LaunchConfiguration struct { | ||||
| 	Name *string | ||||
|  | @ -272,7 +275,6 @@ func (_ *LaunchConfiguration) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *La | |||
| 		request.IamInstanceProfile = e.IAMInstanceProfile.Name | ||||
| 	} | ||||
| 
 | ||||
| 	maxAttempts := 6 | ||||
| 	attempt := 0 | ||||
| 	for { | ||||
| 		attempt++ | ||||
|  | @ -285,13 +287,13 @@ func (_ *LaunchConfiguration) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *La | |||
| 		if awsup.AWSErrorCode(err) == "ValidationError" { | ||||
| 			message := awsup.AWSErrorMessage(err) | ||||
| 			if strings.Contains(message, "not authorized") || strings.Contains(message, "Invalid IamInstance") { | ||||
| 				if attempt == maxAttempts { | ||||
| 				if attempt == IAMPropagationRetryAttempts { | ||||
| 					// IAM instance profile creation is notoriously async
 | ||||
| 					return fmt.Errorf("IAM instance profile not yet created/propagated") | ||||
| 				} else { | ||||
| 					glog.Infof("Waiting for IAM to replicate") | ||||
| 					glog.V(2).Infof("IAM error was %v", err) | ||||
| 					time.Sleep(10 * time.Second) | ||||
| 					time.Sleep(IAMPropagationRetryInterval) | ||||
| 					continue | ||||
| 				} | ||||
| 			} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue