Skip to content

feat: replace kubedock with native container-in-container support#709

Merged
cidrblock merged 8 commits intoansible:mainfrom
cidrblock:container-in-container
Mar 18, 2026
Merged

feat: replace kubedock with native container-in-container support#709
cidrblock merged 8 commits intoansible:mainfrom
cidrblock:container-in-container

Conversation

@cidrblock
Copy link
Copy Markdown
Contributor

@cidrblock cidrblock commented Mar 17, 2026

Summary

Replace the kubedock-based container proxying in the Dev Spaces image with native rootless podman via user namespaces, targeting OCP 4.20+ and Dev Spaces 3.25+.

Changes

Container image (devspaces/)

  • Remove podman.py kubedock wrapper — no longer needed with native container-in-container
  • Add entrypoint.sh for dynamic UID/subuid/subgid mapping required by rootless podman in user namespaces
  • Add buildah, skopeo, and crun packages (design doc requirements, now functional with native containers)
  • Set BUILDAH_ISOLATION=chroot to avoid nested user namespace issues
  • Set cap_setuid/cap_setgid on newuidmap/newgidmap for rootless podman
  • Update Python from 3.11 to 3.12
  • Add python3/pip3 alternatives so commands work with or without version suffix
  • Add colored bash prompt (ansible-prompt.sh) modeled after Fedora's bash-color-prompt, installed to /etc/profile.d/
  • Bump oc client from 4.15 to 4.20

Devfile (devfile.yaml)

  • No pod-overrides or container-overrides: with Dev Spaces 3.25+ and OCP 4.20+, the Dev Spaces operator injects the correct context into the workspace pod.
  • Fix hardcoded /usr/local/lib/python3.11/ path in ansible-navigator command to use dynamic Python lookup

Background

With OCP 4.20+, containers can run nested containers natively via rootless podman without kubedock as an intermediary. This simplifies the architecture, removes the podman wrapper indirection, and enables buildah and skopeo to work properly inside the workspace.

Reference: Enable nested containers in OpenShift Dev Spaces with user namespaces

Cluster requirements

The target OCP cluster needs:

  • OCP 4.20+ (container-in-container supported; 4.17–4.19 are tech preview and require no-upgrade)
  • crun set as the default OCI runtime
  • A custom SCC (e.g. nested-podman-scc) with SETUID/SETGID capabilities and container_engine_t SELinux type
  • Dev Spaces CheCluster configured with containerBuildConfiguration.openShiftSecurityContextConstraint pointing to the SCC

Test plan

  • Build the container image locally with tools/devspaces.sh
  • Verify podman run works inside the workspace (native, not via kubedock)
  • Verify buildah and skopeo work inside the workspace
  • Verify python3 --version returns 3.12
  • Verify python3 and pip3 resolve without version suffix
  • Verify colored bash prompt appears in terminal
  • Verify Molecule workflow commands work in the devfile
  • Verify ansible-navigator command works (no hardcoded python path)
  • Test on OCP 4.20+ cluster with container-in-container support

Switch the Dev Spaces image from kubedock-based container proxying to
native rootless podman via user namespaces (OCP 4.17+ / Dev Spaces 3.20).

- Remove kubedock podman.py wrapper
- Add entrypoint.sh for dynamic UID/subuid/subgid mapping
- Add pod-overrides and container-overrides to devfile for user
  namespace support (hostUsers: false, procMount: Unmasked, /dev/fuse
  and /dev/net/tun device access)
- Add buildah, skopeo, and crun packages
- Set BUILDAH_ISOLATION=chroot for nested user namespace compatibility
- Set newuidmap/newgidmap capabilities for rootless podman
- Update Python from 3.11 to 3.12
- Add python3/pip3 alternatives for version-agnostic invocation
- Add colored bash prompt modeled after Fedora's bash-color-prompt
- Fix hardcoded python3.11 path in ansible-navigator devfile command
- Bump oc client from 4.15 to 4.17

Made-with: Cursor

This comment was marked as outdated.

