Che: How to programmatically determine public URL of created Kubernetes component endpoint?

Created on 31 Aug 2020  路  2Comments  路  Source: eclipse/che

Hey guys,

we want to develop a very simple Che-Theia plugin to open the public endpoints of a devfile in a new browser window. For testing, we use the devfile below. However, atm we are stuck because it's not clear from where we can get/query the endpoint information for all registered Kubernetes components.

Similarly to the "My Workspace" view, we have to query somehow the available user runtimes and their registered endpoints (see screenshot).
image

We a apreciate any tipp or hint how to query such information.

Thanks in advance for your help,
Michael


Relevant information

Example devfile:

apiVersion: 1.0.0
metadata:
  generateName: radon-workspace-
components:
  - alias: theia-editor
    type: cheEditor
    id: eclipse/che-theia/next
  - alias: radon-gmt
    type: kubernetes
    endpoints:
      - name: radon-gmt
        port: 8080
        attributes:
          protocol: http
          secure: "false"
          discoverable: "false"
          public: "true"
    mountSources: true
    reference: ...
areeditoche-theia areplugins kinquestion

Most helpful comment

Hello @miwurster
you can get all the exposed endpoints from a Workspace runtime.

The endpoints are available as "machine servers" in Che Theia Plugin API.
E.g.:

import * as che from '@eclipse-che/plugin';
...
workspace = await che.workspace.getCurrentWorkspace()
machines = workspace.runtime.machines
machine1 = ...
servers = machine1.servers
server1 = ...
server1.url
...

All 2 comments

Hello @miwurster
you can get all the exposed endpoints from a Workspace runtime.

The endpoints are available as "machine servers" in Che Theia Plugin API.
E.g.:

import * as che from '@eclipse-che/plugin';
...
workspace = await che.workspace.getCurrentWorkspace()
machines = workspace.runtime.machines
machine1 = ...
servers = machine1.servers
server1 = ...
server1.url
...

Perfect! Thank you very much.

Was this page helpful?
0 / 5 - 0 ratings