Zack Williams | e940c7a | 2019-08-21 14:25:39 -0700 | [diff] [blame] | 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 v1alpha1 |
| 18 | |
| 19 | import ( |
Zack Williams | e940c7a | 2019-08-21 14:25:39 -0700 | [diff] [blame] | 20 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | ) |
| 22 | |
| 23 | // +genclient |
| 24 | // +genclient:nonNamespaced |
| 25 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 26 | |
| 27 | // RuntimeClass defines a class of container runtime supported in the cluster. |
| 28 | // The RuntimeClass is used to determine which container runtime is used to run |
| 29 | // all containers in a pod. RuntimeClasses are (currently) manually defined by a |
| 30 | // user or cluster provisioner, and referenced in the PodSpec. The Kubelet is |
| 31 | // responsible for resolving the RuntimeClassName reference before running the |
| 32 | // pod. For more details, see |
| 33 | // https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md |
| 34 | type RuntimeClass struct { |
| 35 | metav1.TypeMeta `json:",inline"` |
| 36 | // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata |
| 37 | // +optional |
| 38 | metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 39 | |
| 40 | // Specification of the RuntimeClass |
| 41 | // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status |
| 42 | Spec RuntimeClassSpec `json:"spec" protobuf:"bytes,2,name=spec"` |
| 43 | } |
| 44 | |
| 45 | // RuntimeClassSpec is a specification of a RuntimeClass. It contains parameters |
| 46 | // that are required to describe the RuntimeClass to the Container Runtime |
| 47 | // Interface (CRI) implementation, as well as any other components that need to |
| 48 | // understand how the pod will be run. The RuntimeClassSpec is immutable. |
| 49 | type RuntimeClassSpec struct { |
| 50 | // RuntimeHandler specifies the underlying runtime and configuration that the |
| 51 | // CRI implementation will use to handle pods of this class. The possible |
| 52 | // values are specific to the node & CRI configuration. It is assumed that |
| 53 | // all handlers are available on every node, and handlers of the same name are |
| 54 | // equivalent on every node. |
| 55 | // For example, a handler called "runc" might specify that the runc OCI |
| 56 | // runtime (using native Linux containers) will be used to run the containers |
| 57 | // in a pod. |
| 58 | // The RuntimeHandler must conform to the DNS Label (RFC 1123) requirements |
| 59 | // and is immutable. |
| 60 | RuntimeHandler string `json:"runtimeHandler" protobuf:"bytes,1,opt,name=runtimeHandler"` |
Zack Williams | e940c7a | 2019-08-21 14:25:39 -0700 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 64 | |
| 65 | // RuntimeClassList is a list of RuntimeClass objects. |
| 66 | type RuntimeClassList struct { |
| 67 | metav1.TypeMeta `json:",inline"` |
| 68 | // Standard list metadata. |
| 69 | // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata |
| 70 | // +optional |
| 71 | metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 72 | |
| 73 | // Items is a list of schema objects. |
| 74 | Items []RuntimeClass `json:"items" protobuf:"bytes,2,rep,name=items"` |
| 75 | } |