An alternative to building a custom registry image is to:

  1. Start a registry

  2. Modify its content at runtime

This approach is simpler and faster. But the modifications are lost as soon as the container is deleted.

Adding a plug-in at runtime

Procedure

To add a plug-in:

  1. Get the name of the Kubernetes pod that hosts the plug-in registry container. To do this, filter the app=che-plugin-registry label:

    $ PLUGIN_REG_POD=$(kubectl get -o custom-columns=NAME:.metadata.name \
     --no-headers -l app=che-plugin-registry pod)
  2. Create the new plug-in directory in the plug-in registry container, if it does not exist:

    $ ORG="my-org"
    $ PLUGIN="my-plugin"
    $ VERSION="1.0.1"
    $ kubectl exec $\{PLUGIN_REG_POD} -i -t -- \
     mkdir -p /var/www/html/v3/plugins/$\{ORG}/$\{PLUGIN}/$\{VERSION}
  3. Copy the meta.yaml file in the container:

    LOCAL_META="$(PWD)/meta.yaml"
    $ kubectl cp "$\{LOCAL_META}" \
      $\{PLUGIN_REG_POD}:/var/www/html/v3/plugins/$\{ORG}/$\{PLUGIN}/$\{VERSION}
  4. Update the index.json file of the registry:

    $ kubectl exec $\{PLUGIN_REG_POD} -i -t -- \
      /var/www/html/index_v2.sh v3 > /var/www/html/v3/plugins/index.json
  5. The new plug-in can now be used from a Che instance.

Adding a devfile at runtime

Procedure

To add a devfile:

  1. Get the name of the Kubernetes pod that hosts the devfile registry container. To do this, filter the app=che-devfile-registry label:

    $ DEVFILE_REG_POD=$(kubectl get -o custom-columns=NAME:.metadata.name \
      --no-headers -l app=che-devfile-registry pod)
  2. Create the new devfile directory in the devfile registry container, if it does not exist.

    $ STACK="my-stack"
    $ kubectl exec $\{DEVFILE_REG_POD} -i -t -- \
      mkdir -p /var/www/html/devfiles/$\{STACK}
  3. Copy the devfile.yaml file and the meta.yaml file to the container.

    $ LOCAL_META="$(PWD)/meta.yaml"
    $ LOCAL_DEVFILE="$(PWD)/devfile.yaml"
    $ kubectl cp "$\{LOCAL_META}" \
      $\{DEVFILE_REG_POD}:/var/www/html/devfiles/$\{STACK}
    $ kubectl cp "$\{LOCAL_DEVFILE}" \
      $\{DEVFILE_REG_POD}:/var/www/html/devfiles/$\{STACK}
  4. Update the index.json file of the registry.

    $ kubectl exec $\{DEVFILE_REG_POD} -i -t -- \
      /var/www/html/index.sh > /var/www/html/devfiles/index.json
Tags: