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