mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 10:18:13 +00:00 
			
		
		
		
	Don't attempt to make and chmod subPath if it already exists
This commit is contained in:
		| @@ -58,6 +58,7 @@ import ( | ||||
| 	"k8s.io/kubernetes/pkg/kubelet/status" | ||||
| 	kubetypes "k8s.io/kubernetes/pkg/kubelet/types" | ||||
| 	"k8s.io/kubernetes/pkg/kubelet/util/format" | ||||
| 	"k8s.io/kubernetes/pkg/util" | ||||
| 	"k8s.io/kubernetes/pkg/volume" | ||||
| 	"k8s.io/kubernetes/pkg/volume/util/volumehelper" | ||||
| 	"k8s.io/kubernetes/third_party/forked/golang/expansion" | ||||
| @@ -145,6 +146,9 @@ func makeMounts(pod *v1.Pod, podDir string, container *v1.Container, hostName, h | ||||
|  | ||||
| 			hostPath = filepath.Join(hostPath, mount.SubPath) | ||||
|  | ||||
| 			if subPathExists, err := util.FileExists(hostPath); err != nil { | ||||
| 				glog.Errorf("Could not determine if subPath %s exists; will not attempt to change its permissions", hostPath) | ||||
| 			} else if !subPathExists { | ||||
| 				// Create the sub path now because if it's auto-created later when referenced, it may have an | ||||
| 				// incorrect ownership and mode. For example, the sub path directory must have at least g+rwx | ||||
| 				// when the pod specifies an fsGroup, and if the directory is not created here, Docker will | ||||
| @@ -160,6 +164,7 @@ func makeMounts(pod *v1.Pod, podDir string, container *v1.Container, hostName, h | ||||
| 					return nil, err | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		// Docker Volume Mounts fail on Windows if it is not of the form C:/ | ||||
| 		containerPath := mount.MountPath | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Matthew Wong
					Matthew Wong