Skip to content

Commit

Permalink
feat(develop): lvscare需要挂载/lib/modules labring#312
Browse files Browse the repository at this point in the history
  • Loading branch information
cuisongliu committed Apr 14, 2020
1 parent 035b452 commit 6d67409
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ipvs/lvscare.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ func podToYaml(pod v1.Pod) ([]byte, error) {

// componentPod returns a Pod object from the container and volume specifications
func componentPod(container v1.Container) v1.Pod {
hostPathType := v1.HostPathUnset
mountName := "lib-modules"
volumes := []v1.Volume{
{Name: mountName, VolumeSource: v1.VolumeSource{
HostPath: &v1.HostPathVolumeSource{
Path: "/lib/modules",
Type: &hostPathType,
},
}},
}
container.VolumeMounts = []v1.VolumeMount{
{Name: mountName, ReadOnly: true, MountPath: "/lib/modules"},
}

return v1.Pod{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1",
Expand All @@ -76,6 +90,7 @@ func componentPod(container v1.Container) v1.Pod {
Containers: []v1.Container{container},
PriorityClassName: "system-cluster-critical",
HostNetwork: true,
Volumes: volumes,
},
}
}
9 changes: 9 additions & 0 deletions ipvs/lvscare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@ spec:
resources: {}
securityContext:
privileged: true
volumeMounts:
- mountPath: /lib/modules
name: lib-modules
readOnly: true
hostNetwork: true
priorityClassName: system-cluster-critical
volumes:
- hostPath:
path: /lib/modules
type: ""
name: lib-modules
status: {}
`,
}
Expand Down

0 comments on commit 6d67409

Please sign in to comment.