- Add buildah, crun, skopeo, setcap, setgid to cspell dictionary
- Remove unused cyan variable from ansible-prompt.sh (shellcheck SC2034)
- Move entrypoint.sh install into setup.sh bind-mount RUN to avoid
  adding extra image layers (24 > 23 max)

Made-with: Cursor
- entrypoint.sh: fail fast with error if /etc/passwd is not writable
  and user cannot be resolved
- entrypoint.sh: derive subordinate ID range from /proc/self/uid_map
  instead of assuming a fixed 65536 window, and validate the range
  is positive before writing subuid/subgid
- setup.sh: follow alternatives --install with --set to guarantee
  python3/pip3 resolve deterministically
- ansible-prompt.sh: preserve existing PROMPT_COMMAND hooks instead
  of unconditionally overwriting

Made-with: Cursor
Copilot AI review requested due to automatic review settings March 17, 2026 18:49
@github-actions github-actions bot added feat and removed feat labels Mar 17, 2026

This comment was marked as outdated.

- Fix /etc/group entry to include GID field (name:x:gid:members)
- Add set -euo pipefail and explicit writable checks for
  /etc/subuid and /etc/subgid before writing
- Rename END_ID to SUB_ID_COUNT to clarify it is a count, not an end

Made-with: Cursor
Copilot AI review requested due to automatic review settings March 17, 2026 20:09
@github-actions github-actions bot added feat and removed feat labels Mar 17, 2026

This comment was marked as outdated.

- Remove pod-overrides and container-overrides from devfile.yaml;
  Dev Spaces operator injects the correct context on 3.25+/4.20+
- Bump oc client to 4.20 (container-in-container supported in 4.20)

Made-with: Cursor
Only /etc/passwd is needed for whoami; user primary GID is 0 and
group 0 (root) already exists in the image. Avoids invalid
group-file format and GID mismatch (Copilot 2949320604).

Made-with: Cursor
Copilot AI review requested due to automatic review settings March 17, 2026 20:17
@github-actions github-actions bot added feat and removed feat labels Mar 17, 2026

This comment was marked as outdated.

@github-actions github-actions bot added feat and removed feat labels Mar 17, 2026
cidrblock added a commit to cidrblock/ansible-creator that referenced this pull request Mar 17, 2026
…ntainer

- Remove KUBEDOCK_ENABLED env; no longer needed with native
  container-in-container (Dev Spaces operator injects context).
- Remove container args; ansible-devspaces image uses ENTRYPOINT/CMD.

Aligns scaffolded devfile with ansible/ansible-dev-tools#709.

Made-with: Cursor
Copy link
Copy Markdown

@cgruver cgruver left a comment

Choose a reason for hiding this comment

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

LGTM

