From cb9c6fccd8257b3e670f2dfb318a21ce94a489a7 Mon Sep 17 00:00:00 2001 From: JenTing Hsiao Date: Wed, 31 Aug 2022 03:08:03 +0000 Subject: [PATCH 1/3] Add labels to PVC object Signed-off-by: JenTing Hsiao --- components/ws-manager/pkg/manager/create.go | 1 + 1 file changed, 1 insertion(+) diff --git a/components/ws-manager/pkg/manager/create.go b/components/ws-manager/pkg/manager/create.go index 20dd8e79c0fde7..0c1445833fdc18 100644 --- a/components/ws-manager/pkg/manager/create.go +++ b/components/ws-manager/pkg/manager/create.go @@ -268,6 +268,7 @@ func (m *Manager) createPVCForWorkspacePod(startContext *startWorkspaceContext) ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("%s-%s", prefix, req.Id), Namespace: m.Config.Namespace, + Labels: startContext.Labels, }, Spec: corev1.PersistentVolumeClaimSpec{ AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, From 1d6196e5d588370c54b514c735c49a6b454f7813 Mon Sep 17 00:00:00 2001 From: JenTing Hsiao Date: Wed, 31 Aug 2022 03:19:00 +0000 Subject: [PATCH 2/3] Add labels to VolumeSnapshot object Signed-off-by: JenTing Hsiao --- components/ws-manager/pkg/manager/monitor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/components/ws-manager/pkg/manager/monitor.go b/components/ws-manager/pkg/manager/monitor.go index 26394554c18533..4548fdca0419e6 100644 --- a/components/ws-manager/pkg/manager/monitor.go +++ b/components/ws-manager/pkg/manager/monitor.go @@ -1131,6 +1131,7 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb ObjectMeta: metav1.ObjectMeta{ Name: pvcVolumeSnapshotName, Namespace: m.manager.Config.Namespace, + Labels: wso.Pod.Labels, }, Spec: volumesnapshotv1.VolumeSnapshotSpec{ Source: volumesnapshotv1.VolumeSnapshotSource{ From 7306b2b96fc66e800938a1e6677dfe828e61c4eb Mon Sep 17 00:00:00 2001 From: JenTing Hsiao Date: Wed, 31 Aug 2022 05:03:04 +0000 Subject: [PATCH 3/3] Update golden files Signed-off-by: JenTing Hsiao --- .../manager/testdata/cpwp_custom_storage.golden | 15 ++++++++++++++- .../manager/testdata/cpwp_default_storage.golden | 15 ++++++++++++++- .../testdata/cpwp_from_volume_snapshot.golden | 15 ++++++++++++++- .../pkg/manager/testdata/cpwp_no_class.golden | 15 ++++++++++++++- .../pkg/manager/testdata/cpwp_no_pvc.golden | 15 ++++++++++++++- 5 files changed, 70 insertions(+), 5 deletions(-) diff --git a/components/ws-manager/pkg/manager/testdata/cpwp_custom_storage.golden b/components/ws-manager/pkg/manager/testdata/cpwp_custom_storage.golden index 82c679353f99b5..6748fe06fe22e4 100644 --- a/components/ws-manager/pkg/manager/testdata/cpwp_custom_storage.golden +++ b/components/ws-manager/pkg/manager/testdata/cpwp_custom_storage.golden @@ -3,7 +3,20 @@ "metadata": { "name": "ws-test", "namespace": "default", - "creationTimestamp": null + "creationTimestamp": null, + "labels": { + "app": "gitpod", + "component": "workspace", + "gitpod.io/workspaceClass": "gitpodio-pvc", + "gpwsman": "true", + "headless": "false", + "metaID": "foobar", + "owner": "tester", + "project": "", + "team": "", + "workspaceID": "test", + "workspaceType": "regular" + } }, "spec": { "accessModes": [ diff --git a/components/ws-manager/pkg/manager/testdata/cpwp_default_storage.golden b/components/ws-manager/pkg/manager/testdata/cpwp_default_storage.golden index 67ed8370fe43f5..d26feb8fbc7514 100644 --- a/components/ws-manager/pkg/manager/testdata/cpwp_default_storage.golden +++ b/components/ws-manager/pkg/manager/testdata/cpwp_default_storage.golden @@ -3,7 +3,20 @@ "metadata": { "name": "ws-test", "namespace": "default", - "creationTimestamp": null + "creationTimestamp": null, + "labels": { + "app": "gitpod", + "component": "workspace", + "gitpod.io/workspaceClass": "gitpodio-pvc", + "gpwsman": "true", + "headless": "false", + "metaID": "foobar", + "owner": "tester", + "project": "", + "team": "", + "workspaceID": "test", + "workspaceType": "regular" + } }, "spec": { "accessModes": [ diff --git a/components/ws-manager/pkg/manager/testdata/cpwp_from_volume_snapshot.golden b/components/ws-manager/pkg/manager/testdata/cpwp_from_volume_snapshot.golden index ab91543153fef6..b575b5a4685701 100644 --- a/components/ws-manager/pkg/manager/testdata/cpwp_from_volume_snapshot.golden +++ b/components/ws-manager/pkg/manager/testdata/cpwp_from_volume_snapshot.golden @@ -3,7 +3,20 @@ "metadata": { "name": "ws-test", "namespace": "default", - "creationTimestamp": null + "creationTimestamp": null, + "labels": { + "app": "gitpod", + "component": "workspace", + "gitpod.io/workspaceClass": "gitpodio-pvc", + "gpwsman": "true", + "headless": "false", + "metaID": "foobar", + "owner": "tester", + "project": "", + "team": "", + "workspaceID": "test", + "workspaceType": "regular" + } }, "spec": { "accessModes": [ diff --git a/components/ws-manager/pkg/manager/testdata/cpwp_no_class.golden b/components/ws-manager/pkg/manager/testdata/cpwp_no_class.golden index 85a77afde2a5d2..d8835d894532da 100644 --- a/components/ws-manager/pkg/manager/testdata/cpwp_no_class.golden +++ b/components/ws-manager/pkg/manager/testdata/cpwp_no_class.golden @@ -3,7 +3,20 @@ "metadata": { "name": "ws-test", "namespace": "default", - "creationTimestamp": null + "creationTimestamp": null, + "labels": { + "app": "gitpod", + "component": "workspace", + "gitpod.io/workspaceClass": "default", + "gpwsman": "true", + "headless": "false", + "metaID": "foobar", + "owner": "tester", + "project": "", + "team": "", + "workspaceID": "test", + "workspaceType": "regular" + } }, "spec": { "accessModes": [ diff --git a/components/ws-manager/pkg/manager/testdata/cpwp_no_pvc.golden b/components/ws-manager/pkg/manager/testdata/cpwp_no_pvc.golden index 85a77afde2a5d2..c2be9eb9ce2fa7 100644 --- a/components/ws-manager/pkg/manager/testdata/cpwp_no_pvc.golden +++ b/components/ws-manager/pkg/manager/testdata/cpwp_no_pvc.golden @@ -3,7 +3,20 @@ "metadata": { "name": "ws-test", "namespace": "default", - "creationTimestamp": null + "creationTimestamp": null, + "labels": { + "app": "gitpod", + "component": "workspace", + "gitpod.io/workspaceClass": "gitpodio-pvc", + "gpwsman": "true", + "headless": "false", + "metaID": "foobar", + "owner": "tester", + "project": "", + "team": "", + "workspaceID": "test", + "workspaceType": "regular" + } }, "spec": { "accessModes": [