k8s.io/kubernetes@v1.29.3/pkg/apis/scheduling/types.go (about)

     1  /*
     2  Copyright 2017 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 scheduling
    18  
    19  import (
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  	"k8s.io/kubernetes/pkg/apis/core"
    22  )
    23  
    24  const (
    25  	// DefaultPriorityWhenNoDefaultClassExists is used to set priority of pods
    26  	// that do not specify any priority class and there is no priority class
    27  	// marked as default.
    28  	DefaultPriorityWhenNoDefaultClassExists = 0
    29  	// HighestUserDefinablePriority is the highest priority for user defined priority classes. Priority values larger than 1 billion are reserved for Kubernetes system use.
    30  	HighestUserDefinablePriority = int32(1000000000)
    31  	// SystemCriticalPriority is the beginning of the range of priority values for critical system components.
    32  	SystemCriticalPriority = 2 * HighestUserDefinablePriority
    33  	// SystemPriorityClassPrefix is the prefix reserved for system priority class names. Other priority
    34  	// classes are not allowed to start with this prefix.
    35  	// NOTE: In order to avoid conflict of names with user-defined priority classes, all the names must
    36  	// start with SystemPriorityClassPrefix.
    37  	SystemPriorityClassPrefix = "system-"
    38  	// SystemClusterCritical is the system priority class name that represents cluster-critical.
    39  	SystemClusterCritical = SystemPriorityClassPrefix + "cluster-critical"
    40  	// SystemNodeCritical is the system priority class name that represents node-critical.
    41  	SystemNodeCritical = SystemPriorityClassPrefix + "node-critical"
    42  )
    43  
    44  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    45  
    46  // PriorityClass defines the mapping from a priority class name to the priority
    47  // integer value. The value can be any valid integer.
    48  type PriorityClass struct {
    49  	metav1.TypeMeta
    50  	// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
    51  	// +optional
    52  	metav1.ObjectMeta
    53  
    54  	// value represents the integer value of this priority class. This is the actual priority that pods
    55  	// receive when they have the name of this class in their pod spec.
    56  	Value int32
    57  
    58  	// globalDefault specifies whether this PriorityClass should be considered as
    59  	// the default priority for pods that do not have any priority class.
    60  	// Only one PriorityClass can be marked as `globalDefault`. However, if more than
    61  	// one PriorityClasses exists with their `globalDefault` field set to true,
    62  	// the smallest value of such global default PriorityClasses will be used as the default priority.
    63  	// +optional
    64  	GlobalDefault bool
    65  
    66  	// description is an arbitrary string that usually provides guidelines on
    67  	// when this priority class should be used.
    68  	// +optional
    69  	Description string
    70  
    71  	// preemptionPolicy it the Policy for preempting pods with lower priority.
    72  	// This field is beta-level.
    73  	// +optional
    74  	PreemptionPolicy *core.PreemptionPolicy
    75  }
    76  
    77  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    78  
    79  // PriorityClassList is a collection of priority classes.
    80  type PriorityClassList struct {
    81  	metav1.TypeMeta
    82  	// Standard list metadata.
    83  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
    84  	// +optional
    85  	metav1.ListMeta
    86  
    87  	// items is the list of PriorityClasses.
    88  	Items []PriorityClass
    89  }