blob: f389322d7be6fc6a558dedbe7530daf1f586e966 [file] [log] [blame]
Zack Williamse940c7a2019-08-21 14:25:39 -07001/*
2Copyright 2019 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 v1beta1
18
19import (
20 corev1 "k8s.io/api/core/v1"
21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22)
23
24// +genclient
25// +genclient:nonNamespaced
26// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
27
28// RuntimeClass defines a class of container runtime supported in the cluster.
29// The RuntimeClass is used to determine which container runtime is used to run
30// all containers in a pod. RuntimeClasses are (currently) manually defined by a
31// user or cluster provisioner, and referenced in the PodSpec. The Kubelet is
32// responsible for resolving the RuntimeClassName reference before running the
33// pod. For more details, see
34// https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md
35type RuntimeClass struct {
36 metav1.TypeMeta `json:",inline"`
37 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
38 // +optional
39 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
40
41 // Handler specifies the underlying runtime and configuration that the CRI
42 // implementation will use to handle pods of this class. The possible values
43 // are specific to the node & CRI configuration. It is assumed that all
44 // handlers are available on every node, and handlers of the same name are
45 // equivalent on every node.
46 // For example, a handler called "runc" might specify that the runc OCI
47 // runtime (using native Linux containers) will be used to run the containers
48 // in a pod.
49 // The Handler must conform to the DNS Label (RFC 1123) requirements, and is
50 // immutable.
51 Handler string `json:"handler" protobuf:"bytes,2,opt,name=handler"`
52
53 // Overhead represents the resource overhead associated with running a pod for a
54 // given RuntimeClass. For more details, see
55 // https://git.k8s.io/enhancements/keps/sig-node/20190226-pod-overhead.md
56 // This field is alpha-level as of Kubernetes v1.15, and is only honored by servers that enable the PodOverhead feature.
57 // +optional
58 Overhead *Overhead `json:"overhead,omitempty" protobuf:"bytes,3,opt,name=overhead"`
59}
60
61// Overhead structure represents the resource overhead associated with running a pod.
62type Overhead struct {
63 // PodFixed represents the fixed resource overhead associated with running a pod.
64 // +optional
65 PodFixed corev1.ResourceList `json:"podFixed,omitempty" protobuf:"bytes,1,opt,name=podFixed,casttype=k8s.io/api/core/v1.ResourceList,castkey=k8s.io/api/core/v1.ResourceName,castvalue=k8s.io/apimachinery/pkg/api/resource.Quantity"`
66}
67
68// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
69
70// RuntimeClassList is a list of RuntimeClass objects.
71type RuntimeClassList struct {
72 metav1.TypeMeta `json:",inline"`
73 // Standard list metadata.
74 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
75 // +optional
76 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
77
78 // Items is a list of schema objects.
79 Items []RuntimeClass `json:"items" protobuf:"bytes,2,rep,name=items"`
80}