Running custom registries

Prerequisites

The my-plug-in-registry and my-devfile-registry images used in this section are built using the docker command. This section assumes that these images are available on the Kubernetes or OpenShift cluster where Che is deployed.

This is true on Minishift or Minikube, for example, if before running the docker build commands, the user executed:

  • The eval ${minikube docker-env} command for Minikube.

  • The eval ${minishift docker-env} command for Minishift.

These images can be then pushed to:

  • A public container registry such as quay.io, or the DockerHub.

  • A private registry.

Deploying registries in Kubernetes

Procedure

A Helm chart for the plug-in registry is available in the /kubernetes/che-plugin-registry/ directory of the GitHub repository.

  1. To deploy the plug-in registry using the Helm chart, run the following command:

    NAMESPACE=<namespace-name>     (1)
    DOMAIN=<kubernetes-cluster-domain> (2)
    IMAGE="my-plug-in-registry"
    helm upgrade --install che-plugin-registry \
     --debug \
     --namespace ${NAMESPACE} \
     --set global.ingressDomain=${DOMAIN} \
     --set chePluginRegistryImage=${IMAGE} \
     --set chePluginRegistryImagePullPolicy="Always" \
     ./kubernetes/che-plugin-registry/
    1 If installed using chectl, the default Che namespace is eclipse-che. The OperatorHub installation method deploys Che to the users current namespace.
    2 On Minikube, use $(minikube ip).nip.io
  2. The devfile registry also has a Helm chart in the deploy/kubernetes/che-devfile-registry/ directory of the GitHub repository. To deploy it, run the command:

    NAMESPACE=<namespace-name>     (1)
    DOMAIN=<kubernetes-cluster-domain> (2)
    IMAGE="my-devfile-registry"
    helm upgrade --install che-devfile-registry \
     --debug \
     --namespace ${NAMESPACE} \
     --set global.ingressDomain=${DOMAIN} \
     --set cheDevfileRegistryImage=${IMAGE} \
     --set cheDevfileRegistryImagePullPolicy="Always" \
     ./deploy/kubernetes/che-devfile-registry/
    1 If installed using chectl, the default Che namespace is eclipse-che. The OperatorHub installation method deploys Che to the users current namespace.
    2 On Minikube, use $(minikube ip).nip.io
  3. The Helm chart creates a Pod, a service, and an Ingress. To get them, use component=plugin-registry (or component=plugin-registry for the devfile registry)

    $ kubectl  get -o custom-columns=TYPE:.kind,NAME:.metadata.name \
      -l component=plugin-registry pod,svc,ingress
    TYPE      NAME
    Pod       che-plugin-registry-5c7cd8d5c9-zlqlz
    Service   che-plugin-registry
    Ingress   che-plugin-registry
