Skip to content

kubectl plugin list does not detect overshadowed plugins on Windows #1821

@kfess

Description

@kfess

What happened:

kubectl plugin list fails to detect overshadowed plugins on Windows because plugin binary names are extracted using strings.Split(path, "/"), which does not recognize \ as a path separator.

What you expected to happen:

kubectl plugin list should correctly detect overshadowed plugins regardless of OS.

How to reproduce it (as minimally and precisely as possible):

  1. On Windows, place two plugins with the same name in different directories in PATH:
    • C:\path1\kubectl-foo.exe
    • C:\path2\kubectl-foo.exe
  2. kubectl plugin list
  3. No overshadow warning is shown

Anything else we need to know?:

The issue is in staging/src/k8s.io/kubectl/pkg/cmd/plugin/plugin.go:

segs := strings.Split(path, "/")
binName := segs[len(segs)-1]

This should be replaced with OS-independent method.

Environment:

  • OS: Windows

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.sig/cliCategorizes an issue or PR as relevant to SIG CLI.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions