mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Kubelet:rkt Fix the hostPath Volume creation
Kubelet:rkt Fix the hostPath Volume creation
This commit is contained in:
parent
a9019fe14a
commit
edc4ccd660
@ -1319,11 +1319,14 @@ func (r *Runtime) setupPodNetwork(pod *v1.Pod) (string, string, error) {
|
|||||||
func createHostPathVolumes(pod *v1.Pod) (err error) {
|
func createHostPathVolumes(pod *v1.Pod) (err error) {
|
||||||
for _, v := range pod.Spec.Volumes {
|
for _, v := range pod.Spec.Volumes {
|
||||||
if v.VolumeSource.HostPath != nil {
|
if v.VolumeSource.HostPath != nil {
|
||||||
err = os.MkdirAll(v.HostPath.Path, os.ModePerm)
|
_, err = os.Stat(v.HostPath.Path)
|
||||||
if err != nil && !os.IsExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return err
|
if err = os.MkdirAll(v.HostPath.Path, os.ModePerm); err != nil {
|
||||||
|
glog.Errorf("Create volume HostPath %q for Pod %q failed: %q", v.HostPath.Path, format.Pod(pod), err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
glog.V(4).Infof("Created volume HostPath %q for Pod %q", v.HostPath.Path, format.Pod(pod))
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Created volume HostPath %q for Pod %q", v.HostPath.Path, format.Pod(pod))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user