introduce topology into the runtimeClass API

k3s-v1.15.3
Yassine TIJANI 2019-03-26 21:41:12 +01:00
parent 8045a99a70
commit e39d18f0c0
19 changed files with 345 additions and 1 deletions

View File

@ -13280,6 +13280,10 @@
"runtimeHandler": {
"description": "RuntimeHandler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The RuntimeHandler must conform to the DNS Label (RFC 1123) requirements and is immutable.",
"type": "string"
},
"topology": {
"$ref": "#/definitions/io.k8s.api.node.v1alpha1.Topology",
"description": "Topology specifies the scheduling constrains that are necessary to assign pods to the right node"
}
},
"required": [
@ -13287,6 +13291,23 @@
],
"type": "object"
},
"io.k8s.api.node.v1alpha1.Topology": {
"description": "Topology specifies the structure of scheduling constrains for the runtime class",
"properties": {
"nodeSelector": {
"$ref": "#/definitions/io.k8s.api.core.v1.NodeSelector",
"description": "nodeSelector selects the set of nodes that support this RuntimeClass. Pods using this RuntimeClass can only be scheduled to a node matched by this selector. The nodeSelector is intersected (AND) with a pod's other node affinity or node selector requirements."
},
"tolerations": {
"description": "tolerations adds tolerations to pods running with this RuntimeClass.",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.Toleration"
},
"type": "array"
}
},
"type": "object"
},
"io.k8s.api.node.v1beta1.RuntimeClass": {
"description": "RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are (currently) manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md",
"properties": {
@ -13305,6 +13326,10 @@
"metadata": {
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
"description": "More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata"
},
"topology": {
"$ref": "#/definitions/io.k8s.api.node.v1beta1.Topology",
"description": "Topology describes the set of nodes in the cluster that support this RuntimeClass. The rules are applied to the pod during scheduling time. If topology is nil, this RuntimeClass is assumed to be supported by all nodes. pods to the right node"
}
},
"required": [
@ -13354,6 +13379,23 @@
}
]
},
"io.k8s.api.node.v1beta1.Topology": {
"description": "Topology specifies the scheduling constraints for nodes supporting a RuntimeClass.",
"properties": {
"nodeSelector": {
"$ref": "#/definitions/io.k8s.api.core.v1.NodeSelector",
"description": "nodeSelector selects the set of nodes that support this RuntimeClass. Pods using this RuntimeClass can only be scheduled to a node matched by this selector. The nodeSelector is intersected (AND) with a pod's other node affinity or node selector requirements. A nil nodeSelector selects all nodes."
},
"tolerations": {
"description": "tolerations adds tolerations to pods running with this RuntimeClass. the tolerations are appended (excluding duplicates) to the pod's tolerations during admission.",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.Toleration"
},
"type": "array"
}
},
"type": "object"
},
"io.k8s.api.policy.v1beta1.AllowedCSIDriver": {
"description": "AllowedCSIDriver represents a single inline CSI Driver that is allowed to be used.",
"properties": {

View File

@ -11,6 +11,7 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/apis/node",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/core:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",

View File

@ -17,6 +17,7 @@ limitations under the License.
package node
import (
v1 "k8s.io/kubernetes/pkg/apis/core"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -45,6 +46,25 @@ type RuntimeClass struct {
// The Handler must conform to the DNS Label (RFC 1123) requirements, and is
// immutable.
Handler string
// Topology specifies the scheduling constrains that are necessary to assign
// pods to the right node
// +optional
Topology *Topology
}
// Topology specifies the structure of scheduling constrains for the runtime class
type Topology struct {
// nodeSelector selects the set of nodes that support this RuntimeClass.
// Pods using this RuntimeClass can only be scheduled to a node matched by
// this selector. The nodeSelector is intersected (AND) with a pod's other
// node affinity or node selector requirements.
// +optional
NodeSelector *v1.NodeSelector
// tolerations adds tolerations to pods running with this RuntimeClass.
// +optional
Tolerations []v1.Toleration
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View File

@ -11,7 +11,9 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/apis/node/v1alpha1",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/node:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/node/v1alpha1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",

View File

@ -21,6 +21,7 @@ import (
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
node "k8s.io/kubernetes/pkg/apis/node"
"unsafe"
)
func addConversionFuncs(s *runtime.Scheme) error {
@ -33,11 +34,13 @@ func addConversionFuncs(s *runtime.Scheme) error {
func Convert_v1alpha1_RuntimeClass_To_node_RuntimeClass(in *v1alpha1.RuntimeClass, out *node.RuntimeClass, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Handler = in.Spec.RuntimeHandler
out.Topology = (*node.Topology)(unsafe.Pointer(in.Spec.Topology))
return nil
}
func Convert_node_RuntimeClass_To_v1alpha1_RuntimeClass(in *node.RuntimeClass, out *v1alpha1.RuntimeClass, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Spec.RuntimeHandler = in.Handler
out.Spec.Topology = (*v1alpha1.Topology)(unsafe.Pointer(in.Topology))
return nil
}

View File

@ -21,9 +21,13 @@ limitations under the License.
package v1alpha1
import (
unsafe "unsafe"
v1 "k8s.io/api/core/v1"
v1alpha1 "k8s.io/api/node/v1alpha1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
core "k8s.io/kubernetes/pkg/apis/core"
node "k8s.io/kubernetes/pkg/apis/node"
)
@ -54,6 +58,16 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.Topology)(nil), (*node.Topology)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_Topology_To_node_Topology(a.(*v1alpha1.Topology), b.(*node.Topology), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*node.Topology)(nil), (*v1alpha1.Topology)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_node_Topology_To_v1alpha1_Topology(a.(*node.Topology), b.(*v1alpha1.Topology), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*node.RuntimeClass)(nil), (*v1alpha1.RuntimeClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_node_RuntimeClass_To_v1alpha1_RuntimeClass(a.(*node.RuntimeClass), b.(*v1alpha1.RuntimeClass), scope)
}); err != nil {
@ -76,6 +90,7 @@ func autoConvert_v1alpha1_RuntimeClass_To_node_RuntimeClass(in *v1alpha1.Runtime
func autoConvert_node_RuntimeClass_To_v1alpha1_RuntimeClass(in *node.RuntimeClass, out *v1alpha1.RuntimeClass, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
// WARNING: in.Handler requires manual conversion: does not exist in peer-type
// WARNING: in.Topology requires manual conversion: does not exist in peer-type
return nil
}
@ -120,3 +135,25 @@ func autoConvert_node_RuntimeClassList_To_v1alpha1_RuntimeClassList(in *node.Run
func Convert_node_RuntimeClassList_To_v1alpha1_RuntimeClassList(in *node.RuntimeClassList, out *v1alpha1.RuntimeClassList, s conversion.Scope) error {
return autoConvert_node_RuntimeClassList_To_v1alpha1_RuntimeClassList(in, out, s)
}
func autoConvert_v1alpha1_Topology_To_node_Topology(in *v1alpha1.Topology, out *node.Topology, s conversion.Scope) error {
out.NodeSelector = (*core.NodeSelector)(unsafe.Pointer(in.NodeSelector))
out.Tolerations = *(*[]core.Toleration)(unsafe.Pointer(&in.Tolerations))
return nil
}
// Convert_v1alpha1_Topology_To_node_Topology is an autogenerated conversion function.
func Convert_v1alpha1_Topology_To_node_Topology(in *v1alpha1.Topology, out *node.Topology, s conversion.Scope) error {
return autoConvert_v1alpha1_Topology_To_node_Topology(in, out, s)
}
func autoConvert_node_Topology_To_v1alpha1_Topology(in *node.Topology, out *v1alpha1.Topology, s conversion.Scope) error {
out.NodeSelector = (*v1.NodeSelector)(unsafe.Pointer(in.NodeSelector))
out.Tolerations = *(*[]v1.Toleration)(unsafe.Pointer(&in.Tolerations))
return nil
}
// Convert_node_Topology_To_v1alpha1_Topology is an autogenerated conversion function.
func Convert_node_Topology_To_v1alpha1_Topology(in *node.Topology, out *v1alpha1.Topology, s conversion.Scope) error {
return autoConvert_node_Topology_To_v1alpha1_Topology(in, out, s)
}

View File

@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"conversion.go",
"doc.go",
"register.go",
"zz_generated.conversion.go",
@ -10,7 +11,9 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/apis/node/v1beta1",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/node:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/node/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",

View File

@ -0,0 +1,25 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
import (
"k8s.io/apimachinery/pkg/runtime"
)
func addConversionFuncs(s *runtime.Scheme) error {
return s.AddConversionFuncs()
}

View File

@ -37,3 +37,10 @@ var (
// AddToScheme node API registration
AddToScheme = localSchemeBuilder.AddToScheme
)
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addConversionFuncs)
}

View File

@ -23,9 +23,11 @@ package v1beta1
import (
unsafe "unsafe"
v1 "k8s.io/api/core/v1"
v1beta1 "k8s.io/api/node/v1beta1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
core "k8s.io/kubernetes/pkg/apis/core"
node "k8s.io/kubernetes/pkg/apis/node"
)
@ -56,12 +58,23 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.Topology)(nil), (*node.Topology)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_Topology_To_node_Topology(a.(*v1beta1.Topology), b.(*node.Topology), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*node.Topology)(nil), (*v1beta1.Topology)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_node_Topology_To_v1beta1_Topology(a.(*node.Topology), b.(*v1beta1.Topology), scope)
}); err != nil {
return err
}
return nil
}
func autoConvert_v1beta1_RuntimeClass_To_node_RuntimeClass(in *v1beta1.RuntimeClass, out *node.RuntimeClass, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Handler = in.Handler
out.Topology = (*node.Topology)(unsafe.Pointer(in.Topology))
return nil
}
@ -73,6 +86,7 @@ func Convert_v1beta1_RuntimeClass_To_node_RuntimeClass(in *v1beta1.RuntimeClass,
func autoConvert_node_RuntimeClass_To_v1beta1_RuntimeClass(in *node.RuntimeClass, out *v1beta1.RuntimeClass, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Handler = in.Handler
out.Topology = (*v1beta1.Topology)(unsafe.Pointer(in.Topology))
return nil
}
@ -102,3 +116,25 @@ func autoConvert_node_RuntimeClassList_To_v1beta1_RuntimeClassList(in *node.Runt
func Convert_node_RuntimeClassList_To_v1beta1_RuntimeClassList(in *node.RuntimeClassList, out *v1beta1.RuntimeClassList, s conversion.Scope) error {
return autoConvert_node_RuntimeClassList_To_v1beta1_RuntimeClassList(in, out, s)
}
func autoConvert_v1beta1_Topology_To_node_Topology(in *v1beta1.Topology, out *node.Topology, s conversion.Scope) error {
out.NodeSelector = (*core.NodeSelector)(unsafe.Pointer(in.NodeSelector))
out.Tolerations = *(*[]core.Toleration)(unsafe.Pointer(&in.Tolerations))
return nil
}
// Convert_v1beta1_Topology_To_node_Topology is an autogenerated conversion function.
func Convert_v1beta1_Topology_To_node_Topology(in *v1beta1.Topology, out *node.Topology, s conversion.Scope) error {
return autoConvert_v1beta1_Topology_To_node_Topology(in, out, s)
}
func autoConvert_node_Topology_To_v1beta1_Topology(in *node.Topology, out *v1beta1.Topology, s conversion.Scope) error {
out.NodeSelector = (*v1.NodeSelector)(unsafe.Pointer(in.NodeSelector))
out.Tolerations = *(*[]v1.Toleration)(unsafe.Pointer(&in.Tolerations))
return nil
}
// Convert_node_Topology_To_v1beta1_Topology is an autogenerated conversion function.
func Convert_node_Topology_To_v1beta1_Topology(in *node.Topology, out *v1beta1.Topology, s conversion.Scope) error {
return autoConvert_node_Topology_To_v1beta1_Topology(in, out, s)
}

View File

@ -22,6 +22,7 @@ package node
import (
runtime "k8s.io/apimachinery/pkg/runtime"
core "k8s.io/kubernetes/pkg/apis/core"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@ -29,6 +30,11 @@ func (in *RuntimeClass) DeepCopyInto(out *RuntimeClass) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
if in.Topology != nil {
in, out := &in.Topology, &out.Topology
*out = new(Topology)
(*in).DeepCopyInto(*out)
}
return
}
@ -82,3 +88,31 @@ func (in *RuntimeClassList) DeepCopyObject() runtime.Object {
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Topology) DeepCopyInto(out *Topology) {
*out = *in
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = new(core.NodeSelector)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = make([]core.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Topology.
func (in *Topology) DeepCopy() *Topology {
if in == nil {
return nil
}
out := new(Topology)
in.DeepCopyInto(out)
return out
}

View File

@ -14,6 +14,7 @@ go_library(
importpath = "k8s.io/api/node/v1alpha1",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",

View File

@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -58,6 +59,25 @@ type RuntimeClassSpec struct {
// The RuntimeHandler must conform to the DNS Label (RFC 1123) requirements
// and is immutable.
RuntimeHandler string `json:"runtimeHandler" protobuf:"bytes,1,opt,name=runtimeHandler"`
// Topology specifies the scheduling constrains that are necessary to assign
// pods to the right node
// +optional
Topology *Topology `json:"topology,omitempty" protobuf:"bytes,3,opt,name=topology"`
}
// Topology specifies the structure of scheduling constrains for the runtime class
type Topology struct {
// nodeSelector selects the set of nodes that support this RuntimeClass.
// Pods using this RuntimeClass can only be scheduled to a node matched by
// this selector. The nodeSelector is intersected (AND) with a pod's other
// node affinity or node selector requirements.
// +optional
NodeSelector *v1.NodeSelector `json:"nodeSelector,omitempty" protobuf:"bytes,1,rep,name=nodeSelector"`
// tolerations adds tolerations to pods running with this RuntimeClass.
// +optional
Tolerations []v1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,2,opt,name=tolerations"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View File

@ -50,10 +50,21 @@ func (RuntimeClassList) SwaggerDoc() map[string]string {
var map_RuntimeClassSpec = map[string]string{
"": "RuntimeClassSpec is a specification of a RuntimeClass. It contains parameters that are required to describe the RuntimeClass to the Container Runtime Interface (CRI) implementation, as well as any other components that need to understand how the pod will be run. The RuntimeClassSpec is immutable.",
"runtimeHandler": "RuntimeHandler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The RuntimeHandler must conform to the DNS Label (RFC 1123) requirements and is immutable.",
"topology": "Topology specifies the scheduling constrains that are necessary to assign pods to the right node",
}
func (RuntimeClassSpec) SwaggerDoc() map[string]string {
return map_RuntimeClassSpec
}
var map_Topology = map[string]string{
"": "Topology specifies the structure of scheduling constrains for the runtime class",
"nodeSelector": "nodeSelector selects the set of nodes that support this RuntimeClass. Pods using this RuntimeClass can only be scheduled to a node matched by this selector. The nodeSelector is intersected (AND) with a pod's other node affinity or node selector requirements.",
"tolerations": "tolerations adds tolerations to pods running with this RuntimeClass.",
}
func (Topology) SwaggerDoc() map[string]string {
return map_Topology
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@ -21,6 +21,7 @@ limitations under the License.
package v1alpha1
import (
v1 "k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@ -29,7 +30,7 @@ func (in *RuntimeClass) DeepCopyInto(out *RuntimeClass) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Spec.DeepCopyInto(&out.Spec)
return
}
@ -87,6 +88,11 @@ func (in *RuntimeClassList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RuntimeClassSpec) DeepCopyInto(out *RuntimeClassSpec) {
*out = *in
if in.Topology != nil {
in, out := &in.Topology, &out.Topology
*out = new(Topology)
(*in).DeepCopyInto(*out)
}
return
}
@ -99,3 +105,31 @@ func (in *RuntimeClassSpec) DeepCopy() *RuntimeClassSpec {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Topology) DeepCopyInto(out *Topology) {
*out = *in
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = new(v1.NodeSelector)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Topology.
func (in *Topology) DeepCopy() *Topology {
if in == nil {
return nil
}
out := new(Topology)
in.DeepCopyInto(out)
return out
}

View File

@ -14,6 +14,7 @@ go_library(
importpath = "k8s.io/api/node/v1beta1",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",

View File

@ -17,6 +17,7 @@ limitations under the License.
package v1beta1
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -48,6 +49,27 @@ type RuntimeClass struct {
// The Handler must conform to the DNS Label (RFC 1123) requirements, and is
// immutable.
Handler string `json:"handler" protobuf:"bytes,2,opt,name=handler"`
// Topology describes the set of nodes in the cluster that support this RuntimeClass. The rules are applied to the pod during scheduling time.
// If topology is nil, this RuntimeClass is assumed to be supported by all nodes.
// pods to the right node
// +optional
Topology *Topology `json:"topology,omitempty" protobuf:"bytes,3,opt,name=topology"`
}
// Topology specifies the scheduling constraints for nodes supporting a RuntimeClass.
type Topology struct {
// nodeSelector selects the set of nodes that support this RuntimeClass.
// Pods using this RuntimeClass can only be scheduled to a node matched by
// this selector. The nodeSelector is intersected (AND) with a pod's other
// node affinity or node selector requirements. A nil nodeSelector selects all nodes.
// +optional
NodeSelector *v1.NodeSelector `json:"nodeSelector,omitempty" protobuf:"bytes,1,rep,name=nodeSelector"`
// tolerations adds tolerations to pods running with this RuntimeClass.
// the tolerations are appended (excluding duplicates) to the pod's tolerations during admission.
// +optional
Tolerations []v1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,2,opt,name=tolerations"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View File

@ -31,6 +31,7 @@ var map_RuntimeClass = map[string]string{
"": "RuntimeClass defines a class of container runtime supported in the cluster. The RuntimeClass is used to determine which container runtime is used to run all containers in a pod. RuntimeClasses are (currently) manually defined by a user or cluster provisioner, and referenced in the PodSpec. The Kubelet is responsible for resolving the RuntimeClassName reference before running the pod. For more details, see https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md",
"metadata": "More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
"handler": "Handler specifies the underlying runtime and configuration that the CRI implementation will use to handle pods of this class. The possible values are specific to the node & CRI configuration. It is assumed that all handlers are available on every node, and handlers of the same name are equivalent on every node. For example, a handler called \"runc\" might specify that the runc OCI runtime (using native Linux containers) will be used to run the containers in a pod. The Handler must conform to the DNS Label (RFC 1123) requirements, and is immutable.",
"topology": "Topology describes the set of nodes in the cluster that support this RuntimeClass. The rules are applied to the pod during scheduling time. If topology is nil, this RuntimeClass is assumed to be supported by all nodes. pods to the right node",
}
func (RuntimeClass) SwaggerDoc() map[string]string {
@ -47,4 +48,14 @@ func (RuntimeClassList) SwaggerDoc() map[string]string {
return map_RuntimeClassList
}
var map_Topology = map[string]string{
"": "Topology specifies the scheduling constraints for nodes supporting a RuntimeClass.",
"nodeSelector": "nodeSelector selects the set of nodes that support this RuntimeClass. Pods using this RuntimeClass can only be scheduled to a node matched by this selector. The nodeSelector is intersected (AND) with a pod's other node affinity or node selector requirements. A nil nodeSelector selects all nodes.",
"tolerations": "tolerations adds tolerations to pods running with this RuntimeClass. the tolerations are appended (excluding duplicates) to the pod's tolerations during admission.",
}
func (Topology) SwaggerDoc() map[string]string {
return map_Topology
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@ -21,6 +21,7 @@ limitations under the License.
package v1beta1
import (
v1 "k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@ -29,6 +30,11 @@ func (in *RuntimeClass) DeepCopyInto(out *RuntimeClass) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
if in.Topology != nil {
in, out := &in.Topology, &out.Topology
*out = new(Topology)
(*in).DeepCopyInto(*out)
}
return
}
@ -82,3 +88,31 @@ func (in *RuntimeClassList) DeepCopyObject() runtime.Object {
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Topology) DeepCopyInto(out *Topology) {
*out = *in
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = new(v1.NodeSelector)
(*in).DeepCopyInto(*out)
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Topology.
func (in *Topology) DeepCopy() *Topology {
if in == nil {
return nil
}
out := new(Topology)
in.DeepCopyInto(out)
return out
}