mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Merge pull request #120291 from lzhecheng/fix-credentialprovider-win-bin-path
Fix Windows credential provider cannot find binary
This commit is contained in:
commit
2efed1f1cb
@ -98,8 +98,10 @@ func RegisterCredentialProviderPlugins(pluginConfigFile, pluginBinDir string) er
|
|||||||
registerMetrics()
|
registerMetrics()
|
||||||
|
|
||||||
for _, provider := range credentialProviderConfig.Providers {
|
for _, provider := range credentialProviderConfig.Providers {
|
||||||
pluginBin := filepath.Join(pluginBinDir, provider.Name)
|
// Considering Windows binary with suffix ".exe", LookPath() helps to find the correct path.
|
||||||
if _, err := os.Stat(pluginBin); err != nil {
|
// LookPath() also calls os.Stat().
|
||||||
|
pluginBin, err := exec.LookPath(filepath.Join(pluginBinDir, provider.Name))
|
||||||
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return fmt.Errorf("plugin binary executable %s did not exist", pluginBin)
|
return fmt.Errorf("plugin binary executable %s did not exist", pluginBin)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user