[deckhouse-cli] Push CLI plugins to the registry root above the edition - #451
Draft
Glitchy-Sheep wants to merge 2 commits into
Draft
[deckhouse-cli] Push CLI plugins to the registry root above the edition#451Glitchy-Sheep wants to merge 2 commits into
Glitchy-Sheep wants to merge 2 commits into
Conversation
d8 CLI artifacts are published once for all editions, at the registry root above the edition segment. Pull already reads plugins from there, and the in-cluster registry-packages-proxy looks them up there by cutting the edition off the cluster's imagesRepo. Push was the only side gluing every bundle segment onto the target as typed, so a push to REGISTRY/dkp/ee left plugins at REGISTRY/dkp/ee/deckhouse-cli/plugins while the cluster looked one level up: d8 plugins install could not find them in an air-gapped registry. Push now writes the deckhouse-cli/ part of the bundle, images and the catalog discovery tags alike, to the target minus its trailing edition segment. A target without an edition is used as is. Platform, modules, packages, installer and security databases stay under the target as before. The push log names the plugins path before the first write there, and a denied write above the target no longer surfaces as a bare 401/403: the diagnostic says which repository was refused, which target it sits above and which edition was cut off. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
…s-proxy Plugins are downloaded over /v1/images/, and kube-rbac-proxy authorizes that whole prefix through the deployments/cli-binary subresource, granted by the ClusterRole d8:registry-packages-proxy:cli-download. The 403 diagnostic named packages-download instead. That role covers /v1/packages/, which the CLI never calls, so a user who followed the advice bound the role and still got 403. The same suggestion told the user to wait about 5 minutes and retry with a fresh token. kube-rbac-proxy caches a denial for about 30 seconds, and the existing token keeps working, so both halves of that hint were wrong. The d8 dist copy of the diagnostic carried the same wrong hint and is fixed too. Signed-off-by: Roman Berezkin <roman.berezkin@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.
Summary
d8 CLI plugins belong one level above the edition segment of the push target. Pull already reads them there, and the in-cluster registry-packages-proxy will look for them there. Push was the only side that put them somewhere else.
Problem
REGISTRY/dkp/eeREGISTRY/dkp/ee/deckhouse-cli/pluginsimagesRepoand readsREGISTRY/dkp/deckhouse-cli/pluginsd8 plugins install <name>in an air-gapped cluster did not find the pluginFix
deckhouse-cli/part of the bundle goes to the target minus its trailing edition segmentregistry.company.com/deckhouse, is used as is--modules-path-suffixcannot move modules above the editionBefore / After
Before:
d8 mirror push ./bundle REGISTRY/dkp/eewrote plugins toREGISTRY/dkp/ee/deckhouse-cli/plugins, where the cluster never looks.After: the same command writes them to
REGISTRY/dkp/deckhouse-cli/plugins, andd8 plugins installfinds them.Tests
TestPluginsRootPath- the root rule itself, including the targets where nothing is cutTestPushService_PluginsGoToRootAboveEdition- seven target shapes: with edition,se-plus, trailing slash, no edition, nested path, edition not at the endTestPushService_PluginLayoutIsNotPlatform- a bundle with only a plugin is not counted as platformTestPushService_ModulesPathSuffixIntoPluginsNamespace---modules-path-suffix deckhouse-clikeeps modules under the targetTestPushService_PluginsRootDenied,TestPushService_PluginsRootDenied_LayoutPush- a refused write above the target keeps the HTTP status and names the pathsTestDiagnose_PluginsRootDenied,TestDiagnose_PluginsRootNonAuthFallsThrough- the 401/403 diagnostic names the paths, other errors keep their own categoryTestPullE2E_RoundTrip_PullThenPushPlugins- pull, pack, push: plugins land at the root, modules stay under the editionChecked by hand against two local registries: the same bundle pushed by the old and the new binary, then
d8 cr catalog,d8 cr lsandd8 cr digeston both.Also in this PR
A second, small fix in the same area: the 403 diagnostic for
d8 dist pluginsnamed the wrong ClusterRole./v1/images/, which kube-rbac-proxy authorizes through thedeployments/cli-binarysubresourced8:registry-packages-proxy:cli-downloadpackages-download, which covers/v1/packages/and is never called by the CLI, so following it left the user with the same 403d8 distcopy of the diagnostic tooTestDiagnoseininternal/plugins/cmd/errdetectnow pinscli-downloadThe mapping comes from
modules/039-registry-packages-proxy/templates/deployment.yamlin deckhouse.Notes
cseis not an edition here, while the proxy patch treats it as one. CSE mirrors keep plugins underdeckhouse/csefor now<root>/deckhouse-clishows up at the first plugin write, after the rest of the bundle is uploaded