Repository navigation
[deckhouse-cli] Run kubectl plugins from d8 k - #505
Merged
Merged
Conversation
d8 k passed the whole d8 argv to kubectl's plugin lookup, so the "k" word became part of the plugin name: `d8 k argo rollouts get` searched PATH for kubectl-k-argo-rollouts and never found kubectl-argo-rollouts. Since Deckhouse 1.76 nodes alias kubectl to `d8 k`, so every kubectl plugin stopped working there. Drop the "k"/"kubectl" word before the lookup. Every other d8 command now passes no arguments to this lookup, so the d8 k command tree no longer runs kubectl-<name> for `d8 <name>`. Signed-off-by: Yuriy Losev <yuriy.losev@flant.com>
This was referenced Oct 7, 2026
Glitchy-Sheep
approved these changes
Oct 8, 2026
This was referenced Oct 8, 2026
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.
Description
d8 know runs kubectl plugins:d8 k argo rollouts get rollout demorunskubectl-argo-rollouts get rollout demo, the same askubectl argo rollouts get rollout demo. This also works through thekubectlalias that Deckhouse adds on nodes.Why do we need it, and what problem does it solve?
Starting with Deckhouse 1.76, nodes no longer get a separate kubectl binary.
/root/.bashrcaliaseskubectlto/opt/deckhouse/bin/d8 k. With that alias in place, kubectl plugins on the nodes stopped working. A client reported this for the argo-rollouts plugin (/usr/local/bin/kubectl-argo-rollouts).The cause:
d8 kpassed the whole d8 command line to kubectl's plugin lookup. The wordkended up in the plugin name, sod8 k argo rollouts getsearched PATH forkubectl-k-argo-rollouts.Technical details
NewKubectlCommandpasseskubectlPluginArgs(os.Args)to the plugin handler:d8 k argo rollouts getd8 argo rollouts getkubectl-argo-rolloutsd8 kubectl argo rollouts versiond8 argo rollouts versionkubectl-argo-rolloutsd8 k create foo bard8 create foo barkubectl-create-food8 <cmd> ...d8The last row matters. d8 builds the kubectl command tree on every run, so before this change
d8 <name>rankubectl-<name>from PATH for this tree too.The same lookup is also present in the delivery-kit dependency.
github.com/deckhouse/delivery-kit/v2cmd/werf/kubectl/kubectl.gobuilds thed8 dk kubectltree withArguments: os.Args, sod8 hellostill runskubectl-hellowhen that file is in PATH. It is fixed separately in deckhouse/delivery-kit#408 (main, v3) and deckhouse/delivery-kit#409 (2, the v2 line d8 depends on); d8 picks the fix up when it bumps delivery-kit.Clients who added a
kubectl-k-<name>symlink as a workaround need no changes: the original plugin it points to is in PATH and is now found by its own name.What is the expected result?
With
kubectl-argo-rolloutsandkubectl-create-footest scripts in PATH:d8v0.31.0)d8 k argo rollouts get rollout demo -n appkubectl-argo-rollouts get rollout demo -n appd8 kubectl argo rollouts versionkubectl-argo-rollouts versiond8 k create foo barerror: Unexpected args: [foo bar]kubectl-create-foo bard8 k version --clientTests:
go test ./cmd/commands/passes;TestKubectlPluginLookupfails on the old code in all three cases;golangci-lintv2.11.4 on./cmd/commands/reports 0 issues.