113 Commits

Author SHA1 Message Date
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
Pavel Tumik
7d005012a8 Add PVC support to prebuilds 2022-06-24 22:22:33 +05:30
JenTing Hsiao
3e7c2505d0 Add volume snapshot events to workspace pod event
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-06-24 21:29:33 +05:30
JenTing Hsiao
8158f0b6c9 Watch VolumeSnapshot object is ready
When the VolumeSnapshot object is ready, notify to the Pod that it
belongs to.

Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-06-23 23:05:32 +05:30
JenTing Hsiao
6262677b6e [ws-manager] Only calculate the restore success/failure counter if it's restoring from the Backup or VolumeSnapshot
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-06-14 18:18:23 +05:30
Pavel Tumik
e1b335c029 [ws-manager] change workspace state tracing 2022-06-14 17:06:24 +05:30
JenTing Hsiao
3951854137 [ws-manager] Add workspace class label to PVC backup duration metric
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-06-13 18:50:22 +05:30
JenTing Hsiao
609d9b323e Add metrics to record backup success/failure count
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-06-06 23:30:16 +05:30
Christian Weichel
0f406c4468 [ws-manager] Add workspace class to metrics 2022-05-31 21:26:50 +05:30
JenTing Hsiao
1fbffffef2 Observe metrics when there are no errors.
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-05-30 22:14:48 +05:30
JenTing Hsiao
795e4e75cd Calculate the time of taking the volume snapshot
Signed-off-by: JenTing Hsiao <hsiaoairplane@gmail.com>
2022-05-30 22:14:48 +05:30
Manuel Alejandro de Brito Fontes
fe904f9571 [ws-manager] Check the pod contains a workspace class and exists 2022-05-26 02:31:39 +05:30
utam0k
0a68903b28 ws-manager: Refactor the annotation bool string. 2022-05-25 13:56:39 +05:30
utam0k
6419e31102 Make the pods be removed when workspacekit fails. 2022-05-25 13:56:39 +05:30
Pavel Tumik
905be0afd1 address PR feedback 2022-05-25 13:17:39 +05:30
Pavel Tumik
99204170c5 ensure volume snapshot naming consistency 2022-05-25 13:17:39 +05:30