cidrblock added a commit to ansible/ansible-creator that referenced this pull request Mar 18, 2026
…ntainer (#540)

* fix(devfile): align with OCP 4.20+ / Dev Spaces 3.25+ container-in-container

- Remove KUBEDOCK_ENABLED env; no longer needed with native
  container-in-container (Dev Spaces operator injects context).
- Remove container args; ansible-devspaces image uses ENTRYPOINT/CMD.

Aligns scaffolded devfile with ansible/ansible-dev-tools#709.

Made-with: Cursor

* chore: remove KUBEDOCK from cspell dictionary (no longer used in devfile)

Made-with: Cursor
@cidrblock cidrblock merged commit 06600bd into ansible:main Mar 18, 2026
30 checks passed
renovate bot added a commit to sdwilsh/ansible-playbooks that referenced this pull request Mar 21, 2026
##### [\`26.3.1\`](https://github.com/ansible/ansible-dev-tools/releases/tag/v26.3.1)

#### Features

- feat: replace kubedock with native container-in-container support ([#709](ansible/ansible-dev-tools#709)) [@cidrblock](https://github.com/cidrblock)

---
##### [\`26.3.0\`](https://github.com/ansible/ansible-dev-tools/releases/tag/v26.3.0)

#### Fixes

- fix: update devtools tools to 26.3.0 ([#701](ansible/ansible-dev-tools#701)) [@ssbarnea](https://github.com/ssbarnea)
- fix: entry point and pytest config ([#694](ansible/ansible-dev-tools#694)) [@ssbarnea](https://github.com/ssbarnea)
- fix: compatibility with newer tox releases ([#700](ansible/ansible-dev-tools#700)) [@ssbarnea](https://github.com/ssbarnea)
- fix: selenium container ([#698](ansible/ansible-dev-tools#698)) [@ssbarnea](https://github.com/ssbarnea)
- fix: selenium container arm64 ([#695](ansible/ansible-dev-tools#695)) [@ssbarnea](https://github.com/ssbarnea)

#### Maintenance

- chore(deps): update pep621 ([#708](ansible/ansible-dev-tools#708)) @[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update all dependencies ([#707](ansible/ansible-dev-tools#707)) @[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps-dev): bump black from 26.3.0 to 26.3.1 in the uv group across 1 directory ([#705](ansible/ansible-dev-tools#705)) @[dependabot\[bot\]](https://github.com/apps/dependabot)
- chore: update mkdocs ([#703](ansible/ansible-dev-tools#703)) [@ssbarnea](https://github.com/ssbarnea)
- chore(deps): update all dependencies ([#702](ansible/ansible-dev-tools#702)) @[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update all dependencies ([#696](ansible/ansible-dev-tools#696)) @[renovate\[bot\]](https://github.com/apps/renovate)
- chore: improve test robustness for devspaces environment ([#697](ansible/ansible-dev-tools#697)) [@VedantMadane](https://github.com/VedantMadane)
- chore: add adt and python extension to selenium container ([#699](ansible/ansible-dev-tools#699)) [@ssbarnea](https://github.com/ssbarnea)
sdwilsh pushed a commit to sdwilsh/ansible-playbooks that referenced this pull request Mar 21, 2026
##### [\`26.3.1\`](https://github.com/ansible/ansible-dev-tools/releases/tag/v26.3.1)

#### Features

- feat: replace kubedock with native container-in-container support ([#709](ansible/ansible-dev-tools#709)) [@cidrblock](https://github.com/cidrblock)

---
##### [\`26.3.0\`](https://github.com/ansible/ansible-dev-tools/releases/tag/v26.3.0)

#### Fixes

- fix: update devtools tools to 26.3.0 ([#701](ansible/ansible-dev-tools#701)) [@ssbarnea](https://github.com/ssbarnea)
- fix: entry point and pytest config ([#694](ansible/ansible-dev-tools#694)) [@ssbarnea](https://github.com/ssbarnea)
- fix: compatibility with newer tox releases ([#700](ansible/ansible-dev-tools#700)) [@ssbarnea](https://github.com/ssbarnea)
- fix: selenium container ([#698](ansible/ansible-dev-tools#698)) [@ssbarnea](https://github.com/ssbarnea)
- fix: selenium container arm64 ([#695](ansible/ansible-dev-tools#695)) [@ssbarnea](https://github.com/ssbarnea)

#### Maintenance

- chore(deps): update pep621 ([#708](ansible/ansible-dev-tools#708)) @[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update all dependencies ([#707](ansible/ansible-dev-tools#707)) @[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps-dev): bump black from 26.3.0 to 26.3.1 in the uv group across 1 directory ([#705](ansible/ansible-dev-tools#705)) @[dependabot\[bot\]](https://github.com/apps/dependabot)
- chore: update mkdocs ([#703](ansible/ansible-dev-tools#703)) [@ssbarnea](https://github.com/ssbarnea)
- chore(deps): update all dependencies ([#702](ansible/ansible-dev-tools#702)) @[renovate\[bot\]](https://github.com/apps/renovate)
- chore(deps): update all dependencies ([#696](ansible/ansible-dev-tools#696)) @[renovate\[bot\]](https://github.com/apps/renovate)
- chore: improve test robustness for devspaces environment ([#697](ansible/ansible-dev-tools#697)) [@VedantMadane](https://github.com/VedantMadane)
- chore: add adt and python extension to selenium container ([#699](ansible/ansible-dev-tools#699)) [@ssbarnea](https://github.com/ssbarnea)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants