Skip to content

Conversation

@PoeppingT
Copy link
Contributor

This commit adds the Tenant service delete function to the private api
for use by the installer and improves the installer delete functionality
for deleting ECR images from all service repositories, properly deleting
tenants (and only active tenants), and deleting Active Directory
resources when created.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@PoeppingT PoeppingT requested a review from brtrvn August 19, 2022 00:12
@PoeppingT PoeppingT force-pushed the installer-delete-fix branch from 5083172 to e2e1006 Compare August 22, 2022 16:28
This commit adds the Tenant service delete function to the private api
for use by the installer and improves the installer delete functionality
for deleting ECR images from all service repositories, properly deleting
tenants (and only active tenants), and deleting Active Directory
resources when created.
@brtrvn brtrvn force-pushed the installer-delete-fix branch from e2e1006 to d429f92 Compare August 22, 2022 19:19
}
}
default: {
outputMessage("Unexpected stackStatus " + stackStatus + " while waiting for " + tenantStackId + " to finish deleting.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Not exactly unexpected since the application services stacks must finish deleting before the base stack for the tenant will start deleting.
We should probably have some sort of maximum wait timeout.

outputMessage("Deleting AWS SaaS Boost stack: " + this.stackName);
deleteCloudFormationStack(this.stackName);

// Delete the ActiveDirectory Password in SSM if it exists
Copy link
Contributor

Choose a reason for hiding this comment

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

We should just delete any parameter under /saas-boost/${ENVIRONMENT}/*

.values("/saas-boost/" + this.envName + "/")
.build()))
.parameters().stream().map(meta -> meta.name()).collect(Collectors.toList());
ssm.deleteParameters(request -> request.names(parameterNamesToDelete));
Copy link
Contributor

Choose a reason for hiding this comment

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

Remember that SSM will only let you delete 10 parameters in a single call, so you may have to batch this.

LOGGER.debug("Deleting active tenant", tenant);
deleteProvisionedTenant(tenant);
} else {
LOGGER.debug("Not deleting inactive tenant: ", tenant);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should call delete for all tenants regardless of their active status. If a tenant as been "disabled" by an admin, their infrastructure is still provisioned and we need to clean it up before we can delete the rest of the environment.

LOGGER.debug("got response back: {}", response);
// wait for tenant to reach deleted
final String DELETED = "deleted";
LocalDateTime timeout = LocalDateTime.now().plus(30, ChronoUnit.MINUTES);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make this timeout be 60 minutes -- remember we're waiting for CloudFormation to delete multiple stacks and potentially are dealing with RDS instances and FSx file systems which can take a very long time to delete.

Copy link
Contributor

@brtrvn brtrvn left a comment

Choose a reason for hiding this comment

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

For completeness with the new updates to include the Util helper functions, we should update the API calls.

Copy link
Contributor

@brtrvn brtrvn left a comment

Choose a reason for hiding this comment

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

Looks good

@brtrvn brtrvn merged commit f6473b4 into awslabs:main Aug 29, 2022
@PoeppingT PoeppingT deleted the installer-delete-fix branch August 29, 2022 23:00
@brtrvn brtrvn mentioned this pull request Sep 29, 2022
1 task
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