mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Merge pull request #58209 from NickrenREN/csi-fstype
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add FSType for CSI volume source **What this PR does / why we need it**: Add FSType for CSI volume source to specify filesystems (alpha defaults to `ext4`) **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #58183 **Special notes for your reviewer**: **Release note**: ```release-note Add FSType for CSI volume source to specify filesystems ``` /assign @saad-ali cc @vladimirvivien
This commit is contained in:
commit
8cc5ccfb49
4
api/openapi-spec/swagger.json
generated
4
api/openapi-spec/swagger.json
generated
@ -74526,6 +74526,10 @@
|
|||||||
"description": "Driver is the name of the driver to use for this volume. Required.",
|
"description": "Driver is the name of the driver to use for this volume. Required.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"fsType": {
|
||||||
|
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"readOnly": {
|
"readOnly": {
|
||||||
"description": "Optional: The value to pass to ControllerPublishVolumeRequest. Defaults to false (read/write).",
|
"description": "Optional: The value to pass to ControllerPublishVolumeRequest. Defaults to false (read/write).",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
4
api/swagger-spec/v1.json
generated
4
api/swagger-spec/v1.json
generated
@ -21320,6 +21320,10 @@
|
|||||||
"readOnly": {
|
"readOnly": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Optional: The value to pass to ControllerPublishVolumeRequest. Defaults to false (read/write)."
|
"description": "Optional: The value to pass to ControllerPublishVolumeRequest. Defaults to false (read/write)."
|
||||||
|
},
|
||||||
|
"fsType": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
7
docs/api-reference/v1/definitions.html
generated
7
docs/api-reference/v1/definitions.html
generated
@ -7857,6 +7857,13 @@ Examples:<br>
|
|||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="tableblock halign-left valign-top"><p class="tableblock">fsType</p></td>
|
||||||
|
<td class="tableblock halign-left valign-top"><p class="tableblock">Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.</p></td>
|
||||||
|
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||||
|
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||||
|
<td class="tableblock halign-left valign-top"></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -1615,6 +1615,12 @@ type CSIPersistentVolumeSource struct {
|
|||||||
// Defaults to false (read/write).
|
// Defaults to false (read/write).
|
||||||
// +optional
|
// +optional
|
||||||
ReadOnly bool
|
ReadOnly bool
|
||||||
|
|
||||||
|
// Filesystem type to mount.
|
||||||
|
// Must be a filesystem type supported by the host operating system.
|
||||||
|
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
|
||||||
|
// +optional
|
||||||
|
FSType string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerPort represents a network port in a single container
|
// ContainerPort represents a network port in a single container
|
||||||
|
2
pkg/apis/core/v1/zz_generated.conversion.go
generated
2
pkg/apis/core/v1/zz_generated.conversion.go
generated
@ -619,6 +619,7 @@ func autoConvert_v1_CSIPersistentVolumeSource_To_core_CSIPersistentVolumeSource(
|
|||||||
out.Driver = in.Driver
|
out.Driver = in.Driver
|
||||||
out.VolumeHandle = in.VolumeHandle
|
out.VolumeHandle = in.VolumeHandle
|
||||||
out.ReadOnly = in.ReadOnly
|
out.ReadOnly = in.ReadOnly
|
||||||
|
out.FSType = in.FSType
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,6 +632,7 @@ func autoConvert_core_CSIPersistentVolumeSource_To_v1_CSIPersistentVolumeSource(
|
|||||||
out.Driver = in.Driver
|
out.Driver = in.Driver
|
||||||
out.VolumeHandle = in.VolumeHandle
|
out.VolumeHandle = in.VolumeHandle
|
||||||
out.ReadOnly = in.ReadOnly
|
out.ReadOnly = in.ReadOnly
|
||||||
|
out.FSType = in.FSType
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/volume/util"
|
"k8s.io/kubernetes/pkg/volume/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const defaultFSType = "ext4"
|
||||||
|
|
||||||
//TODO (vladimirvivien) move this in a central loc later
|
//TODO (vladimirvivien) move this in a central loc later
|
||||||
var (
|
var (
|
||||||
volDataKey = struct {
|
volDataKey = struct {
|
||||||
@ -189,6 +191,11 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
|
|||||||
accessMode = c.spec.PersistentVolume.Spec.AccessModes[0]
|
accessMode = c.spec.PersistentVolume.Spec.AccessModes[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fsType := csiSource.FSType
|
||||||
|
if len(fsType) == 0 {
|
||||||
|
fsType = defaultFSType
|
||||||
|
}
|
||||||
|
|
||||||
err = csi.NodePublishVolume(
|
err = csi.NodePublishVolume(
|
||||||
ctx,
|
ctx,
|
||||||
c.volumeID,
|
c.volumeID,
|
||||||
@ -197,7 +204,7 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
|
|||||||
accessMode,
|
accessMode,
|
||||||
c.volumeInfo,
|
c.volumeInfo,
|
||||||
attribs,
|
attribs,
|
||||||
"ext4", //TODO needs to be sourced from PV or somewhere else
|
fsType,
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
1587
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
1587
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
File diff suppressed because it is too large
Load Diff
@ -185,6 +185,12 @@ message CSIPersistentVolumeSource {
|
|||||||
// Defaults to false (read/write).
|
// Defaults to false (read/write).
|
||||||
// +optional
|
// +optional
|
||||||
optional bool readOnly = 3;
|
optional bool readOnly = 3;
|
||||||
|
|
||||||
|
// Filesystem type to mount.
|
||||||
|
// Must be a filesystem type supported by the host operating system.
|
||||||
|
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
|
||||||
|
// +optional
|
||||||
|
optional string fsType = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds and removes POSIX capabilities from running containers.
|
// Adds and removes POSIX capabilities from running containers.
|
||||||
|
@ -1730,6 +1730,12 @@ type CSIPersistentVolumeSource struct {
|
|||||||
// Defaults to false (read/write).
|
// Defaults to false (read/write).
|
||||||
// +optional
|
// +optional
|
||||||
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
|
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
|
||||||
|
|
||||||
|
// Filesystem type to mount.
|
||||||
|
// Must be a filesystem type supported by the host operating system.
|
||||||
|
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
|
||||||
|
// +optional
|
||||||
|
FSType string `json:"fsType,omitempty" protobuf:"bytes,4,opt,name=fsType"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerPort represents a network port in a single container.
|
// ContainerPort represents a network port in a single container.
|
||||||
|
@ -121,6 +121,7 @@ var map_CSIPersistentVolumeSource = map[string]string{
|
|||||||
"driver": "Driver is the name of the driver to use for this volume. Required.",
|
"driver": "Driver is the name of the driver to use for this volume. Required.",
|
||||||
"volumeHandle": "VolumeHandle is the unique volume name returned by the CSI volume plugin’s CreateVolume to refer to the volume on all subsequent calls. Required.",
|
"volumeHandle": "VolumeHandle is the unique volume name returned by the CSI volume plugin’s CreateVolume to refer to the volume on all subsequent calls. Required.",
|
||||||
"readOnly": "Optional: The value to pass to ControllerPublishVolumeRequest. Defaults to false (read/write).",
|
"readOnly": "Optional: The value to pass to ControllerPublishVolumeRequest. Defaults to false (read/write).",
|
||||||
|
"fsType": "Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (CSIPersistentVolumeSource) SwaggerDoc() map[string]string {
|
func (CSIPersistentVolumeSource) SwaggerDoc() map[string]string {
|
||||||
|
Loading…
Reference in New Issue
Block a user