New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconstruct SELinux mount label #113596
Reconstruct SELinux mount label #113596
Changes from 2 commits
e575e60
cf912a2
802979c
d6c3673
167d27a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,7 @@ func (rc *reconciler) updateStatesNew(reconstructedVolumes map[v1.UniqueVolumeNa | |
klog.ErrorS(err, "Could not add volume information to actual state of world", "volumeName", gvl.volumeName) | ||
continue | ||
} | ||
var seLinuxMountContext string | ||
for _, volume := range gvl.podVolumes { | ||
markVolumeOpts := operationexecutor.MarkVolumeOpts{ | ||
PodName: volume.podName, | ||
|
@@ -123,14 +124,16 @@ func (rc *reconciler) updateStatesNew(reconstructedVolumes map[v1.UniqueVolumeNa | |
VolumeGidVolume: volume.volumeGidValue, | ||
VolumeSpec: volume.volumeSpec, | ||
VolumeMountState: operationexecutor.VolumeMountUncertain, | ||
SELinuxMountContext: volume.seLinuxMountContext, | ||
} | ||
|
||
_, err = rc.actualStateOfWorld.CheckAndMarkVolumeAsUncertainViaReconstruction(markVolumeOpts) | ||
if err != nil { | ||
klog.ErrorS(err, "Could not add pod to volume information to actual state of world", "pod", klog.KObj(volume.pod)) | ||
continue | ||
} | ||
klog.V(2).InfoS("Volume is marked as uncertain and added into the actual state", "pod", klog.KObj(volume.pod), "podName", volume.podName, "volumeName", volume.volumeName) | ||
seLinuxMountContext = volume.seLinuxMountContext | ||
klog.V(2).InfoS("Volume is marked as uncertain and added into the actual state", "pod", klog.KObj(volume.pod), "podName", volume.podName, "volumeName", volume.volumeName, "seLinuxMountContext", volume.seLinuxMountContext) | ||
} | ||
// If the volume has device to mount, we mark its device as uncertain. | ||
if gvl.deviceMounter != nil || gvl.blockVolumeMapper != nil { | ||
|
@@ -139,7 +142,7 @@ func (rc *reconciler) updateStatesNew(reconstructedVolumes map[v1.UniqueVolumeNa | |
klog.ErrorS(err, "Could not find device mount path for volume", "volumeName", gvl.volumeName) | ||
continue | ||
} | ||
err = rc.actualStateOfWorld.MarkDeviceAsUncertain(gvl.volumeName, gvl.devicePath, deviceMountPath, "") | ||
err = rc.actualStateOfWorld.MarkDeviceAsUncertain(gvl.volumeName, gvl.devicePath, deviceMountPath, seLinuxMountContext) | ||
if err != nil { | ||
klog.ErrorS(err, "Could not mark device is uncertain to actual state of world", "volumeName", gvl.volumeName, "deviceMountPath", deviceMountPath) | ||
continue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am trying to verify(and I forgot some details), but is staging (ie. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They create different jsons and I think SELinux is only in the SetUp one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see it other way around - only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correction: it was in MountDevice, I added it to both + both feature-gated. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have tests that verify if selinux information is recorded as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test added