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] Properly stop workspaces that never make it to the RUNNING phase #5396

Merged
merged 5 commits into from
Aug 27, 2021

Conversation

csweichel
Copy link
Contributor

@csweichel csweichel commented Aug 26, 2021

When we introduced the finalizer based shutdown mechanism we did not consider that workspaces which never make it to the running phase don't get a finalizer at all. The status machinery assumed that the finalizer would run eventually and set a disposal state annotation.

This PR fixes that issue by marking a workspace as stopped if it's being deleted and doesn't have a finalizer. In the regular shutdown path this works because we add the disposal annotation before we remove the finalizer.

In addition, this PR introduces a unit test for actOnPodEvent by making it act on an interface only, and recording the calls made as fixtures. actOnPodEvent tests re-use the status_* test fixtures.

fixes #5271
fixes #5273
fixes #5274
fixes #5275

@codecov
Copy link

codecov bot commented Aug 26, 2021

Codecov Report

Merging #5396 (8e7d668) into main (03c996b) will increase coverage by 38.28%.
The diff coverage is 76.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           main    #5396       +/-   ##
=========================================
+ Coverage      0   38.28%   +38.28%     
=========================================
  Files         0       13       +13     
  Lines         0     3772     +3772     
=========================================
+ Hits          0     1444     +1444     
- Misses        0     2203     +2203     
- Partials      0      125      +125     
Flag Coverage Δ
components-ws-manager-app 38.28% <76.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
components/ws-manager/pkg/manager/monitor.go 7.98% <40.00%> (ø)
components/ws-manager/pkg/manager/status.go 73.33% <100.00%> (ø)
...-manager/pkg/manager/internal/workpool/workpool.go 100.00% <0.00%> (ø)
components/ws-manager/pkg/manager/config.go 32.50% <0.00%> (ø)
components/ws-manager/pkg/manager/manager.go 24.89% <0.00%> (ø)
components/ws-manager/pkg/manager/manager_ee.go 0.00% <0.00%> (ø)
components/ws-manager/pkg/manager/annotations.go 66.66% <0.00%> (ø)
components/ws-manager/pkg/manager/probe.go 0.00% <0.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03c996b...8e7d668. Read the comment docs.

@csweichel
Copy link
Contributor Author

I'll add a fix for #5275 as well

/hold

@aledbf
Copy link
Member

aledbf commented Aug 26, 2021

/lgtm

@roboquat
Copy link
Contributor

LGTM label has been added.

Git tree hash: 98c10f75005742afb7f6249622245cdc62558e23

@roboquat roboquat added approved and removed lgtm labels Aug 26, 2021
@csweichel
Copy link
Contributor Author

/hold cancel

@aledbf
Copy link
Member

aledbf commented Aug 26, 2021

fixtures.go:113: cannot read golden file testdata/actOnPodEvent_stuckInStopping_RUNNING00.golden: open testdata/actOnPodEvent_stuckInStopping_RUNNING00.golden: no such file or directory

@csweichel missing file?

@aledbf
Copy link
Member

aledbf commented Aug 27, 2021

/lgtm

@roboquat roboquat added the lgtm label Aug 27, 2021
@roboquat
Copy link
Contributor

LGTM label has been added.

Git tree hash: 304aea188d4c79901cc9a8830b05003d639f4a55

@roboquat
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aledbf

Associated issue: #5271

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@roboquat roboquat merged commit da28f48 into main Aug 27, 2021
@roboquat roboquat deleted the cw/fix-5271 branch August 27, 2021 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants