[deckhouse-cli] Let installed plugins take over built-in commands, and ship the platform's plugins with the bundle - #473
Merged
Conversation
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
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 this does
A plugin installed under a built-in command's name now serves that command, and
d8 mirrorputs the plugins the platform needs into the bundle. Around those two changes the plugin surface is tidied up: one command instead ofinstall/update, an honestlist, a readableversions, and an explicit split between the two transports.Plugins override built-in commands
Nine top-level commands are now overridable:
delivery-kit,data,snapshot,iam,network,v,stronghold,package,system. Install a plugin named exactly like one of them and it serves the command; with no such plugin installed the built-in does. The table lives inoverridableCommands(cmd/d8/root.go).d8starts with no network access. A plugin published upstream but not installed locally does not displace a built-in.dkplugin, onlydelivery-kit. The built-in's aliases carry over to the wrapper, sod8 dkandd8 skeep working after an override.builtinis a thunk, so the werf and virtualization command trees are not assembled for a command a plugin serves.DECKHOUSE_CLI_PATHcan retarget the plugins root;--plugins-diris parsed too late. Both the configured root and the~/.deckhouse-clifallback are searched (layout.ResolveInstalled).delivery-kitandpackagesatisfy a plugin's dependency on that name while they ship as built-ins; a name an installed plugin took over drops off that list so the real plugin satisfies it, version constraints included.NewDeliveryCommandused to return the process-wide graceful-termination context thatExecuteruns on. It is nowcommands.NewRootContext(), established before any command is built — otherwise a plugin servingdelivery-kitwould take the whole termination path down with it.d8 mirror: the platform brings its pluginsMirroring the platform now also mirrors
packageandsystem— unconditionally, with no module pairing and regardless of--include-plugin. A bundle without them can install the platform but not operate it. This is a newReasonPlatformprovenance alongside the existing module/dependency/explicit ones, and the pull summary gets aplatformgroup that leads the module groups.The selected version still has to be one the mirrored platform can run: the contract's
deckhouseconstraint is checked like anywhere else. A registry that does not publish these plugins, or denies access to them, produces a warning rather than a failed pull — older registries predate them, and the platform itself mirrored fine.Dependencies named after a built-in d8 command are now mirrored too when the registry publishes them.
packagedepends ondelivery-kit, and previously that dependency was short-circuited ("there is a built-in command, nothing to pull") and the plugin never entered the bundle. An air-gapped cluster cannot fetch it later, and once installed the plugin takes the command over, so the pull is attempted first and the built-in is only the fallback: when the plugin is not published, the dependency is still satisfied and only a note is recorded, so a dependent is never dropped over it.installabsorbsupdated8 dist plugins updateis gone, with no deprecation shim. Installing a plugin that is already present updates it, which is whatupdate <name>already did — it called the sameInstallPlugin. The one capability worth keeping was bulk update:--allis a flag rather than a subcommand, so a plugin literally namedallstays reachable. It rejects a plugin name,--versionand--use-major— those pin a single plugin and cannot mean anything across a set — and accepts--force, which applies uniformly. The oldupdate allsilently ignored those flags.Two transports, with different capabilities
The plugin subsystem reaches the registry over
TransportRPP(the in-cluster proxy, default) orTransportRegistry(direct, via the hidden legacy--source). Both implementpluginSourceand report which they are, so messages can name the transport.They differ in exactly one capability, now expressed as a separate
pluginCataloginterface: enumerating the published plugins. Only the registry transport has it. The proxy cannot serve it — its allowlist (isAllowedCLIImagePathin the Deckhouse repo) admitsdeckhouse-clianddeckhouse-cli/plugins/<name>and explicitly refuses the baredeckhouse-cli/pluginspath, which is where the plugin-name tags live.rppPluginSourcetherefore does not implementpluginCatalogand the request is never made;AvailablePluginsreturnsErrCatalogUnsupportednaming the transport.listshows both halvesd8 dist plugins listnow prints the plugins installed on disk and, when the transport can enumerate them, those published in the registry and ready to install. Everything that cannot be resolved is reported in place rather than dropped:No plugins found in the registry;versions unavailable;no versions found;listalso got its ownPersistentPreRunE: the parent hook madeInitPluginServicesfatal for every subcommand, so an unreachable cluster used to suppress the installed list too, even though it is read straight from disk.versionscollapses per-platform tagsA release is published as a multi-platform index plus one tag per platform, so the listing repeated every version four or five times. They are now collapsed into one line per release with the platforms alongside:
The platform is read as a suffix of the semver prerelease, not as the whole of it, so a release that is itself a pre-release keeps its identity:
v0.0.1-test-linux-amd64collapses ontov0.0.1-test, not ontov0.0.1. Detection requires both halves to be a real GOOS/GOARCH pair, sov2.0.0-rc.1is never mistaken for a platform.Also
d8 dist pluginsis no longer hidden fromd8 dist --help.layout.InstalledNames/ResolveInstallRootreplace three copies of the "walk the plugins root forcurrentsymlinks" loop, and are the reason the override finds installs in the~/.deckhouse-clifallback.NewPluginCommandtakes options (WithInstallRoot), closing an existing TODO.Breaking changes
d8 dist plugins updateis removed. Scripts using it must switch tod8 dist plugins install <name>orinstall --all. No shim, no deprecation period.DECKHOUSE_PLUGINS_ENABLEDis removed. It gated only whetherd8 systemwas the built-in or a plugin shim; that is now decided by whether asystemplugin is installed.Known limitation
The published-plugins half of
d8 dist plugins listdoes not work over the proxy today: the allowlist refuses the plugins-repository path (a 404, not a 403). The CLI side is complete and degrades honestly; enabling it needs a one-line change toisAllowedCLIImagePathin the Deckhouse repo, plus a proxy release. Direct registry access (--source) enumerates today.