...

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

Documentation: k8s.io/api/node/v1beta1

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

View as plain text