-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow Openshift deploy_che.sh script to detect if project deletion is completed and new project successfully created. #8159
Conversation
… completed and new project successfully created. Signed-off-by: James Drummond <james@devcomb.com>
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
@riuvshin @benoitf @sleshchenko Please review. |
@@ -282,13 +282,39 @@ if ! oc get project "${CHE_OPENSHIFT_PROJECT}" &> /dev/null; then | |||
if [ "${COMMAND}" == "cleanup" ] || [ "${COMMAND}" == "rollupdate" ]; then echo "**ERROR** project doesn't exist. Aborting"; exit 1; fi | |||
if [ "${OPENSHIFT_FLAVOR}" == "osio" ]; then echo "**ERROR** project doesn't exist on OSIO. Aborting"; exit 1; fi | |||
|
|||
echo -n "Project does not exist...creating it..." | |||
oc new-project "${CHE_OPENSHIFT_PROJECT}" &> /dev/null | |||
# OpenShift will not get project but project still exists for for a period after being deleted. |
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.
typo double for
do | ||
{ # try | ||
|
||
oc new-project "${CHE_OPENSHIFT_PROJECT}" &> /dev/null && \ |
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.
It can fail if another user has a project with the same name. So infinitive loop will be in this case. Please consider adding timeout for waiting.
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.
@sleshchenko I don't think you can have two projects with the same name in OpenShift can you? This is one of the reason I created PR #8154. I can add a timeout though anyways.
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.
@JamesDrummond You can't. So script expects that error is temporary (like a project is marked to remove and removing is in progress) and it will disappear when a project will be deleted.
But error can be permanent - like another user has a project with the same name. Then infinitive loop will be here.
P.S. Let me know if my explanation is not clear enough. I'll try to reword 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.
@sleshchenko In OpenShift I don't think it is possible to have two projects with the same name. Even seperate users can't use a project name if it's already taken. I actually remember when I used osio this was even an issue. Took some screen captures below where james@devcomb.com has eclipse-che project and developer user cannot create a project with same name.
If another user just happens to create a project with the same name right after you delete yours, the user can kill the script manually. This is not a likely event. If the project has issues being deleted then this is really another problem that is not likely to happen. I use this script often and rarely have any issues.
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.
everybody agrees that you can't have 2 projects with the same name, but what @sleshchenko meant is that if this error will happen script will go into endless loop which is no OK and there is should be a timer or some kind of interruptor.
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.
@riuvshin Sorry didn't understand. Will add timer. Thanks.
@sleshchenko @riuvshin Added timeout and tested. Please review again. |
|
||
echo -n "[CHE] Switching to \"${CHE_OPENSHIFT_PROJECT}\"..." | ||
oc project "${CHE_OPENSHIFT_PROJECT}" &> /dev/null | ||
WAIT_TO_SWITCH_TO_PROJECT=true |
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.
Do we really need this waiting? As far as I see a current project is automatically switched to newly created after oc new-project
. When there can be a delay between project creation (oc new-project
) and ability to switch to 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.
@sleshchenko I think the intent was to allow switch if project already existed but I cannot see the reason to do this anymore. Removed.
@sleshchenko Please review. |
@JamesDrummond Have you tested It doesn't work for me. Looks like this else section brokes |
What does this PR do?
Allow Openshift deploy_che.sh script to detect if project deletion is completed and new project successfully created.
What issues does this PR fix or reference?
N/A
Release Notes
Allow Openshift deploy_che.sh script to detect if project deletion is completed and new project successfully created.
Signed-off-by: James Drummond james@devcomb.com