forked from kubernetes-sigs/scheduler-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
172 lines (135 loc) · 5.33 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
Copyright 2020 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 config
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
schedconfig "k8s.io/kubernetes/pkg/scheduler/apis/config"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CoschedulingArgs defines the parameters for Coscheduling plugin.
type CoschedulingArgs struct {
metav1.TypeMeta
// PermitWaitingTimeSeconds is the waiting timeout in seconds.
PermitWaitingTimeSeconds int64
}
// ModeType is a "string" type.
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 []schedconfig.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
// The address of the metric provider
Address string
// The authentication token of the metric provider
Token string
// Whether to enable the InsureSkipVerify options for https requests on Metric Providers.
InsecureSkipVerify bool
}
// TrimaranSpec holds common parameters for trimaran plugins
type TrimaranSpec struct {
// Metric Provider to use when using load watcher as a library
MetricProvider MetricProviderSpec
// Address of load watcher service
WatcherAddress string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// TargetLoadPackingArgs holds arguments used to configure TargetLoadPacking plugin.
type TargetLoadPackingArgs struct {
metav1.TypeMeta
// Common parameters for trimaran plugins
TrimaranSpec
// Default requests to use for best effort QoS
DefaultRequests v1.ResourceList
// Default requests multiplier for busrtable QoS
DefaultRequestsMultiplier string
// Node target CPU Utilization for bin packing
TargetUtilization int64
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// LoadVariationRiskBalancingArgs holds arguments used to configure LoadVariationRiskBalancing plugin.
type LoadVariationRiskBalancingArgs struct {
metav1.TypeMeta
// Common parameters for trimaran plugins
TrimaranSpec
// Multiplier of standard deviation in risk value
SafeVarianceMargin float64
// Root power of standard deviation in risk value
SafeVarianceSensitivity float64
}
// 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"
)
// ScoringStrategy define ScoringStrategyType for node resource topology plugin
type ScoringStrategy struct {
// Type selects which strategy to run.
Type ScoringStrategyType
// Resources a list of pairs <resource, weight> to be considered while scoring
// allowed weights start from 1.
Resources []schedconfig.ResourceSpec
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// NodeResourceTopologyMatchArgs holds arguments used to configure the NodeResourceTopologyMatch plugin
type NodeResourceTopologyMatchArgs struct {
metav1.TypeMeta
// ScoringStrategy a scoring model that determine how the plugin will score the nodes.
ScoringStrategy ScoringStrategy
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PreemptionTolerationArgs reuses DefaultPluginArgs.
type PreemptionTolerationArgs schedconfig.DefaultPreemptionArgs
type ShmScoringTarget struct {
NodeName string
IP string
Port string
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ShmScoringArgs configures ShmScoring plugin
type ShmScoringArgs struct {
metav1.TypeMeta
// List of targets
Targets []ShmScoringTarget
}