ceph: run osd initContainer in priv mode

To access a special block device the container must run privileged.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2020-03-11 19:33:14 +01:00
1 parent 14cb46ae39
commit 723671f58c
1 file changed
+11 -8
+11 -8
View File
@@ -534,11 +534,6 @@ func (c *Cluster) getActivateOSDInitContainer(osdID string, osdInfo OSDInfo, osd
volMounts = append(volMounts, getPvcOSDBridgeMount(osdProps.pvc.ClaimName))
}
privileged := true
securityContext := &v1.SecurityContext{
Privileged: &privileged,
}
container := &v1.Container{
Command: []string{
"/bin/bash",
@@ -548,7 +543,7 @@ func (c *Cluster) getActivateOSDInitContainer(osdID string, osdInfo OSDInfo, osd
Name: "activate",
Image: c.cephVersion.Image,
VolumeMounts: volMounts,
SecurityContext: securityContext,
SecurityContext: privilegedContext(),
Env: envVars,
Resources: osdProps.resources,
}
@@ -747,7 +742,7 @@ func (c *Cluster) getActivatePVCInitContainer(osdProps osdProperties, osdID stri
},
},
VolumeMounts: []v1.VolumeMount{getPvcOSDBridgeMountActivate(osdDataPath, osdProps.pvc.ClaimName)},
SecurityContext: opmon.PodSecurityContext(),
SecurityContext: privilegedContext(),
Resources: osdProps.resources,
}
@@ -765,7 +760,7 @@ func (c *Cluster) getExpandPVCInitContainer(osdProps osdProperties, osdID string
},
Args: []string{"bluefs-bdev-expand", "--path", osdDataPath},
VolumeMounts: []v1.VolumeMount{getPvcOSDBridgeMountActivate(osdDataPath, osdProps.pvc.ClaimName)},
SecurityContext: opmon.PodSecurityContext(),
SecurityContext: privilegedContext(),
Resources: osdProps.resources,
}
@@ -1133,3 +1128,11 @@ func getUdevVolume() (v1.Volume, v1.VolumeMount) {
return volume, volumeMounts
}
func privilegedContext() *v1.SecurityContext {
privileged := true
return &v1.SecurityContext{
Privileged: &privileged,
}
}