1 /* 2 Copyright 2018 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package node 18 19 import ( 20 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 "k8s.io/kubernetes/pkg/apis/core" 22 ) 23 24 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 25 26 // RuntimeClass defines a class of container runtime supported in the cluster. 27 // The RuntimeClass is used to determine which container runtime is used to run 28 // all containers in a pod. RuntimeClasses are (currently) manually defined by a 29 // user or cluster provisioner, and referenced in the PodSpec. The Kubelet is 30 // responsible for resolving the RuntimeClassName reference before running the 31 // pod. For more details, see 32 // https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class/README.md 33 type RuntimeClass struct { 34 metav1.TypeMeta 35 36 // +optional 37 metav1.ObjectMeta 38 39 // handler specifies the underlying runtime and configuration that the CRI 40 // implementation will use to handle pods of this class. The possible values 41 // are specific to the node & CRI configuration. It is assumed that all 42 // handlers are available on every node, and handlers of the same name are 43 // equivalent on every node. 44 // For example, a handler called "runc" might specify that the runc OCI 45 // runtime (using native Linux containers) will be used to run the containers 46 // in a pod. 47 // The Handler must conform to the DNS Label (RFC 1123) requirements, and is 48 // immutable. 49 Handler string 50 51 // overhead represents the resource overhead associated with running a pod for a 52 // given RuntimeClass. For more details, see 53 // https://git.k8s.io/enhancements/keps/sig-network/580-pod-readiness-gates 54 // +optional 55 Overhead *Overhead 56 57 // scheduling holds the scheduling constraints to ensure that pods running 58 // with this RuntimeClass are scheduled to nodes that support it. 59 // If scheduling is nil, this RuntimeClass is assumed to be supported by all 60 // nodes. 61 // +optional 62 Scheduling *Scheduling 63 } 64 65 // Overhead structure represents the resource overhead associated with running a pod. 66 type Overhead struct { 67 // podFixed represents the fixed resource overhead associated with running a pod. 68 // +optional 69 PodFixed core.ResourceList 70 } 71 72 // Scheduling specifies the scheduling constraints for nodes supporting a 73 // RuntimeClass. 74 type Scheduling struct { 75 // nodeSelector lists labels that must be present on nodes that support this 76 // RuntimeClass. Pods using this RuntimeClass can only be scheduled to a 77 // node matched by this selector. The RuntimeClass nodeSelector is merged 78 // with a pod's existing nodeSelector. Any conflicts will cause the pod to 79 // be rejected in admission. 80 // +optional 81 NodeSelector map[string]string 82 83 // tolerations are appended (excluding duplicates) to pods running with this 84 // RuntimeClass during admission, effectively unioning the set of nodes 85 // tolerated by the pod and the RuntimeClass. 86 // +optional 87 Tolerations []core.Toleration 88 } 89 90 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 91 92 // RuntimeClassList is a list of RuntimeClass objects. 93 type RuntimeClassList struct { 94 metav1.TypeMeta 95 96 // +optional 97 metav1.ListMeta 98 99 // items is a list of schema objects. 100 Items []RuntimeClass 101 } 102