forked from kubernetes-sigs/scheduler-plugins
/
types.go
148 lines (117 loc) · 5.59 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta2
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
schedulerconfigv1beta2 "k8s.io/kube-scheduler/config/v1beta2"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CoschedulingArgs defines the scheduling parameters for Coscheduling plugin.
type CoschedulingArgs struct {
metav1.TypeMeta `json:",inline"`
// PermitWaitingTimeSeconds is the waiting timeout in seconds.
PermitWaitingTimeSeconds *int64 `json:"permitWaitingTimeSeconds,omitempty"`
// DeniedPGExpirationTimeSeconds is the expiration time of the denied podgroup store.
DeniedPGExpirationTimeSeconds *int64 `json:"deniedPGExpirationTimeSeconds,omitempty"`
}
// ModeType is a type "string".
type ModeType string
const (
// Least is the string "Least".
Least ModeType = "Least"
// Most is the string "Most".
Most ModeType = "Most"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// NodeResourcesAllocatableArgs holds arguments used to configure NodeResourcesAllocatable plugin.
type NodeResourcesAllocatableArgs struct {
metav1.TypeMeta `json:",inline"`
// Resources to be considered when scoring.
// Allowed weights start from 1.
// An example resource set might include "cpu" (millicores) and "memory" (bytes)
// with weights of 1<<20 and 1 respectfully. That would mean 1 MiB has equivalent
// weight as 1 millicore.
Resources []schedulerconfigv1beta2.ResourceSpec `json:"resources,omitempty"`
// Whether to prioritize nodes with least or most allocatable resources.
Mode ModeType `json:"mode,omitempty"`
}
// MetricProviderType is a "string" type.
type MetricProviderType string
const (
KubernetesMetricsServer MetricProviderType = "KubernetesMetricsServer"
Prometheus MetricProviderType = "Prometheus"
SignalFx MetricProviderType = "SignalFx"
)
// Denote the spec of the metric provider
type MetricProviderSpec struct {
// Types of the metric provider
Type MetricProviderType `json:"type,omitempty"`
// The address of the metric provider
Address *string `json:"address,omitempty"`
// The authentication token of the metric provider
Token *string `json:"token,omitempty"`
// Whether to enable the InsureSkipVerify options for https requests on Prometheus Metric Provider.
InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// TargetLoadPackingArgs holds arguments used to configure TargetLoadPacking plugin.
type TargetLoadPackingArgs struct {
metav1.TypeMeta `json:",inline"`
// Default requests to use for best effort QoS
DefaultRequests v1.ResourceList `json:"defaultRequests,omitempty"`
// Default requests multiplier for busrtable QoS
DefaultRequestsMultiplier *string `json:"defaultRequestsMultiplier,omitempty"`
// Node target CPU Utilization for bin packing
TargetUtilization *int64 `json:"targetUtilization,omitempty"`
// Specify the metric provider type, address and token using MetricProviderSpec
MetricProvider MetricProviderSpec `json:"metricProvider,omitempty"`
// Address of load watcher service
WatcherAddress *string `json:"watcherAddress,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// LoadVariationRiskBalancingArgs holds arguments used to configure LoadVariationRiskBalancing plugin.
type LoadVariationRiskBalancingArgs struct {
metav1.TypeMeta `json:",inline"`
// Metric Provider specification when using load watcher as library
MetricProvider MetricProviderSpec `json:"metricProvider,omitempty"`
// Address of load watcher service
WatcherAddress *string `json:"watcherAddress,omitempty"`
// Multiplier of standard deviation in risk value
SafeVarianceMargin *float64 `json:"safeVarianceMargin,omitempty"`
// Root power of standard deviation in risk value
SafeVarianceSensitivity *float64 `json:"safeVarianceSensitivity,omitempty"`
}
// ScoringStrategyType is a "string" type.
type ScoringStrategyType string
const (
// MostAllocated strategy favors node with the least amount of available resource
MostAllocated ScoringStrategyType = "MostAllocated"
// BalancedAllocation strategy favors nodes with balanced resource usage rate
BalancedAllocation ScoringStrategyType = "BalancedAllocation"
// LeastAllocated strategy favors node with the most amount of available resource
LeastAllocated ScoringStrategyType = "LeastAllocated"
)
type ScoringStrategy struct {
Type ScoringStrategyType `json:"type,omitempty"`
Resources []schedulerconfigv1beta2.ResourceSpec `json:"resources,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// NodeResourceTopologyMatchArgs holds arguments used to configure the NodeResourceTopologyMatch plugin
type NodeResourceTopologyMatchArgs struct {
metav1.TypeMeta `json:",inline"`
ScoringStrategy *ScoringStrategy `json:"scoringStrategy,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PreemptionTolerationArgs reuses DefaultPluginArgs.
type PreemptionTolerationArgs schedulerconfigv1beta2.DefaultPreemptionArgs