mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Make secret volumes function correctly across reboot
This commit is contained in:
parent
309a157665
commit
bea1c05057
@ -19,6 +19,7 @@ package secret
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
@ -92,7 +93,16 @@ var wrappedVolumeSpec = &volume.Spec{
|
||||
}
|
||||
|
||||
func (sv *secretVolume) SetUpAt(dir string) error {
|
||||
if volumeutil.IsReady(sv.getMetaDir()) {
|
||||
isMnt, err := sv.mounter.IsMountPoint(dir)
|
||||
// Getting an os.IsNotExist err from is a contingency; the directory
|
||||
// may not exist yet, in which case, setup should run.
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
// If the plugin readiness file is present for this volume and
|
||||
// the setup dir is a mountpoint, this volume is already ready.
|
||||
if volumeutil.IsReady(sv.getMetaDir()) && isMnt {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user