Skip to content

fix(ee-multicloud-public): port OCP container group entrypoint fixes - #9880

Open
rut31337 wants to merge 1 commit into
redhat-cop:developmentfrom
rut31337:fix/ee-entrypoint-ocp-container-groups
Open

fix(ee-multicloud-public): port OCP container group entrypoint fixes#9880
rut31337 wants to merge 1 commit into
redhat-cop:developmentfrom
rut31337:fix/ee-entrypoint-ocp-container-groups

Conversation

@rut31337

Copy link
Copy Markdown
Collaborator

Summary

Port entrypoint fixes from rhpds/agnosticd-v2 that enable ee-multicloud-public to work on AAP 2.4+ when running jobs via container groups on OpenShift.

This ports the following PRs:

Problem

When AAP runs jobs via container groups on OCP, pods start with ansible-runner worker --private-data-dir=/runner. Job data (inventory, extravars) arrives via the receptor stdin stream after the entrypoint completes — it is not on disk at entrypoint time.

The current entrypoint does a simple exec "${@}", which works for basic cases but:

  1. Does not set ANSIBLE_COLLECTIONS_PATH, so AAP may not find installed collections
  2. Does not handle dynamic dependency installation for projects that use it
  3. Has no awareness of the three different execution contexts (OCP container group, AAP bare-metal execution node, ansible-navigator)

Solution

entrypoint.sh

  • Kubernetes detection via KUBERNETES_SERVICE_HOST env var (injected by k8s into every pod)
  • ansible-playbook wrapper installed at /runner/.ep-wrapper/bin/ that shadows the real binary — when ansible-runner later invokes ansible-playbook, the wrapper installs dynamic dependencies first (now that job data is available), then execs the real binary
  • AAP execution node detection via -u root argument pattern for bare-metal AAP
  • File existence guards on install_dynamic_dependencies.yml — v1 projects that lack this file skip gracefully
  • ANSIBLE_COLLECTIONS_PATH set explicitly with /home/runner/.ansible/collections, /collections, and /usr/share/ansible/collections
  • Collections directory created with correct permissions

ansible.cfg

  • Added collections_path to match the entrypoint's ANSIBLE_COLLECTIONS_PATH

Compatibility

  • agnosticd v1 projects: The install_dynamic_dependencies.yml file won't exist, so all three code paths (K8s, AAP, navigator) skip dependency installation gracefully via the [ -f ] guard
  • agnosticd v2 projects: Full dynamic dependency installation works across all execution contexts
  • ansible-navigator: Continues to work via the shift 2 fallback path
  • Bare-metal AAP: Detected via -u root pattern, same as upstream

Test plan

  • Run a v1 project job on OCP container group — should complete without entrypoint errors
  • Run a v1 project job on bare-metal AAP execution node — should skip dependency install gracefully
  • Run with ansible-navigator locally — should work as before
  • Verify ANSIBLE_COLLECTIONS_PATH is set correctly in all three modes

Port entrypoint fixes from rhpds/agnosticd-v2 PRs redhat-cop#133, redhat-cop#162, redhat-cop#164
that enable ee-multicloud-public to work on AAP 2.4+ when running
jobs via container groups on OpenShift.

Changes:

entrypoint.sh:
- Detect Kubernetes environment via KUBERNETES_SERVICE_HOST and install
  an ansible-playbook wrapper that handles dynamic dependency installation
  after ansible-runner unpacks job data (receptor stdin arrives after
  entrypoint completes — dependencies can't be installed during startup)
- Detect AAP bare-metal execution nodes via -u root argument pattern
- Guard install_dynamic_dependencies.yml on file existence so v1 projects
  that lack this playbook skip gracefully instead of crashing
- Define INSTALL_PLAYBOOK in outer scope to avoid unbound variable errors
  under set -eu
- Set ANSIBLE_COLLECTIONS_PATH explicitly so AAP can find collections
- Create /home/runner/.ansible/collections with correct permissions

ansible.cfg:
- Add collections_path to match the entrypoint's ANSIBLE_COLLECTIONS_PATH
@rut31337
rut31337 requested a review from a team as a code owner July 20, 2026 14:18
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.

2 participants