From 93c6fa060b3d2be69420114a100833ea4f93760e Mon Sep 17 00:00:00 2001 From: Florent Benoit Date: Wed, 17 Mar 2021 14:57:41 +0100 Subject: [PATCH] feat(devworkspace): Use new name for workspaceRouting: DevWorkspaceRouting Change-Id: Id032a090c93ada7244e1738725e3482a239c29b4 Signed-off-by: Florent Benoit --- .../src/node/k8s-devfile-service-impl.ts | 2 +- ...spaceroutings-for-a-workspace-id-body.json | 376 ++++++++--------- .../tests/_data/workspace-routing-object.json | 383 +++++++++--------- 3 files changed, 363 insertions(+), 398 deletions(-) diff --git a/extensions/eclipse-che-theia-remote-impl-k8s/src/node/k8s-devfile-service-impl.ts b/extensions/eclipse-che-theia-remote-impl-k8s/src/node/k8s-devfile-service-impl.ts index be3d1d069..90a7f703c 100644 --- a/extensions/eclipse-che-theia-remote-impl-k8s/src/node/k8s-devfile-service-impl.ts +++ b/extensions/eclipse-che-theia-remote-impl-k8s/src/node/k8s-devfile-service-impl.ts @@ -66,7 +66,7 @@ export class K8sDevfileServiceImpl implements DevfileService { group, version, this.env.getWorkspaceNamespace(), - 'workspaceroutings', + 'devworkspaceroutings', undefined, undefined, undefined, diff --git a/extensions/eclipse-che-theia-remote-impl-k8s/tests/_data/get-workspaceroutings-for-a-workspace-id-body.json b/extensions/eclipse-che-theia-remote-impl-k8s/tests/_data/get-workspaceroutings-for-a-workspace-id-body.json index f1e97202d..63d5237ff 100644 --- a/extensions/eclipse-che-theia-remote-impl-k8s/tests/_data/get-workspaceroutings-for-a-workspace-id-body.json +++ b/extensions/eclipse-che-theia-remote-impl-k8s/tests/_data/get-workspaceroutings-for-a-workspace-id-body.json @@ -1,217 +1,199 @@ { - "apiVersion": "controller.devfile.io/v1alpha1", - "items": [ - { - "apiVersion": "controller.devfile.io/v1alpha1", - "kind": "WorkspaceRouting", - "metadata": { - "creationTimestamp": "2021-02-02T16:57:30Z", - "generation": 1, - "labels": { - "controller.devfile.io/workspace_id": "workspaceeb55021d3cff42e0" - }, - "managedFields": [ - { - "apiVersion": "controller.devfile.io/v1alpha1", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:metadata": { - "f:labels": { - ".": {}, - "f:controller.devfile.io/workspace_id": {} - }, - "f:ownerReferences": {} - }, - "f:spec": { + "apiVersion": "controller.devfile.io/v1alpha1", + "items": [ + { + "apiVersion": "controller.devfile.io/v1alpha1", + "kind": "DevWorkspaceRouting", + "metadata": { + "creationTimestamp": "2021-03-17T13:39:16Z", + "generation": 1, + "labels": { + "controller.devfile.io/workspace_id": "workspace79f69b51a4e24714" + }, + "managedFields": [ + { + "apiVersion": "controller.devfile.io/v1alpha1", + "fieldsType": "FieldsV1", + "fieldsV1": { + "f:metadata": { + "f:labels": { ".": {}, - "f:endpoints": { - ".": {}, - "f:che-rest-apis": {}, - "f:terminal": {}, - "f:theia-ide": {} - }, - "f:podSelector": { - ".": {}, - "f:controller.devfile.io/workspace_id": {} - }, - "f:routingSuffix": {}, - "f:workspaceId": {} + "f:controller.devfile.io/workspace_id": {} }, - "f:status": { - ".": {}, - "f:exposedEndpoints": { - ".": {}, - "f:terminal": {}, - "f:theia-ide": {} - }, - "f:phase": {} - } + "f:ownerReferences": {} }, - "manager": "devworkspace-controller", - "operation": "Update", - "time": "2021-02-02T16:57:31Z" - } - ], - "name": "routing-workspaceeb55021d3cff42e0", - "namespace": "che", - "ownerReferences": [ - { - "apiVersion": "workspace.devfile.io/v1alpha2", - "blockOwnerDeletion": true, - "controller": true, - "kind": "DevWorkspace", - "name": "theia", - "uid": "eb55021d-3cff-42e0-b091-624708504bf7" - } - ], - "resourceVersion": "2754", - "selfLink": "/apis/controller.devfile.io/v1alpha1/namespaces/che/workspaceroutings/routing-workspaceeb55021d3cff42e0", - "uid": "40af1119-48e1-440a-ac55-9c279c526e2d" - }, - "spec": { - "endpoints": { - "che-rest-apis": [ - { - "exposure": "internal", - "name": "che-rest-apis", - "protocol": "tcp", - "targetPort": 9999 - } - ], - "terminal": [ - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "terminal" + "f:spec": { + ".": {}, + "f:endpoints": { + ".": {}, + "f:terminal": {}, + "f:theia-ide": {} }, - "exposure": "public", - "name": "che-mach-exec", - "protocol": "ws", - "secure": true, - "targetPort": 4444 - } - ], - "theia-ide": [ - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "ide" + "f:podSelector": { + ".": {}, + "f:controller.devfile.io/workspace_id": {} }, - "exposure": "public", - "name": "theia", - "protocol": "http", - "secure": true, - "targetPort": 3100 + "f:routingClass": {}, + "f:routingSuffix": {}, + "f:workspaceId": {} }, - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "webview", - "unique": "true" + "f:status": { + ".": {}, + "f:exposedEndpoints": { + ".": {}, + "f:terminal": {}, + "f:theia-ide": {} }, - "exposure": "public", - "name": "webviews", - "protocol": "http", - "secure": true, - "targetPort": 3100 + "f:phase": {} + } + }, + "manager": "devworkspace-controller", + "operation": "Update", + "time": "2021-03-17T13:39:16Z" + } + ], + "name": "routing-workspace79f69b51a4e24714", + "namespace": "che", + "ownerReferences": [ + { + "apiVersion": "workspace.devfile.io/v1alpha2", + "blockOwnerDeletion": true, + "controller": true, + "kind": "DevWorkspace", + "name": "theia", + "uid": "79f69b51-a4e2-4714-80db-eb02696d9ec4" + } + ], + "resourceVersion": "1049", + "uid": "2cf1617d-88f4-44bd-8c28-a45ad557b6b7" + }, + "spec": { + "endpoints": { + "terminal": [ + { + "attributes": { + "type": "terminal" }, - { - "attributes": { - "type": "ide-dev" - }, - "exposure": "public", - "name": "theia-dev", - "protocol": "http", - "targetPort": 3130 + "exposure": "public", + "name": "che-mach-exec", + "protocol": "ws", + "secure": true, + "targetPort": 4444 + } + ], + "theia-ide": [ + { + "attributes": { + "type": "ide" }, - { - "exposure": "public", - "name": "theia-redir-1", - "protocol": "http", - "targetPort": 13131 + "exposure": "public", + "name": "theia", + "protocol": "http", + "secure": true, + "targetPort": 3100 + }, + { + "attributes": { + "type": "webview", + "unique": "true" }, - { - "exposure": "public", - "name": "theia-redir-2", - "protocol": "http", - "targetPort": 13132 + "exposure": "public", + "name": "webviews", + "protocol": "http", + "secure": true, + "targetPort": 3100 + }, + { + "attributes": { + "type": "ide-dev" }, - { - "exposure": "public", - "name": "theia-redir-3", - "protocol": "http", - "targetPort": 13133 - } - ] - }, - "podSelector": { - "controller.devfile.io/workspace_id": "workspaceeb55021d3cff42e0" - }, - "routingSuffix": "192.168.64.31.nip.io", - "workspaceId": "workspaceeb55021d3cff42e0" + "exposure": "public", + "name": "theia-dev", + "protocol": "http", + "targetPort": 3130 + }, + { + "exposure": "public", + "name": "theia-redir-1", + "protocol": "http", + "targetPort": 13131 + }, + { + "exposure": "public", + "name": "theia-redir-2", + "protocol": "http", + "targetPort": 13132 + }, + { + "exposure": "public", + "name": "theia-redir-3", + "protocol": "http", + "targetPort": 13133 + } + ] }, - "status": { - "exposedEndpoints": { - "terminal": [ - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "terminal" - }, - "name": "che-mach-exec", - "url": "ws://workspaceeb55021d3cff42e0-che-mach-exec-4444.192.168.64.31.nip.io" - } - ], - "theia-ide": [ - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "ide" - }, - "name": "theia", - "url": "http://workspaceeb55021d3cff42e0-theia-3100.192.168.64.31.nip.io" - }, - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "webview", - "unique": "true" - }, - "name": "webviews", - "url": "http://workspaceeb55021d3cff42e0-webviews-3100.192.168.64.31.nip.io" + "podSelector": { + "controller.devfile.io/workspace_id": "workspace79f69b51a4e24714" + }, + "routingClass": "basic", + "routingSuffix": "192.168.64.46.nip.io", + "workspaceId": "workspace79f69b51a4e24714" + }, + "status": { + "exposedEndpoints": { + "terminal": [ + { + "attributes": { + "type": "terminal" }, - { - "attributes": { - "type": "ide-dev" - }, - "name": "theia-dev", - "url": "http://workspaceeb55021d3cff42e0-theia-dev-3130.192.168.64.31.nip.io" + "name": "che-mach-exec", + "url": "ws://workspace79f69b51a4e24714-che-mach-exec-4444.192.168.64.46.nip.io" + } + ], + "theia-ide": [ + { + "attributes": { + "type": "ide" }, - { - "attributes": {}, - "name": "theia-redir-1", - "url": "http://workspaceeb55021d3cff42e0-theia-redir-1-13131.192.168.64.31.nip.io" + "name": "theia", + "url": "http://workspace79f69b51a4e24714-theia-3100.192.168.64.46.nip.io" + }, + { + "attributes": { + "type": "webview", + "unique": "true" }, - { - "attributes": {}, - "name": "theia-redir-2", - "url": "http://workspaceeb55021d3cff42e0-theia-redir-2-13132.192.168.64.31.nip.io" + "name": "webviews", + "url": "http://workspace79f69b51a4e24714-webviews-3100.192.168.64.46.nip.io" + }, + { + "attributes": { + "type": "ide-dev" }, - { - "attributes": {}, - "name": "theia-redir-3", - "url": "http://workspaceeb55021d3cff42e0-theia-redir-3-13133.192.168.64.31.nip.io" - } - ] - }, - "phase": "Ready" - } + "name": "theia-dev", + "url": "http://workspace79f69b51a4e24714-theia-dev-3130.192.168.64.46.nip.io" + }, + { + "name": "theia-redir-1", + "url": "http://workspace79f69b51a4e24714-theia-redir-1-13131.192.168.64.46.nip.io" + }, + { + "name": "theia-redir-2", + "url": "http://workspace79f69b51a4e24714-theia-redir-2-13132.192.168.64.46.nip.io" + }, + { + "name": "theia-redir-3", + "url": "http://workspace79f69b51a4e24714-theia-redir-3-13133.192.168.64.46.nip.io" + } + ] + }, + "phase": "Ready" } - ], - "kind": "WorkspaceRoutingList", - "metadata": { - "continue": "", - "resourceVersion": "659254", - "selfLink": "/apis/controller.devfile.io/v1alpha1/namespaces/che/workspaceroutings" } + ], + "kind": "DevWorkspaceRoutingList", + "metadata": { + "continue": "", + "resourceVersion": "2831" } +} diff --git a/extensions/eclipse-che-theia-remote-impl-k8s/tests/_data/workspace-routing-object.json b/extensions/eclipse-che-theia-remote-impl-k8s/tests/_data/workspace-routing-object.json index 8babd339e..9c978f7ff 100644 --- a/extensions/eclipse-che-theia-remote-impl-k8s/tests/_data/workspace-routing-object.json +++ b/extensions/eclipse-che-theia-remote-impl-k8s/tests/_data/workspace-routing-object.json @@ -1,206 +1,189 @@ - { +{ + "apiVersion": "controller.devfile.io/v1alpha1", + "kind": "DevWorkspaceRouting", + "metadata": { + "creationTimestamp": "2021-03-17T13:39:16Z", + "generation": 1, + "labels": { + "controller.devfile.io/workspace_id": "workspace79f69b51a4e24714" + }, + "managedFields": [ + { "apiVersion": "controller.devfile.io/v1alpha1", - "kind": "WorkspaceRouting", - "metadata": { - "creationTimestamp": "2021-02-02T16:57:30Z", - "generation": 1, - "labels": { - "controller.devfile.io/workspace_id": "workspaceeb55021d3cff42e0" + "fieldsType": "FieldsV1", + "fieldsV1": { + "f:metadata": { + "f:labels": { + ".": {}, + "f:controller.devfile.io/workspace_id": {} }, - "managedFields": [ - { - "apiVersion": "controller.devfile.io/v1alpha1", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:metadata": { - "f:labels": { - ".": {}, - "f:controller.devfile.io/workspace_id": {} - }, - "f:ownerReferences": {} - }, - "f:spec": { - ".": {}, - "f:endpoints": { - ".": {}, - "f:che-rest-apis": {}, - "f:terminal": {}, - "f:theia-ide": {} - }, - "f:podSelector": { - ".": {}, - "f:controller.devfile.io/workspace_id": {} - }, - "f:routingSuffix": {}, - "f:workspaceId": {} - }, - "f:status": { - ".": {}, - "f:exposedEndpoints": { - ".": {}, - "f:terminal": {}, - "f:theia-ide": {} - }, - "f:phase": {} - } - }, - "manager": "devworkspace-controller", - "operation": "Update", - "time": "2021-02-02T16:57:31Z" - } - ], - "name": "routing-workspaceeb55021d3cff42e0", - "namespace": "che", - "ownerReferences": [ - { - "apiVersion": "workspace.devfile.io/v1alpha2", - "blockOwnerDeletion": true, - "controller": true, - "kind": "DevWorkspace", - "name": "theia", - "uid": "eb55021d-3cff-42e0-b091-624708504bf7" - } - ], - "resourceVersion": "2754", - "selfLink": "/apis/controller.devfile.io/v1alpha1/namespaces/che/workspaceroutings/routing-workspaceeb55021d3cff42e0", - "uid": "40af1119-48e1-440a-ac55-9c279c526e2d" - }, - "spec": { - "endpoints": { - "che-rest-apis": [ - { - "exposure": "internal", - "name": "che-rest-apis", - "protocol": "tcp", - "targetPort": 9999 - } - ], - "terminal": [ - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "terminal" - }, - "exposure": "public", - "name": "che-mach-exec", - "protocol": "ws", - "secure": true, - "targetPort": 4444 - } - ], - "theia-ide": [ - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "ide" - }, - "exposure": "public", - "name": "theia", - "protocol": "http", - "secure": true, - "targetPort": 3100 - }, - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "webview", - "unique": "true" - }, - "exposure": "public", - "name": "webviews", - "protocol": "http", - "secure": true, - "targetPort": 3100 - }, - { - "attributes": { - "type": "ide-dev" - }, - "exposure": "public", - "name": "theia-dev", - "protocol": "http", - "targetPort": 3130 - }, - { - "exposure": "public", - "name": "theia-redir-1", - "protocol": "http", - "targetPort": 13131 - }, - { - "exposure": "public", - "name": "theia-redir-2", - "protocol": "http", - "targetPort": 13132 - }, - { - "exposure": "public", - "name": "theia-redir-3", - "protocol": "http", - "targetPort": 13133 - } - ] + "f:ownerReferences": {} + }, + "f:spec": { + ".": {}, + "f:endpoints": { + ".": {}, + "f:terminal": {}, + "f:theia-ide": {} }, - "podSelector": { - "controller.devfile.io/workspace_id": "workspaceeb55021d3cff42e0" + "f:podSelector": { + ".": {}, + "f:controller.devfile.io/workspace_id": {} }, - "routingSuffix": "192.168.64.31.nip.io", - "workspaceId": "workspaceeb55021d3cff42e0" - }, - "status": { - "exposedEndpoints": { - "terminal": [ - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "terminal" - }, - "name": "che-mach-exec", - "url": "ws://workspaceeb55021d3cff42e0-che-mach-exec-4444.192.168.64.31.nip.io" - } - ], - "theia-ide": [ - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "ide" - }, - "name": "theia", - "url": "http://workspaceeb55021d3cff42e0-theia-3100.192.168.64.31.nip.io" - }, - { - "attributes": { - "cookiesAuthEnabled": "true", - "type": "webview", - "unique": "true" - }, - "name": "webviews", - "url": "http://workspaceeb55021d3cff42e0-webviews-3100.192.168.64.31.nip.io" - }, - { - "attributes": { - "type": "ide-dev" - }, - "name": "theia-dev", - "url": "http://workspaceeb55021d3cff42e0-theia-dev-3130.192.168.64.31.nip.io" - }, - { - "attributes": {}, - "name": "theia-redir-1", - "url": "http://workspaceeb55021d3cff42e0-theia-redir-1-13131.192.168.64.31.nip.io" - }, - { - "attributes": {}, - "name": "theia-redir-2", - "url": "http://workspaceeb55021d3cff42e0-theia-redir-2-13132.192.168.64.31.nip.io" - }, - { - "attributes": {}, - "name": "theia-redir-3", - "url": "http://workspaceeb55021d3cff42e0-theia-redir-3-13133.192.168.64.31.nip.io" - } - ] + "f:routingClass": {}, + "f:routingSuffix": {}, + "f:workspaceId": {} + }, + "f:status": { + ".": {}, + "f:exposedEndpoints": { + ".": {}, + "f:terminal": {}, + "f:theia-ide": {} }, - "phase": "Ready" + "f:phase": {} + } + }, + "manager": "devworkspace-controller", + "operation": "Update", + "time": "2021-03-17T13:39:16Z" + } + ], + "name": "routing-workspace79f69b51a4e24714", + "namespace": "che", + "ownerReferences": [ + { + "apiVersion": "workspace.devfile.io/v1alpha2", + "blockOwnerDeletion": true, + "controller": true, + "kind": "DevWorkspace", + "name": "theia", + "uid": "79f69b51-a4e2-4714-80db-eb02696d9ec4" + } + ], + "resourceVersion": "1049", + "uid": "2cf1617d-88f4-44bd-8c28-a45ad557b6b7" + }, + "spec": { + "endpoints": { + "terminal": [ + { + "attributes": { + "type": "terminal" + }, + "exposure": "public", + "name": "che-mach-exec", + "protocol": "ws", + "secure": true, + "targetPort": 4444 + } + ], + "theia-ide": [ + { + "attributes": { + "type": "ide" + }, + "exposure": "public", + "name": "theia", + "protocol": "http", + "secure": true, + "targetPort": 3100 + }, + { + "attributes": { + "type": "webview", + "unique": "true" + }, + "exposure": "public", + "name": "webviews", + "protocol": "http", + "secure": true, + "targetPort": 3100 + }, + { + "attributes": { + "type": "ide-dev" + }, + "exposure": "public", + "name": "theia-dev", + "protocol": "http", + "targetPort": 3130 + }, + { + "exposure": "public", + "name": "theia-redir-1", + "protocol": "http", + "targetPort": 13131 + }, + { + "exposure": "public", + "name": "theia-redir-2", + "protocol": "http", + "targetPort": 13132 + }, + { + "exposure": "public", + "name": "theia-redir-3", + "protocol": "http", + "targetPort": 13133 + } + ] + }, + "podSelector": { + "controller.devfile.io/workspace_id": "workspace79f69b51a4e24714" + }, + "routingClass": "basic", + "routingSuffix": "192.168.64.46.nip.io", + "workspaceId": "workspace79f69b51a4e24714" + }, + "status": { + "exposedEndpoints": { + "terminal": [ + { + "attributes": { + "type": "terminal" + }, + "name": "che-mach-exec", + "url": "ws://workspace79f69b51a4e24714-che-mach-exec-4444.192.168.64.46.nip.io" + } + ], + "theia-ide": [ + { + "attributes": { + "type": "ide" + }, + "name": "theia", + "url": "http://workspace79f69b51a4e24714-theia-3100.192.168.64.46.nip.io" + }, + { + "attributes": { + "type": "webview", + "unique": "true" + }, + "name": "webviews", + "url": "http://workspace79f69b51a4e24714-webviews-3100.192.168.64.46.nip.io" + }, + { + "attributes": { + "type": "ide-dev" + }, + "name": "theia-dev", + "url": "http://workspace79f69b51a4e24714-theia-dev-3130.192.168.64.46.nip.io" + }, + { + "name": "theia-redir-1", + "url": "http://workspace79f69b51a4e24714-theia-redir-1-13131.192.168.64.46.nip.io" + }, + { + "name": "theia-redir-2", + "url": "http://workspace79f69b51a4e24714-theia-redir-2-13132.192.168.64.46.nip.io" + }, + { + "name": "theia-redir-3", + "url": "http://workspace79f69b51a4e24714-theia-redir-3-13133.192.168.64.46.nip.io" } - } + ] + }, + "phase": "Ready" + } +}