Merge pull request #126034 from sohankunkerkar/add-usernamespaces
api: add user namespaces field to NodeRuntimeHandlerFeatures
This commit is contained in:
		
							
								
								
									
										4
									
								
								api/openapi-spec/swagger.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								api/openapi-spec/swagger.json
									
									
									
										generated
									
									
									
								
							| @@ -8280,6 +8280,10 @@ | |||||||
|         "recursiveReadOnlyMounts": { |         "recursiveReadOnlyMounts": { | ||||||
|           "description": "RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts.", |           "description": "RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts.", | ||||||
|           "type": "boolean" |           "type": "boolean" | ||||||
|  |         }, | ||||||
|  |         "userNamespaces": { | ||||||
|  |           "description": "UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes.", | ||||||
|  |           "type": "boolean" | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|       "type": "object" |       "type": "object" | ||||||
|   | |||||||
| @@ -3811,6 +3811,10 @@ | |||||||
|           "recursiveReadOnlyMounts": { |           "recursiveReadOnlyMounts": { | ||||||
|             "description": "RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts.", |             "description": "RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts.", | ||||||
|             "type": "boolean" |             "type": "boolean" | ||||||
|  |           }, | ||||||
|  |           "userNamespaces": { | ||||||
|  |             "description": "UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes.", | ||||||
|  |             "type": "boolean" | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|         "type": "object" |         "type": "object" | ||||||
|   | |||||||
| @@ -4898,7 +4898,10 @@ type NodeRuntimeHandlerFeatures struct { | |||||||
| 	// +featureGate=RecursiveReadOnlyMounts | 	// +featureGate=RecursiveReadOnlyMounts | ||||||
| 	// +optional | 	// +optional | ||||||
| 	RecursiveReadOnlyMounts *bool | 	RecursiveReadOnlyMounts *bool | ||||||
| 	// Reserved: UserNamespaces *bool | 	// UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes. | ||||||
|  | 	// +featureGate=UserNamespacesSupport | ||||||
|  | 	// +optional | ||||||
|  | 	UserNamespaces *bool | ||||||
| } | } | ||||||
|  |  | ||||||
| // NodeRuntimeHandler is a set of runtime handler information. | // NodeRuntimeHandler is a set of runtime handler information. | ||||||
| @@ -5024,6 +5027,7 @@ type NodeStatus struct { | |||||||
| 	Config *NodeConfigStatus | 	Config *NodeConfigStatus | ||||||
| 	// The available runtime handlers. | 	// The available runtime handlers. | ||||||
| 	// +featureGate=RecursiveReadOnlyMounts | 	// +featureGate=RecursiveReadOnlyMounts | ||||||
|  | 	// +featureGate=UserNamespacesSupport | ||||||
| 	// +optional | 	// +optional | ||||||
| 	RuntimeHandlers []NodeRuntimeHandler | 	RuntimeHandlers []NodeRuntimeHandler | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								pkg/apis/core/v1/zz_generated.conversion.go
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								pkg/apis/core/v1/zz_generated.conversion.go
									
									
									
										generated
									
									
									
								
							| @@ -5171,6 +5171,7 @@ func Convert_core_NodeRuntimeHandler_To_v1_NodeRuntimeHandler(in *core.NodeRunti | |||||||
|  |  | ||||||
| func autoConvert_v1_NodeRuntimeHandlerFeatures_To_core_NodeRuntimeHandlerFeatures(in *v1.NodeRuntimeHandlerFeatures, out *core.NodeRuntimeHandlerFeatures, s conversion.Scope) error { | func autoConvert_v1_NodeRuntimeHandlerFeatures_To_core_NodeRuntimeHandlerFeatures(in *v1.NodeRuntimeHandlerFeatures, out *core.NodeRuntimeHandlerFeatures, s conversion.Scope) error { | ||||||
| 	out.RecursiveReadOnlyMounts = (*bool)(unsafe.Pointer(in.RecursiveReadOnlyMounts)) | 	out.RecursiveReadOnlyMounts = (*bool)(unsafe.Pointer(in.RecursiveReadOnlyMounts)) | ||||||
|  | 	out.UserNamespaces = (*bool)(unsafe.Pointer(in.UserNamespaces)) | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -5181,6 +5182,7 @@ func Convert_v1_NodeRuntimeHandlerFeatures_To_core_NodeRuntimeHandlerFeatures(in | |||||||
|  |  | ||||||
| func autoConvert_core_NodeRuntimeHandlerFeatures_To_v1_NodeRuntimeHandlerFeatures(in *core.NodeRuntimeHandlerFeatures, out *v1.NodeRuntimeHandlerFeatures, s conversion.Scope) error { | func autoConvert_core_NodeRuntimeHandlerFeatures_To_v1_NodeRuntimeHandlerFeatures(in *core.NodeRuntimeHandlerFeatures, out *v1.NodeRuntimeHandlerFeatures, s conversion.Scope) error { | ||||||
| 	out.RecursiveReadOnlyMounts = (*bool)(unsafe.Pointer(in.RecursiveReadOnlyMounts)) | 	out.RecursiveReadOnlyMounts = (*bool)(unsafe.Pointer(in.RecursiveReadOnlyMounts)) | ||||||
|  | 	out.UserNamespaces = (*bool)(unsafe.Pointer(in.UserNamespaces)) | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								pkg/apis/core/zz_generated.deepcopy.go
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								pkg/apis/core/zz_generated.deepcopy.go
									
									
									
										generated
									
									
									
								
							| @@ -2805,6 +2805,11 @@ func (in *NodeRuntimeHandlerFeatures) DeepCopyInto(out *NodeRuntimeHandlerFeatur | |||||||
| 		*out = new(bool) | 		*out = new(bool) | ||||||
| 		**out = **in | 		**out = **in | ||||||
| 	} | 	} | ||||||
|  | 	if in.UserNamespaces != nil { | ||||||
|  | 		in, out := &in.UserNamespaces, &out.UserNamespaces | ||||||
|  | 		*out = new(bool) | ||||||
|  | 		**out = **in | ||||||
|  | 	} | ||||||
| 	return | 	return | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								pkg/generated/openapi/zz_generated.openapi.go
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										7
									
								
								pkg/generated/openapi/zz_generated.openapi.go
									
									
									
										generated
									
									
									
								
							| @@ -24540,6 +24540,13 @@ func schema_k8sio_api_core_v1_NodeRuntimeHandlerFeatures(ref common.ReferenceCal | |||||||
| 							Format:      "", | 							Format:      "", | ||||||
| 						}, | 						}, | ||||||
| 					}, | 					}, | ||||||
|  | 					"userNamespaces": { | ||||||
|  | 						SchemaProps: spec.SchemaProps{ | ||||||
|  | 							Description: "UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes.", | ||||||
|  | 							Type:        []string{"boolean"}, | ||||||
|  | 							Format:      "", | ||||||
|  | 						}, | ||||||
|  | 					}, | ||||||
| 				}, | 				}, | ||||||
| 			}, | 			}, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -485,7 +485,7 @@ func GoRuntime() Setter { | |||||||
| // RuntimeHandlers returns a Setter that sets RuntimeHandlers on the node. | // RuntimeHandlers returns a Setter that sets RuntimeHandlers on the node. | ||||||
| func RuntimeHandlers(fn func() []kubecontainer.RuntimeHandler) Setter { | func RuntimeHandlers(fn func() []kubecontainer.RuntimeHandler) Setter { | ||||||
| 	return func(ctx context.Context, node *v1.Node) error { | 	return func(ctx context.Context, node *v1.Node) error { | ||||||
| 		if !utilfeature.DefaultFeatureGate.Enabled(features.RecursiveReadOnlyMounts) { | 		if !utilfeature.DefaultFeatureGate.Enabled(features.RecursiveReadOnlyMounts) && !utilfeature.DefaultFeatureGate.Enabled(features.UserNamespacesSupport) { | ||||||
| 			return nil | 			return nil | ||||||
| 		} | 		} | ||||||
| 		handlers := fn() | 		handlers := fn() | ||||||
| @@ -495,6 +495,7 @@ func RuntimeHandlers(fn func() []kubecontainer.RuntimeHandler) Setter { | |||||||
| 				Name: h.Name, | 				Name: h.Name, | ||||||
| 				Features: &v1.NodeRuntimeHandlerFeatures{ | 				Features: &v1.NodeRuntimeHandlerFeatures{ | ||||||
| 					RecursiveReadOnlyMounts: &h.SupportsRecursiveReadOnlyMounts, | 					RecursiveReadOnlyMounts: &h.SupportsRecursiveReadOnlyMounts, | ||||||
|  | 					UserNamespaces:          &h.SupportsUserNamespaces, | ||||||
| 				}, | 				}, | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -103,7 +103,7 @@ func dropDisabledFields(node *api.Node, oldNode *api.Node) { | |||||||
| 		node.Spec.ConfigSource = nil | 		node.Spec.ConfigSource = nil | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if !utilfeature.DefaultFeatureGate.Enabled(features.RecursiveReadOnlyMounts) { | 	if !utilfeature.DefaultFeatureGate.Enabled(features.RecursiveReadOnlyMounts) && !utilfeature.DefaultFeatureGate.Enabled(features.UserNamespacesSupport) { | ||||||
| 		node.Status.RuntimeHandlers = nil | 		node.Status.RuntimeHandlers = nil | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										2016
									
								
								staging/src/k8s.io/api/core/v1/generated.pb.go
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2016
									
								
								staging/src/k8s.io/api/core/v1/generated.pb.go
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -2634,6 +2634,11 @@ message NodeRuntimeHandlerFeatures { | |||||||
|   // +featureGate=RecursiveReadOnlyMounts |   // +featureGate=RecursiveReadOnlyMounts | ||||||
|   // +optional |   // +optional | ||||||
|   optional bool recursiveReadOnlyMounts = 1; |   optional bool recursiveReadOnlyMounts = 1; | ||||||
|  |  | ||||||
|  |   // UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes. | ||||||
|  |   // +featureGate=UserNamespacesSupport | ||||||
|  |   // +optional | ||||||
|  |   optional bool userNamespaces = 2; | ||||||
| } | } | ||||||
|  |  | ||||||
| // A node selector represents the union of the results of one or more label queries | // A node selector represents the union of the results of one or more label queries | ||||||
| @@ -2794,6 +2799,7 @@ message NodeStatus { | |||||||
|  |  | ||||||
|   // The available runtime handlers. |   // The available runtime handlers. | ||||||
|   // +featureGate=RecursiveReadOnlyMounts |   // +featureGate=RecursiveReadOnlyMounts | ||||||
|  |   // +featureGate=UserNamespacesSupport | ||||||
|   // +optional |   // +optional | ||||||
|   // +listType=atomic |   // +listType=atomic | ||||||
|   repeated NodeRuntimeHandler runtimeHandlers = 12; |   repeated NodeRuntimeHandler runtimeHandlers = 12; | ||||||
|   | |||||||
| @@ -5877,7 +5877,10 @@ type NodeRuntimeHandlerFeatures struct { | |||||||
| 	// +featureGate=RecursiveReadOnlyMounts | 	// +featureGate=RecursiveReadOnlyMounts | ||||||
| 	// +optional | 	// +optional | ||||||
| 	RecursiveReadOnlyMounts *bool `json:"recursiveReadOnlyMounts,omitempty" protobuf:"varint,1,opt,name=recursiveReadOnlyMounts"` | 	RecursiveReadOnlyMounts *bool `json:"recursiveReadOnlyMounts,omitempty" protobuf:"varint,1,opt,name=recursiveReadOnlyMounts"` | ||||||
| 	// Reserved: UserNamespaces *bool (varint 2, for consistency with CRI API) | 	// UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes. | ||||||
|  | 	// +featureGate=UserNamespacesSupport | ||||||
|  | 	// +optional | ||||||
|  | 	UserNamespaces *bool `json:"userNamespaces,omitempty" protobuf:"varint,2,opt,name=userNamespaces"` | ||||||
| } | } | ||||||
|  |  | ||||||
| // NodeRuntimeHandler is a set of runtime handler information. | // NodeRuntimeHandler is a set of runtime handler information. | ||||||
| @@ -6029,6 +6032,7 @@ type NodeStatus struct { | |||||||
| 	Config *NodeConfigStatus `json:"config,omitempty" protobuf:"bytes,11,opt,name=config"` | 	Config *NodeConfigStatus `json:"config,omitempty" protobuf:"bytes,11,opt,name=config"` | ||||||
| 	// The available runtime handlers. | 	// The available runtime handlers. | ||||||
| 	// +featureGate=RecursiveReadOnlyMounts | 	// +featureGate=RecursiveReadOnlyMounts | ||||||
|  | 	// +featureGate=UserNamespacesSupport | ||||||
| 	// +optional | 	// +optional | ||||||
| 	// +listType=atomic | 	// +listType=atomic | ||||||
| 	RuntimeHandlers []NodeRuntimeHandler `json:"runtimeHandlers,omitempty" protobuf:"bytes,12,rep,name=runtimeHandlers"` | 	RuntimeHandlers []NodeRuntimeHandler `json:"runtimeHandlers,omitempty" protobuf:"bytes,12,rep,name=runtimeHandlers"` | ||||||
|   | |||||||
| @@ -1238,6 +1238,7 @@ func (NodeRuntimeHandler) SwaggerDoc() map[string]string { | |||||||
| var map_NodeRuntimeHandlerFeatures = map[string]string{ | var map_NodeRuntimeHandlerFeatures = map[string]string{ | ||||||
| 	"":                        "NodeRuntimeHandlerFeatures is a set of runtime features.", | 	"":                        "NodeRuntimeHandlerFeatures is a set of runtime features.", | ||||||
| 	"recursiveReadOnlyMounts": "RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts.", | 	"recursiveReadOnlyMounts": "RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts.", | ||||||
|  | 	"userNamespaces":          "UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes.", | ||||||
| } | } | ||||||
|  |  | ||||||
| func (NodeRuntimeHandlerFeatures) SwaggerDoc() map[string]string { | func (NodeRuntimeHandlerFeatures) SwaggerDoc() map[string]string { | ||||||
|   | |||||||
| @@ -2803,6 +2803,11 @@ func (in *NodeRuntimeHandlerFeatures) DeepCopyInto(out *NodeRuntimeHandlerFeatur | |||||||
| 		*out = new(bool) | 		*out = new(bool) | ||||||
| 		**out = **in | 		**out = **in | ||||||
| 	} | 	} | ||||||
|  | 	if in.UserNamespaces != nil { | ||||||
|  | 		in, out := &in.UserNamespaces, &out.UserNamespaces | ||||||
|  | 		*out = new(bool) | ||||||
|  | 		**out = **in | ||||||
|  | 	} | ||||||
| 	return | 	return | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -161,7 +161,8 @@ | |||||||
|       { |       { | ||||||
|         "name": "nameValue", |         "name": "nameValue", | ||||||
|         "features": { |         "features": { | ||||||
|           "recursiveReadOnlyMounts": true |           "recursiveReadOnlyMounts": true, | ||||||
|  |           "userNamespaces": true | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     ] |     ] | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								staging/src/k8s.io/api/testdata/HEAD/core.v1.Node.pb
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								staging/src/k8s.io/api/testdata/HEAD/core.v1.Node.pb
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -111,6 +111,7 @@ status: | |||||||
|   runtimeHandlers: |   runtimeHandlers: | ||||||
|   - features: |   - features: | ||||||
|       recursiveReadOnlyMounts: true |       recursiveReadOnlyMounts: true | ||||||
|  |       userNamespaces: true | ||||||
|     name: nameValue |     name: nameValue | ||||||
|   volumesAttached: |   volumesAttached: | ||||||
|   - devicePath: devicePathValue |   - devicePath: devicePathValue | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ package v1 | |||||||
| // with apply. | // with apply. | ||||||
| type NodeRuntimeHandlerFeaturesApplyConfiguration struct { | type NodeRuntimeHandlerFeaturesApplyConfiguration struct { | ||||||
| 	RecursiveReadOnlyMounts *bool `json:"recursiveReadOnlyMounts,omitempty"` | 	RecursiveReadOnlyMounts *bool `json:"recursiveReadOnlyMounts,omitempty"` | ||||||
|  | 	UserNamespaces          *bool `json:"userNamespaces,omitempty"` | ||||||
| } | } | ||||||
|  |  | ||||||
| // NodeRuntimeHandlerFeaturesApplyConfiguration constructs a declarative configuration of the NodeRuntimeHandlerFeatures type for use with | // NodeRuntimeHandlerFeaturesApplyConfiguration constructs a declarative configuration of the NodeRuntimeHandlerFeatures type for use with | ||||||
| @@ -37,3 +38,11 @@ func (b *NodeRuntimeHandlerFeaturesApplyConfiguration) WithRecursiveReadOnlyMoun | |||||||
| 	b.RecursiveReadOnlyMounts = &value | 	b.RecursiveReadOnlyMounts = &value | ||||||
| 	return b | 	return b | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // WithUserNamespaces sets the UserNamespaces field in the declarative configuration to the given value | ||||||
|  | // and returns the receiver, so that objects can be built by chaining "With" function invocations. | ||||||
|  | // If called multiple times, the UserNamespaces field is set to the value of the last call. | ||||||
|  | func (b *NodeRuntimeHandlerFeaturesApplyConfiguration) WithUserNamespaces(value bool) *NodeRuntimeHandlerFeaturesApplyConfiguration { | ||||||
|  | 	b.UserNamespaces = &value | ||||||
|  | 	return b | ||||||
|  | } | ||||||
|   | |||||||
| @@ -6119,6 +6119,9 @@ var schemaYAML = typed.YAMLObject(`types: | |||||||
|     - name: recursiveReadOnlyMounts |     - name: recursiveReadOnlyMounts | ||||||
|       type: |       type: | ||||||
|         scalar: boolean |         scalar: boolean | ||||||
|  |     - name: userNamespaces | ||||||
|  |       type: | ||||||
|  |         scalar: boolean | ||||||
| - name: io.k8s.api.core.v1.NodeSelector | - name: io.k8s.api.core.v1.NodeSelector | ||||||
|   map: |   map: | ||||||
|     fields: |     fields: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot