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

feat: terminate watch mode when all resources complete #15

Merged
merged 4 commits into from
Jul 7, 2020

Conversation

darahayes
Copy link
Contributor

aka "and now my watch has ended" ;)

Verification Steps

  • Use CRO to create some resources in AWS. Particularly a type that takes some time to delete (such as a postgres or an elasticache instance)
  • run the CLI tool using ./cluster-service cleanup <cluster-id> --dry-run=false --watch

Verify that:

  • The cli tool prints a new report table every 30 seconds.
  • The process ends once all the resources are reported as deleted

@aidenkeating
Copy link
Contributor

Verifying against rhmi-clouds-byoc

for {
newReport, err := clusterService.DeleteResourcesForCluster(clusterId, map[string]string{}, dryRun)
if watch {
err := wait.PollImmediate(30*time.Second, 20*time.Minute, func() (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we test this against a full RHMI install? Is 20 minutes a safe enough timeout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good point. I used 20 minutes because it was the number mentioned in the original JIRA. I'll attempt it against a full cluster.

err := wait.PollImmediate(30*time.Second, watchTimeout, func() (bool, error) {
var currentReport *clusterservice.Report
newReport := runCleanupCommand(clusterService, clusterId, dryRun)
if currentReport == nil {
Copy link

Choose a reason for hiding this comment

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

Will currentReport not always be nil? Or is it being set somewhere else?

Copy link

Choose a reason for hiding this comment

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

Oh it's set the next loop around.. Nevermind :)

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.

3 participants