-
Notifications
You must be signed in to change notification settings - Fork 243
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
List namespace right after namespace has been created #6922
List namespace right after namespace has been created #6922
Conversation
🔨 Deploy Preview deleted from internal cluster!
|
if ns.Name == nco.namespaceName { | ||
break L | ||
} | ||
} |
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 would add a sleep for let's say 50ms at this point, to not respawn the List operation too fast
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.
That's a good idea.
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.
Thanks for this fix
@@ -105,7 +108,29 @@ func (nco *NamespaceCreateOptions) Run(ctx context.Context) (err error) { | |||
if err != nil { | |||
return err | |||
} | |||
|
|||
if nco.waitFlag { | |||
var timeOut = time.After(nco.clientset.PreferenceClient.GetTimeout()) |
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.
The default value for nco.clientset.PreferenceClient.GetTimeout()
is currently 1 second. Isn't that too low?
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.
Also, to me, if the user sets --wait
, it means that they purposely are willing to wait until they get confirmation that the namespace/project is returned correctly.
I'm thinking for example of a script using odo create namespace --wait
before doing other things..
The user would need to interrupt the process to cancel the wait.
So IMO, we should not even have a timeout.
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.
For me, it's a matter of 10's of milliseconds. Having to break manually can be dangerous if executed from a script: is the user expecting the command will never return in case of problem? I would instead return an error if the namespace is not created after a reasonable time. As the timeout is configurable, I would keep as is, and users in heavy loaded systems could increase it.
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.
Yup, that makes sense. Personally, I found this Timeout
preference confusing and not used consistently. I think every command with a --wait
flag should also provide an additional --timeout
flag to set a timeout only for this command, but that's a different story.
Alright, in this case, returning an error if the timeout is reached would indeed make more sense. The error should also clearly indicate how the user can adjust this timeout, I think.
cc @valaparthvi
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.
One last comment: I think the success message (Namespace "$ns" is ready for use
) should be displayed only after the new checks are done. Otherwise, the output might be confusing if the namespace still does not appear in the list after the timeout is reached, e.g.:
$ odo create namespace test-ns11 --wait
✓ Waiting for namespace to come up [11ms]
✓ Namespace "test-ns11" is ready for use
⚠ Timeout while waiting for namespace "test-ns11"; it may take a while to appear
I'd suggest displaying ✓ Namespace "test-ns11" is ready for use
only if the namespace does appear in the list. What do you think?
EDIT: Actually, I think the Waiting for namespace to come up
line should return successfully only after we are done with the checks. Then we could display ✓ Namespace "$ns" is ready for use
.
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
4cbc111
to
b3d20bf
Compare
Signed-off-by: Parthvi Vala <pvala@redhat.com>
b3d20bf
to
14b846b
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Unrelated, but keeping an eye on this to see if it occurs again. /override windows-integration-test/Windows-test |
@rm3l: Overrode contexts on behalf of rm3l: windows-integration-test/Windows-test In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What type of PR is this:
/kind bug
/flake
What does this PR do / why we need it:
This PR fixes the bug where
odo create namespace -w
does not work as expected.Which issue(s) this PR fixes:
Fixes #6827
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer: