Skip to content

Purge old Workspaces at some point #11360

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

Merged
merged 1 commit into from
Sep 15, 2022
Merged

Purge old Workspaces at some point #11360

merged 1 commit into from
Sep 15, 2022

Conversation

geropl
Copy link
Member

@geropl geropl commented Jul 13, 2022

Description

Introduces a 3rd workspace deletion state "purged" as discussed in #11378 .

Related Issue(s)

Fixes #11378

How to test

Run tests

  • (cd components/gitpod-db && yarn test)

Execute in preview environment

  • open a workspace on this branch
  • kubectl port-forward mysql-0 3306 &
  • mysql -u gitpod -h 127.0.0.1 -p, PW: PW
  • Insert these:
INSERT INTO `gitpod`.`d_b_workspace`
(`id`,
`creationTime`,
`ownerId`,
`contextURL`,
`description`,
`context`,
`config`,
`softDeleted`,
`softDeletedTime`,
`contentDeletedTime`,
`cloneURL`)
VALUES
('123',
'2019-09-25T21:44:13.560Z',
'123',
'https://example.org/my/repo',
'my-repo',
'{}',
'{}',
'gc',
'2019-09-25T21:44:13.560Z',
'2019-10-25T21:44:13.560Z',
'https://example.org/my/repo');
INSERT INTO `gitpod`.`d_b_workspace_instance`
(`id`,
`workspaceId`,
`region`,
`creationTime`,
`configuration`,
`ideUrl`,
`workspaceImage`,
`status`)
VALUES
('1231',
'123',
'dev',
'2019-09-25T21:44:13.560Z',
'{}',
'https://example.org/my/workspace',
'',
'{"phase": "stopped"}');
  • kubectl edit cm server-config and set workspaceGarbageCollection.intervalSeconds to 30 (or similar)
  • kubectl rollout restart deployment server
  • wait at least 30 mins until you observe this line in the server logs: wsgc: successfully purged 1 workspaces

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-gpl-clean-wss.2 because the annotations in the pull request description changed
(with .werft/ from main)

@stale
Copy link

stale bot commented Jul 30, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale This issue/PR is stale and will be closed soon label Jul 30, 2022
@stale stale bot closed this Aug 10, 2022
@svenefftinge svenefftinge reopened this Sep 9, 2022
@stale stale bot removed the meta: stale This issue/PR is stale and will be closed soon label Sep 9, 2022
@geropl geropl force-pushed the gpl/clean-wss branch 4 times, most recently from deed758 to 8a5484f Compare September 13, 2022 07:23
@geropl geropl marked this pull request as ready for review September 13, 2022 08:32
@geropl geropl requested a review from a team September 13, 2022 08:32
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Sep 13, 2022
@svenefftinge
Copy link
Member

svenefftinge commented Sep 13, 2022

looking into this, now 👀

Copy link
Member

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

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

Looks really good! ❤️
Would be great to also delete corresponding records from

  • d_b_prebuilt_workspace
  • d_b_workspace_instance_user
  • d_b_layout_data

Adding hold in case you want to address this in this PR.

/hold

@geropl
Copy link
Member Author

geropl commented Sep 13, 2022

Would be great to also delete corresponding records from

Yes indeed... make sense to do it now I guess. Have to double-check with @jakobhero about which ones are safe, though.

@geropl
Copy link
Member Author

geropl commented Sep 13, 2022

d_b_prebuild_info is another candidate as well.

@geropl geropl marked this pull request as draft September 15, 2022 08:27
@easyCZ easyCZ force-pushed the gpl/clean-wss branch 2 times, most recently from fee5029 to 89f2c35 Compare September 15, 2022 09:21
@roboquat roboquat added size/XL and removed size/L labels Sep 15, 2022
@roboquat roboquat added size/L and removed size/XL labels Sep 15, 2022
@easyCZ easyCZ force-pushed the gpl/clean-wss branch 2 times, most recently from d2308d7 to e6bbae0 Compare September 15, 2022 12:58
@easyCZ easyCZ marked this pull request as ready for review September 15, 2022 12:59
@easyCZ
Copy link
Member

easyCZ commented Sep 15, 2022

@geropl This now has metrics also. I've bumped the retention to 3 years for now, to observe the effect.

@geropl
Copy link
Member Author

geropl commented Sep 15, 2022

@easyCZ Yes, looks good to me as well (cannot approve as it's my PR 🙈 )! 👍

Just to summarize:

  • we decided to go with WorkspaceInstance and Workspace first
  • d_b_prebuilt_workspace, d_b_workspace_instance_user, d_b_prebuild_info and d_b_layout_data are good candidates to add as well, but we exclude them for now to move forward. We can add them later, and handle the diff manually (e.g., identify entries without workspace, and schedule removal of those)

@easyCZ
Copy link
Member

easyCZ commented Sep 15, 2022

/unhold

💥

@roboquat roboquat merged commit a7fd1be into main Sep 15, 2022
@roboquat roboquat deleted the gpl/clean-wss branch September 15, 2022 13:27
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/L team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wipe deleted Workspace (+ their WorkspaceInstances) at some point
4 participants