Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support to run kubedock at workspace startup #107

Merged
merged 2 commits into from
Jul 26, 2023
Merged

Conversation

l0rd
Copy link
Contributor

@l0rd l0rd commented Jul 24, 2023

This PR partially addresses eclipse-che/che#20227.

Using kubedock to run containers and local podman to build containers

The approach of this PR is to add kubedock in the universal developer image (Eclipse Che default image) and start it automatically if the env variable KUBEDOCK_ENABLED is set to true (can be set using a devfile).

When KUBEDOCK_ENABLED=true then the following commands will be executed with kubedock (the remaining commands, in particular podman build, will be executed by the local podman):

podman run
podman ps
podman exec
podman cp
podman logs
podman inspect
podman kill
podman rm
podman wait
podman stop
podman start

The limits of this approach

The kubedock approach allows to run containers from a container running on Kubernetes but has a few limits:

  • podman build -t <image> . && podman run <image> doesn't work and should be replaced with podman build -t <image> . && podman push <image> && podman run <image>. That's because kubedock runs the container as a Kubernetes pod and, as a result, the kubelet on the node will try to pull <image> and will fail if it cannot find it.
  • Clients that use the podman or docker API need to be configured to point to kubedock setting CONTAINER_HOST=tcp://127.0.0.1:2475 or DOCKER_HOST=tcp://127.0.0.1:2475 when they run containers and configured to point to local podman when building the container (something impracticable in some cases).
  • Some podman comands such as generate kube are not supported yet
  • If the option --env is provided then the command podman run fails

How to test

I have pushed this image to quay.io/mloriedo/universal-developer-image:kubedock-wrapper.

The PR can be tested on sandbox using the repo https://github.com/l0rd/dockerfile-hello-world:

@l0rd l0rd requested review from svor and nickboldt as code owners July 24, 2023 09:07
@l0rd l0rd requested a review from ibuziuk July 24, 2023 09:10
@l0rd l0rd linked an issue Jul 24, 2023 that may be closed by this pull request
Copy link
Collaborator

@svor svor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

screenshot-devspaces apps sandbox-m4 g2pi p1 openshiftapps com-2023 07 25-17_54_28

@openshift-ci
Copy link

openshift-ci bot commented Jul 25, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ibuziuk, l0rd, svor

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link

openshift-ci bot commented Jul 26, 2023

New changes are detected. LGTM label has been removed.

@l0rd l0rd changed the title Add support to run kubedock at workspace startup feat: add support to run kubedock at workspace startup Jul 26, 2023
@deerskindoll
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to run "docker in docker"
5 participants