Skip to content
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

awscloud/secure-instance: fix cleaning up fleets with creation errors #4489

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

croissanne
Copy link
Member

@croissanne croissanne commented Nov 22, 2024

By surfacing the output even in case of an error, the fleet ID and
instance ID can be extracted if present. Thus the instance can be
terminated before its dependencies are deleted.


We're seeing some behaviour where create fleet is not retried and subsequently the SI cleanup fails due to the security group already being tied to an existing instance. There is no error that an instance was launched anyway.

We're seeing some behaviour where create fleet is not retried and
subsequently the SI cleanup fails due to the security group already
being tied to an existing instance. There is no error that an instance
was launched anyway.
@croissanne croissanne marked this pull request as draft November 22, 2024 14:56
@croissanne croissanne removed the request for review from schuellerf November 22, 2024 14:56
By surfacing the output even in case of an error, the fleet ID and
instance ID can be extracted if present. Thus the instance can be
terminated before its dependencies are deleted.
@croissanne croissanne marked this pull request as ready for review November 22, 2024 15:16
@croissanne croissanne changed the title awscloud/secure-instance: log error code comparisons awscloud/secure-instance: fix cleaning up fleets with creation errors Nov 22, 2024
Copy link
Contributor

@schuellerf schuellerf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just minor things

if len(createFleetOutput.Instances) > 0 && len(createFleetOutput.Instances[0].InstanceIds) > 0 {
secureInstance.InstanceID = createFleetOutput.Instances[0].InstanceIds[0]
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could as well move this block before the if err != nil { and comment that we need this info regardless of err or not and remove the code duplication below, right?
but I'm fine with this, too

@@ -639,6 +650,7 @@ func doCreateFleetRetry(cfOutput *ec2.CreateFleetOutput) (bool, []string) {
msg := []string{}
retry := false
for _, err := range cfOutput.Errors {
logrus.Infof("Comparing create fleet error %s (msg: %s)", *err.ErrorCode, *err.ErrorMessage)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe more descriptive why we compare?

Suggested change
logrus.Infof("Comparing create fleet error %s (msg: %s)", *err.ErrorCode, *err.ErrorMessage)
logrus.Infof("Checking to retry fleet create on error %s (msg: %s)", *err.ErrorCode, *err.ErrorMessage)

@croissanne croissanne marked this pull request as draft November 22, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants