Skip to content

Commit

Permalink
Merge pull request #187 from JimmyYang20/fl
Browse files Browse the repository at this point in the history
GM: fix the bug of injecting hostpath mount
  • Loading branch information
kubeedge-bot authored Sep 8, 2021
2 parents 938326a + c21f619 commit e61f6f8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions pkg/globalmanager/runtime/storage_initializer_injector.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ func injectHostPathMount(pod *v1.Pod, workerParam *WorkerParam) {
var initContainerVolumeMounts []v1.VolumeMount

uniqVolumeName := make(map[string]bool)
uniqMountPath := make(map[string]bool)

hostPathType := v1.HostPathDirectory

Expand Down Expand Up @@ -205,14 +206,18 @@ func injectHostPathMount(pod *v1.Pod, workerParam *WorkerParam) {
uniqVolumeName[volumeName] = true
}

vm := v1.VolumeMount{
MountPath: m.MountPath,
Name: volumeName,
}
if m.Indirect {
initContainerVolumeMounts = append(initContainerVolumeMounts, vm)
} else {
volumeMounts = append(volumeMounts, vm)
if _, ok := uniqMountPath[m.MountPath]; !ok {
vm := v1.VolumeMount{
MountPath: m.MountPath,
Name: volumeName,
}

if m.Indirect {
initContainerVolumeMounts = append(initContainerVolumeMounts, vm)
} else {
volumeMounts = append(volumeMounts, vm)
}
uniqMountPath[m.MountPath] = true
}
}
}
Expand Down Expand Up @@ -329,6 +334,7 @@ func injectInitializerContainer(pod *v1.Pod, workerParam *WorkerParam) {
Limits: map[v1.ResourceName]resource.Quantity{
// limit one cpu
v1.ResourceCPU: resource.MustParse("1"),

// limit 1Gi memory
v1.ResourceMemory: resource.MustParse("1Gi"),
},
Expand Down

0 comments on commit e61f6f8

Please sign in to comment.