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(status): add waiting status #1730

Merged
merged 2 commits into from Jan 11, 2021
Merged

feat(status): add waiting status #1730

merged 2 commits into from Jan 11, 2021

Conversation

emjburns
Copy link
Contributor

@emjburns emjburns commented Jan 8, 2021

Back end for spinnaker/deck#8836

Introducing a new status called "waiting" for when a resource was created and then has an resource check unresolvable status. This happens primarily (maybe only) to clusters when there is no approved image. I am updating the status so new customers don't immediately see an error.

I'll re-evaluate this in the future if it turns out that other resources w/o artifacts also hit this condition.

private fun List<ResourceHistoryEvent>.isWaiting(): Boolean {
// we expect to have only two events, but we will accept several different "unresolvable" events
// in order to be less brittle and show the user this status instead of an error
return all { it is ResourceCreated || it is ResourceCheckUnresolvable } && size < 5
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe reorder this so you don't actually look at a bunch of events unnecessarily?

Suggested change
return all { it is ResourceCreated || it is ResourceCheckUnresolvable } && size < 5
return size < 5 && all { it is ResourceCreated || it is ResourceCheckUnresolvable }

}

test("returns CURRENTLY_UNRESOLVABLE") {
expectThat(subject.getStatus(resource.id)).isEqualTo(CURRENTLY_UNRESOLVABLE)
context("more than created and unresolvable events") {
Copy link
Contributor

Choose a reason for hiding this comment

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

You're missing a test for your size < 5 condition if you want to cover all cases.

@emjburns
Copy link
Contributor Author

@luispollo addressed your comments! Thanks.

Copy link
Contributor

@robfletcher robfletcher left a comment

Choose a reason for hiding this comment

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

I'm curious why 5, but otherwise LGTM

Comment on lines +99 to +101
// we expect to have only two events, but we will accept several different "unresolvable" events
// in order to be less brittle and show the user this status instead of an error
return size < 5 && all { it is ResourceCreated || it is ResourceCheckUnresolvable }
Copy link
Contributor

Choose a reason for hiding this comment

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

The 5 seems arbitrary here. What's the thinking there?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1. Maybe make it a constant with a self-explanatory name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally arbitrary. I feel like if the environment is actually new it'll only have a couple of events. I wanted to make sure this new status only shows up in cases where it is definitely new. So, I chose 5. Does that make sense / seem reasonable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@robfletcher @luispollo I was hoping my comment of // we expect to have only two events, but we will accept several different "unresolvable" events would convey why I chose 5, is there a way I could make this comment more clear?

Copy link
Contributor

@lorin lorin left a comment

Choose a reason for hiding this comment

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

My understanding

Context

If there are no approved images associated with a managed cluster, the cluster will be in a CURRENTLY_UNRESOLVABLE state.

Problem

When a user deploys a new app using Managed Delivery and looks at the environment view, their first environment will have a cluster with zero approved images, which will put it in a CURRENTLY_UNRESOLVABLE state.

This is a poor user experience for new users, because the way that CURRENTLY_UNRESOLVABLE is rendered in the UI, it looks like something is broken, even though this is expected behavior.

Proposed solution

When a cluster resource has zero approved images, show its status as WAITING instead of CURRENTLY_UNRESOLVABLE. The new WAITING status is rendered in the UI in such a way that it communicates that this is expected behavior.

The way this is implemented is that a cluster resource is in the WAITING state if the only events in its history are:

  • resource was created
  • resource check is unresolvable

Feedback

I agree with @robfletcher's comment that the threshold of 5 events feels arbitrary, otherwise looks good to me.

Copy link
Contributor

@luispollo luispollo left a comment

Choose a reason for hiding this comment

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

Other than explaining why the 5 to cap events as @robfletcher mentioned, LGTM.

Copy link
Contributor

@gal-yardeni gal-yardeni left a comment

Choose a reason for hiding this comment

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

LGTM! my only comment is to remember adding a doc explaining this new status :)

@emjburns emjburns added the ready to merge Approved and ready for merge label Jan 11, 2021
@mergify mergify bot added the auto merged label Jan 11, 2021
@mergify mergify bot merged commit 9299c4d into spinnaker:master Jan 11, 2021
osoriano pushed a commit to osoriano/keel that referenced this pull request Sep 2, 2023
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged ready to merge Approved and ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants