|
| 1 | +/* |
| 2 | +Copyright 2020 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 config |
| 18 | + |
| 19 | +import ( |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | +) |
| 22 | + |
| 23 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 24 | + |
| 25 | +// InterPodAffinityArgs holds arguments used to configure the InterPodAffinity plugin. |
| 26 | +type InterPodAffinityArgs struct { |
| 27 | + metav1.TypeMeta |
| 28 | + |
| 29 | + // HardPodAffinityWeight is the scoring weight for existing pods with a |
| 30 | + // matching hard affinity to the incoming pod. |
| 31 | + HardPodAffinityWeight int32 |
| 32 | +} |
| 33 | + |
| 34 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 35 | + |
| 36 | +// NodeLabelArgs holds arguments that used to configure the NodeLabel plugin. |
| 37 | +type NodeLabelArgs struct { |
| 38 | + metav1.TypeMeta |
| 39 | + |
| 40 | + // PresentLabels should be present for the node to be considered a fit for hosting the pod |
| 41 | + PresentLabels []string |
| 42 | + // AbsentLabels should be absent for the node to be considered a fit for hosting the pod |
| 43 | + AbsentLabels []string |
| 44 | + // Nodes that have labels in the list will get a higher score. |
| 45 | + PresentLabelsPreference []string |
| 46 | + // Nodes that don't have labels in the list will get a higher score. |
| 47 | + AbsentLabelsPreference []string |
| 48 | +} |
| 49 | + |
| 50 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 51 | + |
| 52 | +// NodeResourcesFitArgs holds arguments used to configure the NodeResourcesFit plugin. |
| 53 | +type NodeResourcesFitArgs struct { |
| 54 | + metav1.TypeMeta |
| 55 | + |
| 56 | + // IgnoredResources is the list of resources that NodeResources fit filter |
| 57 | + // should ignore. |
| 58 | + IgnoredResources []string |
| 59 | +} |
| 60 | + |
| 61 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 62 | + |
| 63 | +// RequestedToCapacityRatioArgs holds arguments used to configure RequestedToCapacityRatio plugin. |
| 64 | +type RequestedToCapacityRatioArgs struct { |
| 65 | + metav1.TypeMeta |
| 66 | + |
| 67 | + // Points defining priority function shape |
| 68 | + Shape []UtilizationShapePoint |
| 69 | + // Resources to be managed |
| 70 | + Resources []ResourceSpec |
| 71 | +} |
| 72 | + |
| 73 | +// UtilizationShapePoint represents a single point of a priority function shape. |
| 74 | +type UtilizationShapePoint struct { |
| 75 | + // Utilization (x axis). Valid values are 0 to 100. Fully utilized node maps to 100. |
| 76 | + Utilization int32 |
| 77 | + // Score assigned to a given utilization (y axis). Valid values are 0 to 10. |
| 78 | + Score int32 |
| 79 | +} |
| 80 | + |
| 81 | +// ResourceSpec represents single resource for bin packing of priority RequestedToCapacityRatioArgs. |
| 82 | +type ResourceSpec struct { |
| 83 | + // Name of the resource to be managed by RequestedToCapacityRatio function. |
| 84 | + Name string |
| 85 | + // Weight of the resource. |
| 86 | + Weight int64 |
| 87 | +} |
| 88 | + |
| 89 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 90 | + |
| 91 | +// ServiceAffinityArgs holds arguments used to configure the ServiceAffinity plugin. |
| 92 | +type ServiceAffinityArgs struct { |
| 93 | + metav1.TypeMeta |
| 94 | + |
| 95 | + // AffinityLabels are homogeneous for pods that are scheduled to a node. |
| 96 | + // (i.e. it returns true IFF this pod can be added to this node such that all other pods in |
| 97 | + // the same service are running on nodes with the exact same values for Labels). |
| 98 | + AffinityLabels []string |
| 99 | + // AntiAffinityLabelsPreference are the labels to consider for service anti affinity scoring. |
| 100 | + AntiAffinityLabelsPreference []string |
| 101 | +} |
0 commit comments