generic ephemeral volumes: drop ReadOnly field

As discussed during the alpha review, the ReadOnly field is not really
needed because volume mounts can also be read-only. It's a historical
oddity that can be avoided for generic ephemeral volumes as part
of the promotion to beta.
This commit is contained in:
Patrick Ohly 2021-03-03 17:16:13 +01:00
parent dcce753eda
commit 555d4a12bf
6 changed files with 4 additions and 15 deletions

View File

@ -1720,11 +1720,6 @@ type EphemeralVolumeSource struct {
//
// Required, must not be nil.
VolumeClaimTemplate *PersistentVolumeClaimTemplate
// ReadOnly specifies a read-only configuration for the volume.
// Defaults to false (read/write).
// +optional
ReadOnly bool
}
// PersistentVolumeClaimTemplate is used to produce

View File

@ -48,7 +48,6 @@ func CreateVolumeSpec(podVolume v1.Volume, pod *v1.Pod, nodeName types.NodeName,
}
if ephemeralSource := podVolume.VolumeSource.Ephemeral; ephemeralSource != nil && utilfeature.DefaultFeatureGate.Enabled(features.GenericEphemeralVolume) {
claimName = pod.Name + "-" + podVolume.Name
readOnly = ephemeralSource.ReadOnly
}
if claimName != "" {
klog.V(10).Infof(

View File

@ -530,7 +530,6 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
// owned by the pod.
pvcSource = &v1.PersistentVolumeClaimVolumeSource{
ClaimName: pod.Name + "-" + podVolume.Name,
ReadOnly: podVolume.VolumeSource.Ephemeral.ReadOnly,
}
ephemeral = true
}

View File

@ -1798,10 +1798,8 @@ type EphemeralVolumeSource struct {
// Required, must not be nil.
VolumeClaimTemplate *PersistentVolumeClaimTemplate `json:"volumeClaimTemplate,omitempty" protobuf:"bytes,1,opt,name=volumeClaimTemplate"`
// Specifies a read-only configuration for the volume.
// Defaults to false (read/write).
// +optional
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"`
// ReadOnly is tombstoned to show why 2 is a reserved protobuf tag.
// ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"`
}
// PersistentVolumeClaimTemplate is used to produce

View File

@ -1072,7 +1072,6 @@ func printEphemeralVolumeSource(ephemeral *corev1.EphemeralVolumeSource, w Prefi
Spec: ephemeral.VolumeClaimTemplate.Spec,
}, false /* not a full PVC */)
}
w.Write(LEVEL_2, "ReadOnly:\t%v\n", ephemeral.ReadOnly)
}
func printRBDVolumeSource(rbd *corev1.RBDVolumeSource, w PrefixWriter) {

View File

@ -109,7 +109,7 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern Test
driverVolumeSizeRange := dDriver.GetDriverInfo().SupportedSizeRange
claimSize, err := storageutils.GetSizeRangesIntersection(testVolumeSizeRange, driverVolumeSizeRange)
framework.ExpectNoError(err, "determine intersection of test size range %+v and driver size range %+v", testVolumeSizeRange, driverVolumeSizeRange)
r.VolSource = createEphemeralVolumeSource(r.Sc.Name, dInfo.RequiredAccessModes, claimSize, false /* readOnly */)
r.VolSource = createEphemeralVolumeSource(r.Sc.Name, dInfo.RequiredAccessModes, claimSize)
}
}
case CSIInlineVolume:
@ -134,7 +134,7 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern Test
return &r
}
func createEphemeralVolumeSource(scName string, accessModes []v1.PersistentVolumeAccessMode, claimSize string, readOnly bool) *v1.VolumeSource {
func createEphemeralVolumeSource(scName string, accessModes []v1.PersistentVolumeAccessMode, claimSize string) *v1.VolumeSource {
if len(accessModes) == 0 {
accessModes = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}
}
@ -151,7 +151,6 @@ func createEphemeralVolumeSource(scName string, accessModes []v1.PersistentVolum
},
},
},
ReadOnly: readOnly,
},
}
}