Verification steps
  1. To verify that the new plug-in is correctly published to the plug-in registry, make a request to the registry path /v3/plugins/index.json (or /devfiles/index.json for the devfile registry).

    $ URL=$(kubectl  get ingress -l app=che,component=plugin-registry \
      -o 'custom-columns=URL:.spec.rules[0].host' --no-headers)
    $ INDEX_JSON=$(curl -sSL http://${URL}/v3/plugins/index.json)
    $ echo ${INDEX_JSON} | jq '.[] | select(.name == "my-plug-in")'
    {
     "id": "my-org/my-plug-in/1.0.0",
     "displayName":"This is my first plug-in for Che",
     "version":"1.0.0",
     "type":"VS Code extension",
     "name":"my-plug-in",
     "description":"This plugins shows that we are able to add plugins to the registry...",
     "publisher":"my-org",
     "links": {"self":"/v3/plugins/my-org/my-plug-in/1.0.0"}
    }
    --
    --
    {
     "id": "my-org/my-plug-in/latest",
     "displayName":"This is my first plug-in for Che",
     "version":"latest",
     "type":"VS Code extension",
     "name":"my-plug-in",
     "description":"This plugins shows that we are able to add plugins to the registry...",
     "publisher":"my-org",
     "links": {"self":"/v3/plugins/my-org/my-plug-in/latest" }
    }
  2. Verify that the Che server points to the URL of the registry. To do so, compare the value of the CHE_WORKSPACE_PLUGIN__REGISTRY__URL parameter in the che ConfigMap (or CHE_WORKSPACE_DEVFILE__REGISTRY__URL for the devfile registry):

    $ kubectl  get cm/che \
      -o "custom-columns=URL:.data['CHE_WORKSPACE_PLUGIN__REGISTRY__URL']" \
      --no-headers
    URL
    http://che-plugin-registry-che.192.168.99.100.nip.io/v3

    with the URL of the ingress:

    $ kubectl  get ingress -l app=che,component=plugin-registry \
      -o 'custom-columns=URL: .spec.rules[0].host' --no-headers
    che-plugin-registry-che.192.168.99.100.nip.io
    1. If they do not match, update the ConfigMap and restart the Che server.

      $ kubectl  edit cm/che
      (...)
      $ kubectl  scale --replicas=0 deployment/che
      $ kubectl  scale --replicas=1 deployment/che
  3. When the new plugin registry is deployed and the Che server is configured to use them, UI should be reflected in the following places:

    1. The new plug-ins are available in the completion to chePlugin components in Devfile tab of a workspace details;

    2. The new plug-ins are available in the Plugin Theia view of a workspace.

  4. When the new devfile registry is deployed the Che server is configured to use them, the new devfiles are displayed in the Get Started and Create Custom Workspace tab of the user dashboard.

Deploying registries in OpenShift

Procedure

An OpenShift template to deploy the plug-in registry is available in the deploy/openshift/ directory of the GitHub repository.

  1. To deploy the plug-in registry using the OpenShift template, run the following command:

    NAMESPACE=<namespace-name>  (1)
    IMAGE_NAME="my-plug-in-registry"
    IMAGE_TAG="latest"
    oc new-app -f openshift/che-plugin-registry.yml \
     -n "$\{NAMESPACE}" \
     -p IMAGE="$\{IMAGE_NAME}" \
     -p IMAGE_TAG="$\{IMAGE_TAG}" \
     -p PULL_POLICY="Always"
    1 If installed using chectl, the default Che namespace is eclipse-che. The OperatorHub installation method deploys Che to the users current namespace.
  2. The devfile registry has an OpenShift template in the deploy/openshift/ directory of the GitHub repository. To deploy it, run the command:

    NAMESPACE=<namespace-name>  (1)
    IMAGE_NAME="my-devfile-registry"
    IMAGE_TAG="latest"
    oc new-app -f openshift/che-devfile-registry.yml \
     -n "$\{NAMESPACE}" \
     -p IMAGE="$\{IMAGE_NAME}" \
     -p IMAGE_TAG="$\{IMAGE_TAG}" \
     -p PULL_POLICY="Always"
    1 If installed using chectl, the default Che namespace is eclipse-che. The OperatorHub installation method deploys Che to the users current namespace.
Verification steps
  1. To verify that the new plug-in is correctly published to the plug-in registry, make a request to the registry path /v3/plugins/index.json (or /devfiles/index.json for the devfile registry).

    $ URL=$(kubectl  get route -l app=che,component=plugin-registry \
      -o 'custom-columns=URL:.spec.host' --no-headers)
    $ INDEX_JSON=$(curl -sSL http://${URL}/v3/plugins/index.json)
    $ echo ${INDEX_JSON} | jq '.[] | select(.name == "my-plug-in")'
    {
     "id": "my-org/my-plug-in/1.0.0",
     "displayName":"This is my first plug-in for Che",
     "version":"1.0.0",
     "type":"VS Code extension",
     "name":"my-plug-in",
     "description":"This plugins shows that we are able to add plugins to the registry...",
     "publisher":"my-org",
     "links": {"self":"/v3/plugins/my-org/my-plug-in/1.0.0"}
    }
    --
    --
    {
     "id": "my-org/my-plug-in/latest",
     "displayName":"This is my first plug-in for Che",
     "version":"latest",
     "type":"VS Code extension",
     "name":"my-plug-in",
     "description":"This plugins shows that we are able to add plugins to the registry...",
     "publisher":"my-org",
     "links": {"self":"/v3/plugins/my-org/my-plug-in/latest" }
    }
  2. Verify that the Che server points to the URL of the registry. To do so, compare the value of the CHE_WORKSPACE_PLUGIN__REGISTRY__URL parameter in the che ConfigMap (or CHE_WORKSPACE_DEVFILE__REGISTRY__URL for the devfile registry):

    $ kubectl  get cm/che \
      -o "custom-columns=URL:.data['CHE_WORKSPACE_PLUGIN__REGISTRY__URL']" \
      --no-headers
    URL
    http://che-plugin-registry-che.192.168.99.100.nip.io/v3

    with the URL of the route:

    $ kubectl  get route -l app=che,component=plugin-registry \
      -o 'custom-columns=URL: .spec.host' --no-headers
    che-plugin-registry-che.192.168.99.100.nip.io
    1. If they do not match, update the ConfigMap and restart the Che server.

      $ kubectl  edit cm/che
      (...)
      $ kubectl  scale --replicas=0 deployment/che
      $ kubectl  scale --replicas=1 deployment/che
  3. When the new plugin registry is deployed and the Che server is configured to use them, UI should be reflected in the following places:

    1. The new plug-ins are available in the completion to chePlugin components in Devfile tab of a workspace details;

    2. The new plug-ins are available in the Plugin Theia view of a workspace.

  4. When the new devfile registry is deployed the Che server is configured to use them, the new devfiles are displayed in the Get Started and Create Custom Workspace tab of the user dashboard.