Skip to content

[PRODENG-3641] Option 2: add spec.mcr.installRecommends, run package managers directly - #656

Open
james-nesbitt wants to merge 1 commit into
mainfrom
PRODENG-3641-install-recommends
Open

[PRODENG-3641] Option 2: add spec.mcr.installRecommends, run package managers directly#656
james-nesbitt wants to merge 1 commit into
mainfrom
PRODENG-3641-install-recommends

Conversation

@james-nesbitt

@james-nesbitt james-nesbitt commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What

Adds spec.mcr.installRecommends (bool, default false). When set, the package manager is told to install the runtime's recommended packages regardless of the host's configured default. Also shifts the MCR install to issuing package-manager commands directly on all three Linux families, which is what makes passing those arguments possible.

This is one of two divergent PRs for PRODENG-3641. The alternative is #655 (installCLI). They are alternatives, not companions — pick one.

Why

A customer on CIS-hardened RHEL 8.10 ended up with the runtime installed and no docker CLI, so every later docker command failed on a host that otherwise looked correctly installed.

The cause is weak dependencies. Every docker-ee package on repos.mirantis.com declares its companions as recommended packages (rpm Recommends / deb Recommends), never as hard Requires/Depends — verified across rhel 8/9, sles 15 and ubuntu jammy/noble on both stable-25.0 and stable-29.2:

RECOMMENDNAME:
  cri-dockerd-ee
  docker-ee-cli

Package managers install recommended packages by default, which is why the CLI normally appears without launchpad naming it. Hardening baselines commonly disable that — install_weak_deps=false (dnf/yum), APT::Install-Recommends "false" (apt), solver.onlyRequires (zypper).

The CLI is not the whole gap. cri-dockerd-ee is also only a recommended package, and launchpad never installs it explicitly anywhere — it only references cri-dockerd-mke.service/.socket during cleanup. On the same hosts, the Kubernetes CRI shim is missing too. Addressing the mechanism covers both; naming the CLI covers only the package that happened to be noticed.

How

spec.mcr.installRecommends maps to each manager's own opt-in:

Manager Argument added
yum/dnf --setopt=install_weak_deps=True
apt-get -o APT::Install-Recommends=true
zypper --recommends

Which packages that installs is decided by repository metadata, not by launchpad, so the list cannot drift.

rig's InstallPackage hardcodes <manager> install -y <packages> and accepts no further arguments. SLES already bypassed it with a direct command for --allow-vendor-change (PRODENG-3623). Rather than adding two more ad-hoc bypasses, all three commands are now built in one place — configurer.MCRInstallCommand — and covered by a single table test.

Default behaviour is unchanged. With the flag unset the generated commands are byte-identical to what rig ran:

yum install -y docker-ee
DEBIAN_FRONTEND=noninteractive apt-get install -y -q docker-ee
zypper -n install -y --allow-vendor-change docker-ee

The -q on apt is there because rig had it; the tests assert that equivalence, which is how I caught its omission in the first draft. rig also ran apt-get update inside InstallPackage, which InstallMCR already does explicitly beforehand, so it is not repeated.

Trade-off versus the alternative

  • This PR: delegates the package set to repository metadata so it cannot drift, and covers cri-dockerd-ee as well as the CLI. Cost: the recommended set differs by platform. On rpm hosts it is exactly cri-dockerd-ee + docker-ee-cli; on deb hosts it additionally installs ca-certificates, docker-ee-rootless-extras, git, libltdl7, pigz, procps, xz-utils and a kernel (>= 4.15) package. Installing a kernel as a side effect of this flag deserves an explicit decision — it is documented on the config field. Second cost: three direct command paths instead of rig's helper.
  • The installCLI PR: identical two-package behaviour everywhere and no surprising footprint, but a hardcoded list that can drift, and it leaves the cri-dockerd-ee gap unaddressed.

Testing

  • TestMCRInstallCommand — table over all three managers × flag set/unset. Asserts the unset commands match rig's previous behaviour exactly, and that SLES keeps --allow-vendor-change in both cases.
  • TestMCRInstallCommandUnknownManager — the error path, so an unhandled family fails loudly rather than returning an empty command that would execute as a no-op.
  • TestMCRConfig_InstallRecommends — the yaml key round-trips (absent → false, true/false honoured).
  • Confirmed discriminating: with the flag condition neutered, exactly the three opt-in cases fail and the three default cases still pass.
  • make lint clean (0 issues), go vet, go vet -tags=integration, gofmt, full unit suite green.

Not smoke-tested: the failure mode needs a host with weak dependencies disabled, which no smoke platform currently provides. The --setopt spelling was verified against dnf directly; the apt and zypper spellings were verified against their manpages, not on a live host.

Note on scope

If MKE genuinely requires cri-dockerd-ee, obtaining it via a weak dependency is arguably a latent bug in its own right, independent of this flag and of the CLI question. Worth a separate ticket either way.

Links

Written by AI: claude-sonnet-5

Alternative to the installCLI approach on PRODENG-3641-install-cli. This
addresses the mechanism rather than one package.

docker-ee declares docker-ee-cli and cri-dockerd-ee as recommended
packages (rpm Recommends / deb Recommends), never as hard requirements.
Verified across rhel 8/9, sles 15 and ubuntu jammy/noble on stable-25.0
and stable-29.2. Package managers install recommended packages by default,
which is why the CLI normally appears without launchpad naming it.
Hardening baselines commonly disable that, and the runtime then installs
without its CLI, which is what PRODENG-3641 reports.

Naming docker-ee-cli explicitly fixes only the package that was noticed.
cri-dockerd-ee is recommended too and launchpad never installs it
explicitly, so the same hosts are missing the Kubernetes CRI shim.

Add spec.mcr.installRecommends, default false, which tells the package
manager to honour recommended packages regardless of the host default:

  yum/dnf  --setopt=install_weak_deps=True
  apt-get  -o APT::Install-Recommends=true
  zypper   --recommends

Which packages that installs is decided by the repository metadata, not by
launchpad, so the list cannot drift. Note it differs by platform: on rpm
hosts it is the two packages above, while on deb hosts it also brings
ca-certificates, docker-ee-rootless-extras, git, a kernel package,
libltdl7, pigz, procps and xz-utils. That difference is documented on the
config field and is the main trade-off against the installCLI approach.

rig's InstallPackage hardcodes "<manager> install -y <packages>" and takes
no further arguments, so the MCR install now issues its command directly
on all three families. SLES already did this for --allow-vendor-change
(PRODENG-3623); rather than adding two more ad-hoc bypasses, the commands
for all three managers are built in one place, MCRInstallCommand, and
covered by a single table test.

Default behaviour is unchanged. The generated commands with the flag unset
are byte-identical to what rig ran, including apt's "-y -q" and SLES's
--allow-vendor-change; the tests asserting that are the reason -q is
there. rig also ran "apt-get update" inside InstallPackage, which
InstallMCR already does explicitly beforehand, so it is not repeated.

Windows is unaffected and documented as ignoring the value: MCR installs
via install.ps1 from a single archive that already contains the CLI, with
no package manager and no equivalent concept.

Refs PRODENG-3641

Written by AI: claude-sonnet-5
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.

1 participant