mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
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:
parent
dcce753eda
commit
555d4a12bf
@ -1720,11 +1720,6 @@ type EphemeralVolumeSource struct {
|
|||||||
//
|
//
|
||||||
// Required, must not be nil.
|
// Required, must not be nil.
|
||||||
VolumeClaimTemplate *PersistentVolumeClaimTemplate
|
VolumeClaimTemplate *PersistentVolumeClaimTemplate
|
||||||
|
|
||||||
// ReadOnly specifies a read-only configuration for the volume.
|
|
||||||
// Defaults to false (read/write).
|
|
||||||
// +optional
|
|
||||||
ReadOnly bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PersistentVolumeClaimTemplate is used to produce
|
// PersistentVolumeClaimTemplate is used to produce
|
||||||
|
@ -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) {
|
if ephemeralSource := podVolume.VolumeSource.Ephemeral; ephemeralSource != nil && utilfeature.DefaultFeatureGate.Enabled(features.GenericEphemeralVolume) {
|
||||||
claimName = pod.Name + "-" + podVolume.Name
|
claimName = pod.Name + "-" + podVolume.Name
|
||||||
readOnly = ephemeralSource.ReadOnly
|
|
||||||
}
|
}
|
||||||
if claimName != "" {
|
if claimName != "" {
|
||||||
klog.V(10).Infof(
|
klog.V(10).Infof(
|
||||||
|
@ -530,7 +530,6 @@ func (dswp *desiredStateOfWorldPopulator) createVolumeSpec(
|
|||||||
// owned by the pod.
|
// owned by the pod.
|
||||||
pvcSource = &v1.PersistentVolumeClaimVolumeSource{
|
pvcSource = &v1.PersistentVolumeClaimVolumeSource{
|
||||||
ClaimName: pod.Name + "-" + podVolume.Name,
|
ClaimName: pod.Name + "-" + podVolume.Name,
|
||||||
ReadOnly: podVolume.VolumeSource.Ephemeral.ReadOnly,
|
|
||||||
}
|
}
|
||||||
ephemeral = true
|
ephemeral = true
|
||||||
}
|
}
|
||||||
|
@ -1798,10 +1798,8 @@ type EphemeralVolumeSource struct {
|
|||||||
// Required, must not be nil.
|
// Required, must not be nil.
|
||||||
VolumeClaimTemplate *PersistentVolumeClaimTemplate `json:"volumeClaimTemplate,omitempty" protobuf:"bytes,1,opt,name=volumeClaimTemplate"`
|
VolumeClaimTemplate *PersistentVolumeClaimTemplate `json:"volumeClaimTemplate,omitempty" protobuf:"bytes,1,opt,name=volumeClaimTemplate"`
|
||||||
|
|
||||||
// Specifies a read-only configuration for the volume.
|
// ReadOnly is tombstoned to show why 2 is a reserved protobuf tag.
|
||||||
// Defaults to false (read/write).
|
// ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"`
|
||||||
// +optional
|
|
||||||
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PersistentVolumeClaimTemplate is used to produce
|
// PersistentVolumeClaimTemplate is used to produce
|
||||||
|
@ -1072,7 +1072,6 @@ func printEphemeralVolumeSource(ephemeral *corev1.EphemeralVolumeSource, w Prefi
|
|||||||
Spec: ephemeral.VolumeClaimTemplate.Spec,
|
Spec: ephemeral.VolumeClaimTemplate.Spec,
|
||||||
}, false /* not a full PVC */)
|
}, false /* not a full PVC */)
|
||||||
}
|
}
|
||||||
w.Write(LEVEL_2, "ReadOnly:\t%v\n", ephemeral.ReadOnly)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func printRBDVolumeSource(rbd *corev1.RBDVolumeSource, w PrefixWriter) {
|
func printRBDVolumeSource(rbd *corev1.RBDVolumeSource, w PrefixWriter) {
|
||||||
|
@ -109,7 +109,7 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern Test
|
|||||||
driverVolumeSizeRange := dDriver.GetDriverInfo().SupportedSizeRange
|
driverVolumeSizeRange := dDriver.GetDriverInfo().SupportedSizeRange
|
||||||
claimSize, err := storageutils.GetSizeRangesIntersection(testVolumeSizeRange, driverVolumeSizeRange)
|
claimSize, err := storageutils.GetSizeRangesIntersection(testVolumeSizeRange, driverVolumeSizeRange)
|
||||||
framework.ExpectNoError(err, "determine intersection of test size range %+v and driver size range %+v", 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:
|
case CSIInlineVolume:
|
||||||
@ -134,7 +134,7 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern Test
|
|||||||
return &r
|
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 {
|
if len(accessModes) == 0 {
|
||||||
accessModes = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}
|
accessModes = []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}
|
||||||
}
|
}
|
||||||
@ -151,7 +151,6 @@ func createEphemeralVolumeSource(scName string, accessModes []v1.PersistentVolum
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ReadOnly: readOnly,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user