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

[ws-manager] Watch VolumeSnapshot object and notify to the Pod finalizer loop #10820

Merged
merged 2 commits into from
Jun 23, 2022

Conversation

jenting
Copy link
Contributor

@jenting jenting commented Jun 22, 2022

Description

Add volume_snapshot_controller to watch the VolumeSnapshot object, and once the VolumeSnapshot object is ready, notify the Pod in the finalizer loop that the VolumeSnapshot is ready.
This improves the volume snapshot metric gitpod_ws_manager_volume_snapshot_seconds more accurately when the workspace stops.

Related Issue(s)

Fixes #10334

How to test

  1. Enable PVC feature flag
  2. Watch the time that the VolumeSnapshot object becomes ready kubectl get vs -w
  3. Open a workspace, write some data into it, close the workspace
  4. Port forward ws-manager 9500 to localhost kubectl port-forward <ws-manager-pod> 9500:9500
  5. Get the metrics curl -XGET 'localhost:9500/metrics' | grep gitpod_ws_manager_volume_snapshot_seconds, and check if the time matches step 2.

Release Notes

None

Documentation

None

Werft options:

  • /werft with-preview

Add volume_snapshot_controller to watch the VolumeSnapshot object.

Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-jenting-ws-manager-volume-snapshot-10334.7 because the annotations in the pull request description changed
(with .werft/ from main)

@jenting jenting marked this pull request as ready for review June 22, 2022 12:56
@jenting jenting requested a review from a team June 22, 2022 12:56
@github-actions github-actions bot added the team: workspace Issue belongs to the Workspace team label Jun 22, 2022
@jenting jenting force-pushed the jenting/ws-manager-volume-snapshot-10334 branch from 90f7034 to 038827c Compare June 22, 2022 12:59
Copy link
Contributor

@sagor999 sagor999 left a comment

Choose a reason for hiding this comment

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

can you also give my user admin access in preview env so that I can test this PR? Thank you!

components/ws-manager/pkg/manager/monitor.go Outdated Show resolved Hide resolved
components/ws-manager/pkg/manager/monitor.go Outdated Show resolved Hide resolved
components/ws-manager/pkg/manager/monitor.go Outdated Show resolved Hide resolved
components/ws-manager/pkg/manager/monitor.go Show resolved Hide resolved
When the VolumeSnapshot object is ready, notify to the Pod that it
belongs to.

Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
@jenting jenting force-pushed the jenting/ws-manager-volume-snapshot-10334 branch from 038827c to 38f3cf7 Compare June 23, 2022 00:27
@jenting jenting marked this pull request as ready for review June 23, 2022 00:47
@jenting
Copy link
Contributor Author

jenting commented Jun 23, 2022

can you also give my user admin access in preview env so that I can test this PR? Thank you!

Added, PTAL 🙏

Copy link
Contributor

@sagor999 sagor999 left a comment

Choose a reason for hiding this comment

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

code looks good.
adding hold to do a test in preview env (waiting for an admin role from @jenting )

/hold

@sagor999
Copy link
Contributor

/unhold

tested, works like a charm!

@roboquat roboquat merged commit 8158f0b into main Jun 23, 2022
@roboquat roboquat deleted the jenting/ws-manager-volume-snapshot-10334 branch June 23, 2022 17:35
@roboquat roboquat added deployed: workspace Workspace team change is running in production deployed Change is completely running in production labels Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: workspace Workspace team change is running in production deployed Change is completely running in production release-note-none size/L team: workspace Issue belongs to the Workspace team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ws-manager: volume snapshot metric is not accurate for stops
3 participants