blob: e91842ec4da2698e49fc5b01f567159a24553b4c [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 v1
18
19import (
20 apiv1 "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// PriorityClass defines mapping from a priority class name to the priority
29// integer value. The value can be any valid integer.
30type PriorityClass struct {
31 metav1.TypeMeta `json:",inline"`
32 // Standard object's metadata.
33 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
34 // +optional
35 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
36
37 // The value of this priority class. This is the actual priority that pods
38 // receive when they have the name of this class in their pod spec.
39 Value int32 `json:"value" protobuf:"bytes,2,opt,name=value"`
40
41 // globalDefault specifies whether this PriorityClass should be considered as
42 // the default priority for pods that do not have any priority class.
43 // Only one PriorityClass can be marked as `globalDefault`. However, if more than
44 // one PriorityClasses exists with their `globalDefault` field set to true,
45 // the smallest value of such global default PriorityClasses will be used as the default priority.
46 // +optional
47 GlobalDefault bool `json:"globalDefault,omitempty" protobuf:"bytes,3,opt,name=globalDefault"`
48
49 // description is an arbitrary string that usually provides guidelines on
50 // when this priority class should be used.
51 // +optional
52 Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"`
53
54 // PreemptionPolicy is the Policy for preempting pods with lower priority.
55 // One of Never, PreemptLowerPriority.
56 // Defaults to PreemptLowerPriority if unset.
57 // This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
58 // +optional
59 PreemptionPolicy *apiv1.PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,5,opt,name=preemptionPolicy"`
60}
61
62// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
63
64// PriorityClassList is a collection of priority classes.
65type PriorityClassList struct {
66 metav1.TypeMeta `json:",inline"`
67 // Standard list metadata
68 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
69 // +optional
70 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
71
72 // items is the list of PriorityClasses
73 Items []PriorityClass `json:"items" protobuf:"bytes,2,rep,name=items"`
74}