mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
Fix Windows credential provider cannot find binary
Windows credential provider binary path may have ".exe" suffix so it is better to use LookPath() to support it flexibly. Signed-off-by: Zhecheng Li <zhechengli@microsoft.com>
This commit is contained in:
parent
6e0cb243d5
commit
61023579c1
@ -98,8 +98,10 @@ func RegisterCredentialProviderPlugins(pluginConfigFile, pluginBinDir string) er
|
||||
registerMetrics()
|
||||
|
||||
for _, provider := range credentialProviderConfig.Providers {
|
||||
pluginBin := filepath.Join(pluginBinDir, provider.Name)
|
||||
if _, err := os.Stat(pluginBin); err != nil {
|
||||
// Considering Windows binary with suffix ".exe", LookPath() helps to find the correct path.
|
||||
// LookPath() also calls os.Stat().
|
||||
pluginBin, err := exec.LookPath(filepath.Join(pluginBinDir, provider.Name))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return fmt.Errorf("plugin binary executable %s did not exist", pluginBin)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user