128 Commits

Author SHA1 Message Date
Pavel Tumik
9a8151df25 refactor dispose workspace when using pvc 2022-11-03 01:16:07 +01:00
JenTing Hsiao
b58ececf53 Revert "ws-manager: remove PVC object if the workspace pod fails to up"
This reverts commit 28fae90078c351207f3f0f48ab7fc6154cc4e5ce.

Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-10-06 19:17:22 +02:00
Pavel Tumik
389f7767fb [ws-daemon] fix WaitForInit not found error in tracing 2022-10-05 10:35:21 +02:00
JenTing Hsiao
28fae90078 ws-manager: remove PVC object if the workspace pod fails to up
Remove the PVC object if the stop workspace request.
The PVC object removal is postponed until the PVC is no longer actively
used by the workspace pod.

Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-10-04 00:35:19 +02:00
JenTing Hsiao
01fda6568c ws-mananger: refactor volume snapshot watcher
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-09-27 00:31:27 +02:00
Pavel Tumik @ GitPod
b9d9cc7656 [ws-manager] make sure wsman does not spam in log on restart 2022-09-23 00:55:23 +02:00
JenTing Hsiao
df91671058 Add workspapce ID annotation to VolumeSnapshot object for filter event
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-09-16 00:58:16 +02:00
JenTing Hsiao
7c45c85cf4 ws-manager: fix event workers hang
Fix workers hang if there are over 100 VolumeSnapshot is ready, and the ws-manager be restarted.
The m.notifyPod channel is no receiver, and it causes the 100 event workers to hang.

Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-09-16 00:58:16 +02:00
JenTing Hsiao
9fcb0ea057 Add labels to VolumeSnapshot object
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-08-31 16:08:16 +02:00
Pavel Tumik @ GitPod
52e954cd17 [workspace] fix multiple calls to finalizeWorkspaceContent can mess up dispose 2022-08-30 20:44:15 +02:00
Pavel Tumik @ GitPod
92f2f1a418 [ws-manager] improve finalizeWorkspaceContent logic 2022-08-30 08:18:14 +02:00
Pavel Tumik @ GitPod
23f3e4257a [ws-manager] simplify workspaceDisposalStatus and FinalBackupComplete condition 2022-08-26 01:54:10 +02:00
Pavel Tumik @ GitPod
498f23bfb3 [ws-manager] improve tracing in initializeWorkspaceContent 2022-08-25 01:46:41 +02:00
Pavel Tumik @ GitPod
fb7bcb9d3c [ws-manager] add additional logging into finalizeWorkspaceContent 2022-08-24 01:27:40 +02:00
Pavel Tumik @ GitPod
d5bc66615a remove trace from retryifUnavailable 2022-08-24 01:20:40 +02:00
Pavel Tumik
07d80c8fa8 add support for aborting workspaces 2022-08-23 20:20:40 +02:00
utam0k
25fc443625 ws-manager: Consistently use clearInitializerFromMap. 2022-08-23 04:27:39 +02:00
utam0k
5bf7449d70 ws-manager: Improve handling of sync.Map during initializing 2022-08-22 21:23:38 +02:00
utam0k
de79559a87 ws-manager: Replace initializerMapLock with sync.Map 2022-08-22 21:23:38 +02:00
utam0k
6042240fba ws-manager: Improve the monitor code. 2022-08-22 07:17:38 +02:00
utam0k
3917ed82de ws-manager: introduce a DisposalEmpty status. 2022-08-19 19:54:36 +02:00
utam0k
79401fba08 ws-manager: if disposal status is finished, don't run finalizer. 2022-08-19 19:54:36 +02:00
utam0k
a01ad87972 ws-manager: refactor the monitor. 2022-08-19 19:54:36 +02:00
Pavel Tumik @ GitPod
715ed4bbee fix race condition when creating notifyPod channel 2022-08-18 01:49:34 +02:00
utam0k
b89a41716c ws-manager: Fix consistency of disposed ws between ws-daemon and ws-manager 2022-08-16 20:36:33 +02:00
JenTing Hsiao
e6f1734988 Retry doFinalize if gRPC status code is Unavailable
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-08-05 14:19:49 -03:00
JenTing Hsiao
ca37fdb1cb Revert "Add annotation gitpod.io/startedDisposal once we enter finalize workspace content"
This reverts commit e40e43d76120e5de702522e6b816f28b86a219c6.

Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-08-03 22:22:47 -03:00
JenTing Hsiao
e40e43d761 Add annotation gitpod.io/startedDisposal once we enter finalize workspace content
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-08-03 03:17:47 -03:00
Pavel Tumik
b97e21a36b cleanup 2022-08-02 16:57:48 -03:00
Pavel Tumik
fb055491ad log error 2022-08-02 16:57:48 -03:00
Manuel Alejandro de Brito Fontes
54df112817 Replace lock with sync.Map 2022-08-02 16:57:48 -03:00
Pavel Tumik
ee9c9a3a4a improve tracing 2022-08-02 16:57:48 -03:00
JenTing Hsiao
8e9912f706 If workspace Id is empty, return it
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-08-02 05:34:46 -03:00
JenTing Hsiao
35c6bd1a86 ws-manager: go through stopping phase even if the workspace is not ready
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-29 23:45:24 -03:00
JenTing Hsiao
bcc2956b61 Correct const variable naming. It should be a label, not an annotation
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-29 14:51:23 -03:00
JenTing Hsiao
347af9bff0 Add label to differentiate backup/restore total/failure is PVC or GCS
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-28 20:12:23 -03:00
JenTing Hsiao
d8867d3cb5 Revert the ws-daemon max unavailable back to wsdaemonMaxAttempts
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-28 09:46:22 -03:00
JenTing Hsiao
a4767814b1 Retry ws-daemon if not found within 1 hour (every 5 seconds)
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-25 23:23:20 -03:00
JenTing Hsiao
b984b0c129 log warn if error happens and is not found error
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-22 20:26:17 -03:00
JenTing Hsiao
487575b0f3 Send event to workspace pod only when pod still exists
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-22 20:26:17 -03:00
JenTing Hsiao
422891828c Fix missing arguments
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-22 20:26:17 -03:00
Manuel Alejandro de Brito Fontes
ebef691ce2 [ws-manager] Only build snapshots of initialized/ready workspaces 2022-07-22 14:40:17 -03:00
Pavel Tumik
3ad16cac8f [ws-manager] fix not handling err in initializeWorkspaceContent 2022-07-20 22:17:15 -03:00
JenTing Hsiao
8bc561ca6a Use switch case for better code reading
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-18 20:35:13 +02:00
JenTing Hsiao
c5147d7633 Remove no longer used annotation gitpod.io/containerIsGone
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-18 20:35:13 +02:00
JenTing Hsiao
293d219cfb Use the eventRecorder from manager object
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-18 20:34:14 +02:00
JenTing Hsiao
100632dd97 [ws-manager] Fix node in NotReady state, the workspace pod keeps in terminating state w/o backing up
When the node turns into a NotReady state, after a moment, the workspace pod
goes into the terminating state, but the containerStatus.state is still running.

We check the pod toleration matches against the node taint, with effect
NoExecute and the toleration seconds expired to make sure that the container's
graceful shutdown is finished before taking the content backup.
Otherwise, it might create an unstable backup.

https://github.com/gitpod-io/gitpod/issues/11336

Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-07-14 20:03:01 +02:00
Christian Weichel
8248935e44 [ws-manager] Add Git token to workspace secret 2022-07-06 19:22:53 +05:30
Christian Weichel
3518346650 [ws-manager] Ship env vars as secret 2022-07-06 19:22:53 +05:30
ArthurSens
87a1e34f8e ws-manager: Replace backup/restore success with total metric
Signed-off-by: ArthurSens <arthursens2005@gmail.com>
2022-07-06 13:27:53 +05:30