[PRODENG-3641] Option 2: add spec.mcr.installRecommends, run package managers directly - #656
Open
james-nesbitt wants to merge 1 commit into
Open
[PRODENG-3641] Option 2: add spec.mcr.installRecommends, run package managers directly#656james-nesbitt wants to merge 1 commit into
james-nesbitt wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
spec.mcr.installRecommends(bool, defaultfalse). 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-eepackage on repos.mirantis.com declares its companions as recommended packages (rpmRecommends/ debRecommends), never as hardRequires/Depends— verified across rhel 8/9, sles 15 and ubuntu jammy/noble on both 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 —
install_weak_deps=false(dnf/yum),APT::Install-Recommends "false"(apt),solver.onlyRequires(zypper).The CLI is not the whole gap.
cri-dockerd-eeis also only a recommended package, and launchpad never installs it explicitly anywhere — it only referencescri-dockerd-mke.service/.socketduring 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.installRecommendsmaps to each manager's own opt-in:--setopt=install_weak_deps=True-o APT::Install-Recommends=true--recommendsWhich packages that installs is decided by repository metadata, not by launchpad, so the list cannot drift.
rig's
InstallPackagehardcodes<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:
The
-qon 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 ranapt-get updateinsideInstallPackage, whichInstallMCRalready does explicitly beforehand, so it is not repeated.Trade-off versus the alternative
cri-dockerd-eeas well as the CLI. Cost: the recommended set differs by platform. On rpm hosts it is exactlycri-dockerd-ee+docker-ee-cli; on deb hosts it additionally installsca-certificates,docker-ee-rootless-extras,git,libltdl7,pigz,procps,xz-utilsand akernel (>= 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.installCLIPR: identical two-package behaviour everywhere and no surprising footprint, but a hardcoded list that can drift, and it leaves thecri-dockerd-eegap 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-changein 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/falsehonoured).make lintclean (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
--setoptspelling 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