mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +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()
|
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