-
Notifications
You must be signed in to change notification settings - Fork 675
Update cluster-api release-0.1 vendor #750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| apiVersion: "cluster.k8s.io/v1alpha1" | ||
| kind: MachineDeployment | ||
| metadata: | ||
| name: sample-machinedeployment | ||
| labels: | ||
| cluster.k8s.io/cluster-name: ${CLUSTER_NAME} | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| cluster.k8s.io/cluster-name: ${CLUSTER_NAME} | ||
| set: node | ||
| template: | ||
| metadata: | ||
| labels: | ||
| cluster.k8s.io/cluster-name: ${CLUSTER_NAME} | ||
| set: node | ||
| spec: | ||
| versions: | ||
| kubelet: v1.13.5 | ||
| providerSpec: | ||
| value: | ||
| apiVersion: awsprovider/v1alpha1 | ||
| kind: AWSMachineProviderSpec | ||
| instanceType: "${NODE_MACHINE_TYPE}" | ||
| iamInstanceProfile: "nodes.cluster-api-provider-aws.sigs.k8s.io" | ||
| keyName: "${SSH_KEY_NAME}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,8 +19,10 @@ package ec2 | |
| import ( | ||
| "bytes" | ||
| "compress/gzip" | ||
| "context" | ||
| "encoding/base64" | ||
| "strings" | ||
| "time" | ||
|
|
||
| "github.com/aws/aws-sdk-go/aws" | ||
| "github.com/aws/aws-sdk-go/aws/request" | ||
|
|
@@ -437,13 +439,20 @@ func (s *Service) runInstance(role string, i *v1alpha1.Instance) (*v1alpha1.Inst | |
| return nil, errors.Errorf("no instance returned for reservation %v", out.GoString()) | ||
| } | ||
|
|
||
| s.scope.V(2).Info("Waiting for instance to run", "instance-id", *out.Instances[0].InstanceId) | ||
| err = s.scope.EC2.WaitUntilInstanceRunningWithContext( | ||
| aws.BackgroundContext(), | ||
| waitTimeout := 1 * time.Minute | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this timeout be longer than 1 minute?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have seen that when this function actually works, 1m is more than enough to get the signal back. I'm also open to completely remove this function given that we can rely on reconciliation to take care of it
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to be careful not to make assumptions related to the Regions/Zones we are frequently testing in. From my experience not all AWS Regions are as responsive as us-east-* and us-west-* |
||
| s.scope.V(2).Info("Waiting for instance to be in running state", "instance-id", *out.Instances[0].InstanceId, "timeout", waitTimeout.String()) | ||
| ctx, cancel := context.WithTimeout(aws.BackgroundContext(), waitTimeout) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any particular reason to use aws.BackgroundContext() here? It looks like it just returns context.Background().
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mostly because it's there, I can switch if necessary :D |
||
| defer cancel() | ||
|
|
||
| if err := s.scope.EC2.WaitUntilInstanceRunningWithContext( | ||
| ctx, | ||
| &ec2.DescribeInstancesInput{InstanceIds: []*string{out.Instances[0].InstanceId}}, | ||
| request.WithWaiterLogger(&awslog{s.scope.Logger}), | ||
| ) | ||
| return converters.SDKToInstance(out.Instances[0]), err | ||
| ); err != nil { | ||
| s.scope.V(2).Info("Could not determine if Machine is running. Machine state might be unavailable until next renconciliation.") | ||
| } | ||
|
|
||
| return converters.SDKToInstance(out.Instances[0]), nil | ||
| } | ||
|
|
||
| // An internal type to satisfy aws' log interface. | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could drop the max retries and delay time using the WaiterOptions instead of a timeout context, but overall lowering the time `WaitUntilInstance I think this is probably a good thing to do so we don't get stuck waiting for 10 minutes ever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't
WaiterOptionsapplied across every aws sdk call though? I mentioned above I'm open to actually remove this call entirely, we can rely on reconciliation to go and describe the state in a later reconciliationThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc, we originally added this because we had hit issues with returning without waiting previously. I want to say it might have been related to how we check for instance availability during
Exists.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that has been fixed by adding the "pending" checks to Exists https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/master/pkg/cloud/aws/services/ec2/instances.go#L51
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't apply across every sdk call, only for the waiter that gets created with the call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, I was looking at something else