Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Delete space does not delete che workspace #4559

Closed
ljelinkova opened this issue Nov 19, 2018 · 14 comments
Closed

Delete space does not delete che workspace #4559

ljelinkova opened this issue Nov 19, 2018 · 14 comments

Comments

@ljelinkova
Copy link
Collaborator

ljelinkova commented Nov 19, 2018

Issue Overview

When you have space in OSIO with created Che workspace, neither delete space action neither reset of environment action deletes the Che workspace.

Expected Behaviour

The Che workspace should be deleted when associated space is deleted.

Current Behaviour

The Che workspace is NOT deleted when associated space is deleted.

Steps To Reproduce
  1. Create space, application and workspace in OSIO
  2. Check that workspace is listed in Che dashboard che.openshift.io
  3. Delete space OR reset environment
  4. Check that workspace is still present in Che dashboard
Additional Information

Note that this causes E2E tests fail because there are too many workspaces which causes some Gateway timeout errors when running Che.

I've found the following code in DeleteSpace method

log.Info(ctx, nil, "Found %d workspaces to delete", len(workspaces))
	for _, workspace := range workspaces {
		for _, link := range workspace.Links {
			if strings.ToLower(link.Method) == "delete" {
				log.Info(ctx,
					map[string]interface{}{"codebase_url": cb.URL,
						"che_namespace": ns,
						"workspace":     workspace.Config.Name,
					}, "About to delete Che workspace")

@rhopp checked Kibana logs and it seems that the first log is logged but not the second one. This makes me believe that the returned workspace somehow does not contain any link or the returned link does not contain 'delete' method.

@xcoulon, @ibuziuk FYI

@rhopp
Copy link
Collaborator

rhopp commented Nov 19, 2018

I guess, that WIT uses <che-api-url>/workspace for obtaining all workspaces... This endpoint always returns empty links section, even though querying <che-api-url>/workspace/<workspace_id> shows links section populated (with self, ide, .. links). Possible bug in upstream che?

Either way, I think the logic in WIT should be changed to not depend on links, but instead construct the correct URLs by itself (<che-api-url>/workspace/<workspace_id>)

@ljelinkova ljelinkova added SEV2-high priority/P1 Critical and removed priority/P1 Critical labels Nov 19, 2018
@xcoulon
Copy link
Collaborator

xcoulon commented Nov 19, 2018

I guess, that WIT uses <che-api-url>/workspace for obtaining all workspaces... This endpoint always returns empty links section, even though querying <che-api-url>/workspace/<workspace_id> shows links section populated (with self, ide, .. links). Possible bug in upstream che?

Either way, I think the logic in WIT should be changed to not depend on links, but instead construct the correct URLs by itself (<che-api-url>/workspace/<workspace_id>)

On the contrary, I believe that Che should return valid links that WIT can follow. The client service should not "build" URLs itself, but rather, it should rely on a previous response from the remote service.

@rhopp
Copy link
Collaborator

rhopp commented Nov 19, 2018

I guess, that WIT uses <che-api-url>/workspace for obtaining all workspaces... This endpoint always returns empty links section, even though querying <che-api-url>/workspace/<workspace_id> shows links section populated (with self, ide, .. links). Possible bug in upstream che?
Either way, I think the logic in WIT should be changed to not depend on links, but instead construct the correct URLs by itself (<che-api-url>/workspace/<workspace_id>)

On the contrary, I believe that Che should return valid links that WIT can follow. The client service should not "build" URLs itself, but rather, it should rely on a previous response from the remote service.

Yep... I was writing faster than thinking :-D You are 100% correct...

@xcoulon
Copy link
Collaborator

xcoulon commented Nov 20, 2018

I guess, that WIT uses <che-api-url>/workspace for obtaining all workspaces... This endpoint always returns empty links section, even though querying <che-api-url>/workspace/<workspace_id> shows links section populated (with self, ide, .. links). Possible bug in upstream che?
Either way, I think the logic in WIT should be changed to not depend on links, but instead construct the correct URLs by itself (<che-api-url>/workspace/<workspace_id>)

On the contrary, I believe that Che should return valid links that WIT can follow. The client service should not "build" URLs itself, but rather, it should rely on a previous response from the remote service.

Yep... I was writing faster than thinking :-D You are 100% correct...

No worries, @rhopp ;)
@ibuziuk is it something you could take a look at, please?

@ibuziuk
Copy link
Collaborator

ibuziuk commented Nov 21, 2018

Note that this causes E2E tests fail because there are too many workspaces which causes some Gateway timeout errors when running Che.

@ljelinkova to unblock e2e tests could all the previous workspaces been removed ? also why after test execution cleanup of previously created workspaces does not happen ?

@ibuziuk
Copy link
Collaborator

ibuziuk commented Nov 21, 2018

@xcoulon che-starter already provides API for deleting workspace by name:

DELETE /workspace/{name}

hmm... I do not really understand why it is currently expected that delete link exists at all, since it has never been part of response from che-starter. I believe we should simply remove delete link check [1] and simply execute removal of the workspace by name [2] in the loop. It is quite strange to see delete link checks which are actually never used for workspace deletion. Does it make sense ?

Either way, I think the logic in WIT should be changed to not depend on links, but instead construct the correct URLs by itself (/workspace/<workspace_id>)

Wit should never call che-server API directly, all communication should happen via che-starter that should play the role of API adapter

[1] https://github.com/fabric8-services/fabric8-wit/blob/master/controller/codebase.go#L257
[2] https://github.com/fabric8-services/fabric8-wit/blob/master/controller/codebase.go#L263

@ljelinkova
Copy link
Collaborator Author

@ibuziuk Thanks for the answer. We've already taken care of e2e by removing all old workspaces. We do not automatically delete old workspaces because that is something normal user should not need to do. We wouldn't even find this problem if we were deleting them automatically.

@xcoulon How do you propose to proceed? Will you rewrite the WIT to use che-starter delete workspace API?

@stevengutz stevengutz added the priority/P3 Medium label Nov 26, 2018
@ppitonak ppitonak added priority/P1 Critical and removed priority/P3 Medium labels Nov 28, 2018
@ppitonak
Copy link
Collaborator

@xcoulon any updates?

@ppitonak
Copy link
Collaborator

ppitonak commented Feb 8, 2019

@xcoulon when is this planned to be fixed? It causes trouble in production. We manually remove old che workspaces in our testing accounts but cannot expect our customers to do the same.

@alexeykazakov
Copy link
Member

@ppitonak it's not for @xcoulon (Core team) to answer that question :)
It's for WIT team to fix that (cc: @sbose78 )

@sbose78
Copy link
Collaborator

sbose78 commented Feb 8, 2019

Thanks @alexeykazakov .

@ppitonak
Copy link
Collaborator

We need to periodically remove che workspaces on our testing accounts, otherwise the product is unusable eclipse-che/che#12638

@jarifibrahim
Copy link
Collaborator

I've verified that this issue is fixed on prod-preview. @ppitonak can you confirm? I'll push the changes to prod once we're sure the issue is fixed.

@ppitonak
Copy link
Collaborator

Works for me, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants