Skip to content

Commit

Permalink
api: KEP-3857: Recursive Read-only (RRO) mounts
Browse files Browse the repository at this point in the history
This commit modifies the following files:

- pkg/apis/core/types.go
- staging/src/k8s.io/api/core/v1/types.go

Other changes were auto-generated by running `make update`.

Signed-off-by: Akihiro Suda <[email protected]>

Kubernetes-commit: d940886d0a4ee9aa8a7ca075fee175b002baf883
  • Loading branch information
AkihiroSuda authored and k8s-publishing-bot committed Mar 9, 2024
1 parent 0cf49f5 commit b50824d
Show file tree
Hide file tree
Showing 68 changed files with 2,583 additions and 1,282 deletions.
3,355 changes: 2,087 additions & 1,268 deletions core/v1/generated.pb.go

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions core/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions core/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,26 @@ type VolumeMount struct {
// Defaults to false.
// +optional
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"`
// RecursiveReadOnly specifies whether read-only mounts should be handled
// recursively.
//
// If ReadOnly is false, this field has no meaning and must be unspecified.
//
// If ReadOnly is true, and this field is set to Disabled, the mount is not made
// recursively read-only. If this field is set to IfPossible, the mount is made
// recursively read-only, if it is supported by the container runtime. If this
// field is set to Enabled, the mount is made recursively read-only if it is
// supported by the container runtime, otherwise the pod will not be started and
// an error will be generated to indicate the reason.
//
// If this field is set to IfPossible or Enabled, MountPropagation must be set to
// None (or be unspecified, which defaults to None).
//
// If this field is not specified, it is treated as an equivalent of Disabled.
//
// +featureGate=RecursiveReadOnlyMounts
// +optional
RecursiveReadOnly *RecursiveReadOnlyMode `json:"recursiveReadOnly,omitempty" protobuf:"bytes,7,opt,name=recursiveReadOnly,casttype=RecursiveReadOnlyMode"`
// Path within the container at which the volume should be mounted. Must
// not contain ':'.
MountPath string `json:"mountPath" protobuf:"bytes,3,opt,name=mountPath"`
Expand All @@ -2167,6 +2187,8 @@ type VolumeMount struct {
// to container and the other way around.
// When not set, MountPropagationNone is used.
// This field is beta in 1.10.
// When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified
// (which defaults to None).
// +optional
MountPropagation *MountPropagationMode `json:"mountPropagation,omitempty" protobuf:"bytes,5,opt,name=mountPropagation,casttype=MountPropagationMode"`
// Expanded path within the volume from which the container's volume should be mounted.
Expand Down Expand Up @@ -2203,6 +2225,18 @@ const (
MountPropagationBidirectional MountPropagationMode = "Bidirectional"
)

// RecursiveReadOnlyMode describes recursive-readonly mode.
type RecursiveReadOnlyMode string

const (
// RecursiveReadOnlyDisabled disables recursive-readonly mode.
RecursiveReadOnlyDisabled RecursiveReadOnlyMode = "Disabled"
// RecursiveReadOnlyIfPossible enables recursive-readonly mode if possible.
RecursiveReadOnlyIfPossible RecursiveReadOnlyMode = "IfPossible"
// RecursiveReadOnlyEnabled enables recursive-readonly mode, or raise an error.
RecursiveReadOnlyEnabled RecursiveReadOnlyMode = "Enabled"
)

// volumeDevice describes a mapping of a raw block device within a container.
type VolumeDevice struct {
// name must match the name of a persistentVolumeClaim in the pod
Expand Down Expand Up @@ -2988,6 +3022,14 @@ type ContainerStatus struct {
// +featureGate=InPlacePodVerticalScaling
// +optional
Resources *ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,11,opt,name=resources"`
// Status of volume mounts.
// +optional
// +patchMergeKey=mountPath
// +patchStrategy=merge
// +listType=map
// +listMapKey=mountPath
// +featureGate=RecursiveReadOnlyMounts
VolumeMounts []VolumeMountStatus `json:"volumeMounts,omitempty" patchStrategy:"merge" patchMergeKey:"mountPath" protobuf:"bytes,12,rep,name=volumeMounts"`
}

// PodPhase is a label for the condition of a pod at the current time.
Expand Down Expand Up @@ -3097,6 +3139,23 @@ const (
PodResizeStatusInfeasible PodResizeStatus = "Infeasible"
)

// VolumeMountStatus shows status of volume mounts.
type VolumeMountStatus struct {
// Name corresponds to the name of the original VolumeMount.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// MountPath corresponds to the original VolumeMount.
MountPath string `json:"mountPath" protobuf:"bytes,2,opt,name=mountPath"`
// ReadOnly corresponds to the original VolumeMount.
// +optional
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
// RecursiveReadOnly must be set to Disabled, Enabled, or unspecified (for non-readonly mounts).
// An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled,
// depending on the mount result.
// +featureGate=RecursiveReadOnlyMounts
// +optional
RecursiveReadOnly *RecursiveReadOnlyMode `json:"recursiveReadOnly,omitempty" protobuf:"bytes,4,opt,name=recursiveReadOnly,casttype=RecursiveReadOnlyMode"`
}

// RestartPolicy describes how the container should be restarted.
// Only one of the following restart policies may be specified.
// If none of the following policies is specified, the default one
Expand Down Expand Up @@ -5710,6 +5769,26 @@ type NodeDaemonEndpoints struct {
KubeletEndpoint DaemonEndpoint `json:"kubeletEndpoint,omitempty" protobuf:"bytes,1,opt,name=kubeletEndpoint"`
}

// NodeRuntimeClassFeatures is a set of runtime features.
type NodeRuntimeClassFeatures struct {
// RecursiveReadOnlyMounts is set to true if the runtime class supports RecursiveReadOnlyMounts.
// +featureGate=RecursiveReadOnlyMounts
// +optional
RecursiveReadOnlyMounts *bool `json:"recursiveReadOnlyMounts,omitempty" protobuf:"varint,1,opt,name=recursiveReadOnlyMounts"`
// Reserved: UserNamespaces *bool (varint 2, for consistency with CRI API)
}

// NodeRuntimeClass is a set of runtime class information.
type NodeRuntimeClass struct {
// Runtime class name.
// Empty for the default runtime class.
// +optional
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Supported features.
// +optional
Features *NodeRuntimeClassFeatures `json:"features,omitempty" protobuf:"bytes,2,opt,name=features"`
}

// NodeSystemInfo is a set of ids/uuids to uniquely identify the node.
type NodeSystemInfo struct {
// MachineID reported by the node. For unique machine identification
Expand Down Expand Up @@ -5846,6 +5925,11 @@ type NodeStatus struct {
// Status of the config assigned to the node via the dynamic Kubelet config feature.
// +optional
Config *NodeConfigStatus `json:"config,omitempty" protobuf:"bytes,11,opt,name=config"`
// The available runtime classes.
// +featureGate=RecursiveReadOnlyMounts
// +optional
// +listType=atomic
RuntimeClasses []NodeRuntimeClass `json:"runtimeClasses,omitempty" protobuf:"bytes,12,rep,name=runtimeClasses"`
}

type UniqueVolumeName string
Expand Down
48 changes: 41 additions & 7 deletions core/v1/types_swagger_doc_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ var map_ContainerStatus = map[string]string{
"started": "Started indicates whether the container has finished its postStart lifecycle hook and passed its startup probe. Initialized as false, becomes true after startupProbe is considered successful. Resets to false when the container is restarted, or if kubelet loses state temporarily. In both cases, startup probes will run again. Is always true when no startupProbe is defined and container is running and has passed the postStart lifecycle hook. The null value must be treated the same as false.",
"allocatedResources": "AllocatedResources represents the compute resources allocated for this container by the node. Kubelet sets this value to Container.Resources.Requests upon successful pod admission and after successfully admitting desired pod resize.",
"resources": "Resources represents the compute resource requests and limits that have been successfully enacted on the running container after it has been started or has been successfully resized.",
"volumeMounts": "Status of volume mounts.",
}

func (ContainerStatus) SwaggerDoc() map[string]string {
Expand Down Expand Up @@ -1213,6 +1214,25 @@ func (NodeProxyOptions) SwaggerDoc() map[string]string {
return map_NodeProxyOptions
}

var map_NodeRuntimeClass = map[string]string{
"": "NodeRuntimeClass is a set of runtime class information.",
"name": "Runtime class name. Empty for the default runtime class.",
"features": "Supported features.",
}

func (NodeRuntimeClass) SwaggerDoc() map[string]string {
return map_NodeRuntimeClass
}

var map_NodeRuntimeClassFeatures = map[string]string{
"": "NodeRuntimeClassFeatures is a set of runtime features.",
"recursiveReadOnlyMounts": "RecursiveReadOnlyMounts is set to true if the runtime class supports RecursiveReadOnlyMounts.",
}

func (NodeRuntimeClassFeatures) SwaggerDoc() map[string]string {
return map_NodeRuntimeClassFeatures
}

var map_NodeSelector = map[string]string{
"": "A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.",
"nodeSelectorTerms": "Required. A list of node selector terms. The terms are ORed.",
Expand Down Expand Up @@ -1271,6 +1291,7 @@ var map_NodeStatus = map[string]string{
"volumesInUse": "List of attachable volumes in use (mounted) by the node.",
"volumesAttached": "List of volumes that are attached to the node.",
"config": "Status of the config assigned to the node via the dynamic Kubelet config feature.",
"runtimeClasses": "The available runtime classes.",
}

func (NodeStatus) SwaggerDoc() map[string]string {
Expand Down Expand Up @@ -2582,19 +2603,32 @@ func (VolumeDevice) SwaggerDoc() map[string]string {
}

var map_VolumeMount = map[string]string{
"": "VolumeMount describes a mounting of a Volume within a container.",
"name": "This must match the Name of a Volume.",
"readOnly": "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.",
"mountPath": "Path within the container at which the volume should be mounted. Must not contain ':'.",
"subPath": "Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).",
"mountPropagation": "mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10.",
"subPathExpr": "Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to \"\" (volume's root). SubPathExpr and SubPath are mutually exclusive.",
"": "VolumeMount describes a mounting of a Volume within a container.",
"name": "This must match the Name of a Volume.",
"readOnly": "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.",
"recursiveReadOnly": "RecursiveReadOnly specifies whether read-only mounts should be handled recursively.\n\nIf ReadOnly is false, this field has no meaning and must be unspecified.\n\nIf ReadOnly is true, and this field is set to Disabled, the mount is not made recursively read-only. If this field is set to IfPossible, the mount is made recursively read-only, if it is supported by the container runtime. If this field is set to Enabled, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason.\n\nIf this field is set to IfPossible or Enabled, MountPropagation must be set to None (or be unspecified, which defaults to None).\n\nIf this field is not specified, it is treated as an equivalent of Disabled.",
"mountPath": "Path within the container at which the volume should be mounted. Must not contain ':'.",
"subPath": "Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).",
"mountPropagation": "mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used. This field is beta in 1.10. When RecursiveReadOnly is set to IfPossible or to Enabled, MountPropagation must be None or unspecified (which defaults to None).",
"subPathExpr": "Expanded path within the volume from which the container's volume should be mounted. Behaves similarly to SubPath but environment variable references $(VAR_NAME) are expanded using the container's environment. Defaults to \"\" (volume's root). SubPathExpr and SubPath are mutually exclusive.",
}

func (VolumeMount) SwaggerDoc() map[string]string {
return map_VolumeMount
}

var map_VolumeMountStatus = map[string]string{
"": "VolumeMountStatus shows status of volume mounts.",
"name": "Name corresponds to the name of the original VolumeMount.",
"mountPath": "MountPath corresponds to the original VolumeMount.",
"readOnly": "ReadOnly corresponds to the original VolumeMount.",
"recursiveReadOnly": "RecursiveReadOnly must be set to Disabled, Enabled, or unspecified (for non-readonly mounts). An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled, depending on the mount result.",
}

func (VolumeMountStatus) SwaggerDoc() map[string]string {
return map_VolumeMountStatus
}

var map_VolumeNodeAffinity = map[string]string{
"": "VolumeNodeAffinity defines constraints that limit what nodes this volume can be accessed from.",
"required": "required specifies hard node constraints that must be met.",
Expand Down
Loading

0 comments on commit b50824d

Please sign in to comment.