mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-23 12:29:01 +00:00
Add CSIDriverSpec.SELinuxMount
The new field tells Kubernetes if the CSI driver supports mounting of volumes with -o context=XYZ or not.
This commit is contained in:
@@ -122,3 +122,30 @@ func TestSetDefaultCSIDriver(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetDefaultSELinuxMountReadWriteOncePodEnabled(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.SELinuxMountReadWriteOncePod, true)()
|
||||
driver := &storagev1.CSIDriver{}
|
||||
|
||||
// field should be defaulted
|
||||
defaultSELinuxMount := false
|
||||
output := roundTrip(t, runtime.Object(driver)).(*storagev1.CSIDriver)
|
||||
outSELinuxMount := output.Spec.SELinuxMount
|
||||
if outSELinuxMount == nil {
|
||||
t.Errorf("Expected SELinuxMount to be defaulted to: %+v, got: nil", defaultSELinuxMount)
|
||||
} else if *outSELinuxMount != defaultSELinuxMount {
|
||||
t.Errorf("Expected SELinuxMount to be defaulted to: %+v, got: %+v", defaultSELinuxMount, outSELinuxMount)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetDefaultSELinuxMountReadWriteOncePodDisabled(t *testing.T) {
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.SELinuxMountReadWriteOncePod, false)()
|
||||
driver := &storagev1.CSIDriver{}
|
||||
|
||||
// field should not be defaulted
|
||||
output := roundTrip(t, runtime.Object(driver)).(*storagev1.CSIDriver)
|
||||
outSELinuxMount := output.Spec.SELinuxMount
|
||||
if outSELinuxMount != nil {
|
||||
t.Errorf("Expected SELinuxMount to remain nil, got: %+v", outSELinuxMount)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user