...

Source file src/k8s.io/api/node/v1/types.go

Documentation: k8s.io/api/node/v1

     1  /*
     2  Copyright 2020 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 v1
    18  
    19  import (
    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 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://kubernetes.io/docs/concepts/containers/runtime-class/
    35  type RuntimeClass struct {
    36  	metav1.TypeMeta `json:",inline"`
    37  
    38  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    39  	// +optional
    40  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
    41  
    42  	// handler specifies the underlying runtime and configuration that the CRI
    43  	// implementation will use to handle pods of this class. The possible values
    44  	// are specific to the node & CRI configuration.  It is assumed that all
    45  	// handlers are available on every node, and handlers of the same name are
    46  	// equivalent on every node.
    47  	// For example, a handler called "runc" might specify that the runc OCI
    48  	// runtime (using native Linux containers) will be used to run the containers
    49  	// in a pod.
    50  	// The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements,
    51  	// and is immutable.
    52  	Handler string `json:"handler" protobuf:"bytes,2,opt,name=handler"`
    53  
    54  	// overhead represents the resource overhead associated with running a pod for a
    55  	// given RuntimeClass. For more details, see
    56  	//  https://kubernetes.io/docs/concepts/scheduling-eviction/pod-overhead/
    57  	// +optional
    58  	Overhead *Overhead `json:"overhead,omitempty" protobuf:"bytes,3,opt,name=overhead"`
    59  
    60  	// scheduling holds the scheduling constraints to ensure that pods running
    61  	// with this RuntimeClass are scheduled to nodes that support it.
    62  	// If scheduling is nil, this RuntimeClass is assumed to be supported by all
    63  	// nodes.
    64  	// +optional
    65  	Scheduling *Scheduling `json:"scheduling,omitempty" protobuf:"bytes,4,opt,name=scheduling"`
    66  }
    67  
    68  // Overhead structure represents the resource overhead associated with running a pod.
    69  type Overhead struct {
    70  	// podFixed represents the fixed resource overhead associated with running a pod.
    71  	// +optional
    72  	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"`
    73  }
    74  
    75  // Scheduling specifies the scheduling constraints for nodes supporting a
    76  // RuntimeClass.
    77  type Scheduling struct {
    78  	// nodeSelector lists labels that must be present on nodes that support this
    79  	// RuntimeClass. Pods using this RuntimeClass can only be scheduled to a
    80  	// node matched by this selector. The RuntimeClass nodeSelector is merged
    81  	// with a pod's existing nodeSelector. Any conflicts will cause the pod to
    82  	// be rejected in admission.
    83  	// +optional
    84  	// +mapType=atomic
    85  	NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,1,opt,name=nodeSelector"`
    86  
    87  	// tolerations are appended (excluding duplicates) to pods running with this
    88  	// RuntimeClass during admission, effectively unioning the set of nodes
    89  	// tolerated by the pod and the RuntimeClass.
    90  	// +optional
    91  	// +listType=atomic
    92  	Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,2,rep,name=tolerations"`
    93  }
    94  
    95  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    96  
    97  // RuntimeClassList is a list of RuntimeClass objects.
    98  type RuntimeClassList struct {
    99  	metav1.TypeMeta `json:",inline"`
   100  
   101  	// Standard list metadata.
   102  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   103  	// +optional
   104  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   105  
   106  	// items is a list of schema objects.
   107  	Items []RuntimeClass `json:"items" protobuf:"bytes,2,rep,name=items"`
   108  }
   109  

View as plain text