Skip to content

Commit baf019d

Browse files
authored
Merge pull request #388 from ingvagabund/metrics-utilization-api
Metrics utilization api
2 parents 87c57f7 + 05901c2 commit baf019d

File tree

254 files changed

+64746
-1801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+64746
-1801
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,29 @@ the `profileCustomizations` field:
176176
| `devLowNodeUtilizationThresholds` | `string` | Sets experimental thresholds for the [LowNodeUtilization](https://github.com/kubernetes-sigs/descheduler#lownodeutilization) strategy of the `LifecycleAndUtilization` profile in the following ratios: `Low` for 10%:30%, `Medium` for 20%:50%, `High` for 40%:70%|
177177
|`devEnableEvictionsInBackground`|`bool`| Enables descheduler's EvictionsInBackground alpha feature. The EvictionsInBackground alpha feature is a subject to change. Currently provided as an experimental feature.|
178178
| `devHighNodeUtilizationThresholds` | `string` | Sets thresholds for the [HighNodeUtilization](https://github.com/kubernetes-sigs/descheduler#highnodeutilization) strategy of the `CompactAndScale` profile in the following ratios: `Minimal` for 10%, `Modest` for 20%, `Moderate` for 30%. Currently provided as an experimental feature.|
179+
|`devActualUtilizationProfile`|`string`| Sets a profile that gets translated into a predefined prometheus query |
180+
181+
## Prometheus query profiles
182+
The operator provides the following profiles:
183+
- `PrometheusCPUUsage`: `instance:node_cpu:rate:sum` (metric available in OpenShift by default)
184+
- `PrometheusCPUPSIPressure`: `rate(node_pressure_cpu_waiting_seconds_total[1m])` (`node_pressure_cpu_waiting_seconds_total` is a custom metric that needs to be provided)
185+
- `PrometheusMemoryPSIPressure`: `rate(node_pressure_memory_waiting_seconds_total[1m])` (`node_pressure_memory_waiting_seconds_total` is a custom metric that needs to be provided)
186+
- `PrometheusIOPSIPressure`: `rate(node_pressure_io_waiting_seconds_total[1m])` (`node_pressure_memory_waiting_seconds_total` is a custom metric that needs to be provided)
187+
188+
```yaml
189+
apiVersion: operator.openshift.io/v1
190+
kind: KubeDescheduler
191+
metadata:
192+
name: cluster
193+
namespace: openshift-kube-descheduler-operator
194+
spec:
195+
managementState: Managed
196+
deschedulingIntervalSeconds: 3600
197+
profiles:
198+
- LongLifecycle
199+
profileCustomizations:
200+
devActualUtilizationProfile: PrometheusCPUUsage
201+
```
179202
180203
## Descheduling modes
181204
The operator provides two modes of eviction:

bindata/assets/kube-descheduler/operandclusterrole.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ rules:
3939
- "get"
4040
- "watch"
4141
- "list"
42+
- apiGroups:
43+
- "policy"
44+
resources:
45+
- "poddisruptionbudgets"
46+
verbs:
47+
- "get"
48+
- "watch"
49+
- "list"
4250
- apiGroups:
4351
- "coordination.k8s.io"
4452
resources:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: cluster-monitoring-view-cr
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: cluster-monitoring-view
9+
subjects:
10+
- kind: ServiceAccount
11+
name: openshift-descheduler-operand
12+
namespace: openshift-kube-descheduler-operator

deploy/02_clusterrole.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ rules:
2424
- patch
2525
- delete
2626
- deletecollection
27+
- apiGroups:
28+
- monitoring.coreos.com
29+
resources:
30+
- prometheuses/api
31+
resourceNames:
32+
- k8s
33+
verbs:
34+
- get
35+
- create
36+
- update
2737
- apiGroups:
2838
- operator.openshift.io
2939
resources:
@@ -95,6 +105,14 @@ rules:
95105
- get
96106
- watch
97107
- list
108+
- apiGroups:
109+
- policy
110+
resources:
111+
- poddisruptionbudgets
112+
verbs:
113+
- get
114+
- watch
115+
- list
98116
- apiGroups:
99117
- apps
100118
resources:
@@ -150,6 +168,14 @@ rules:
150168
- get
151169
- watch
152170
- list
171+
- apiGroups:
172+
- route.openshift.io
173+
resources:
174+
- routes
175+
verbs:
176+
- get
177+
- watch
178+
- list
153179
- apiGroups:
154180
- ""
155181
resources:

go.mod

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,22 @@ require (
1414
github.com/openshift/library-go v0.0.0-20241015180910-c0f6295482a7
1515
github.com/prometheus/client_golang v1.19.1
1616
github.com/spf13/cobra v1.8.1
17-
k8s.io/api v0.31.1
18-
k8s.io/apiextensions-apiserver v0.31.1
19-
k8s.io/apimachinery v0.31.1
20-
k8s.io/client-go v0.31.1
21-
k8s.io/code-generator v0.31.1
22-
k8s.io/component-base v0.31.1
17+
k8s.io/api v0.31.2
18+
k8s.io/apiextensions-apiserver v0.31.2
19+
k8s.io/apimachinery v0.31.2
20+
k8s.io/client-go v0.31.2
21+
k8s.io/code-generator v0.31.2
22+
k8s.io/component-base v0.31.2
2323
k8s.io/klog/v2 v2.130.1
2424
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6
25-
sigs.k8s.io/controller-tools v0.15.0
25+
sigs.k8s.io/controller-tools v0.16.5
2626
sigs.k8s.io/descheduler v0.31.1-0.20241015202104-ef0c2c1c47c6
27+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
28+
)
29+
30+
replace (
31+
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f
32+
sigs.k8s.io/descheduler => github.com/openshift/descheduler v0.5.1-0.20241119121611-9244957ecbe2
2733
)
2834

2935
require (
@@ -39,17 +45,17 @@ require (
3945
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
4046
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
4147
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
42-
github.com/fatih/color v1.16.0 // indirect
48+
github.com/fatih/color v1.18.0 // indirect
4349
github.com/felixge/fgprof v0.9.4 // indirect
4450
github.com/felixge/httpsnoop v1.0.4 // indirect
4551
github.com/fsnotify/fsnotify v1.7.0 // indirect
4652
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
4753
github.com/go-logr/logr v1.4.2 // indirect
4854
github.com/go-logr/stdr v1.2.2 // indirect
49-
github.com/go-openapi/jsonpointer v0.19.6 // indirect
55+
github.com/go-openapi/jsonpointer v0.20.0 // indirect
5056
github.com/go-openapi/jsonreference v0.20.2 // indirect
5157
github.com/go-openapi/swag v0.22.4 // indirect
52-
github.com/gobuffalo/flect v1.0.2 // indirect
58+
github.com/gobuffalo/flect v1.0.3 // indirect
5359
github.com/gogo/protobuf v1.3.2 // indirect
5460
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
5561
github.com/golang/protobuf v1.5.4 // indirect
@@ -60,7 +66,7 @@ require (
6066
github.com/google/uuid v1.6.0 // indirect
6167
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
6268
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
63-
github.com/imdario/mergo v0.3.7 // indirect
69+
github.com/imdario/mergo v0.3.16 // indirect
6470
github.com/inconshreveable/mousetrap v1.1.0 // indirect
6571
github.com/josharian/intern v1.0.0 // indirect
6672
github.com/json-iterator/go v1.1.12 // indirect
@@ -94,17 +100,17 @@ require (
94100
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
95101
go.uber.org/multierr v1.11.0 // indirect
96102
go.uber.org/zap v1.26.0 // indirect
97-
golang.org/x/crypto v0.27.0 // indirect
103+
golang.org/x/crypto v0.28.0 // indirect
98104
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
99-
golang.org/x/mod v0.17.0 // indirect
100-
golang.org/x/net v0.29.0 // indirect
105+
golang.org/x/mod v0.21.0 // indirect
106+
golang.org/x/net v0.30.0 // indirect
101107
golang.org/x/oauth2 v0.21.0 // indirect
102108
golang.org/x/sync v0.8.0 // indirect
103-
golang.org/x/sys v0.25.0 // indirect
104-
golang.org/x/term v0.24.0 // indirect
105-
golang.org/x/text v0.18.0 // indirect
109+
golang.org/x/sys v0.26.0 // indirect
110+
golang.org/x/term v0.25.0 // indirect
111+
golang.org/x/text v0.19.0 // indirect
106112
golang.org/x/time v0.3.0 // indirect
107-
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
113+
golang.org/x/tools v0.26.0 // indirect
108114
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
109115
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
110116
google.golang.org/grpc v1.65.0 // indirect
@@ -114,15 +120,15 @@ require (
114120
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
115121
gopkg.in/yaml.v2 v2.4.0 // indirect
116122
gopkg.in/yaml.v3 v3.0.1 // indirect
117-
k8s.io/apiserver v0.31.1 // indirect
123+
k8s.io/apiserver v0.31.2 // indirect
118124
k8s.io/component-helpers v0.31.0 // indirect
119125
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
120-
k8s.io/kms v0.31.1 // indirect
126+
k8s.io/kms v0.31.2 // indirect
121127
k8s.io/kube-aggregator v0.31.1 // indirect
122-
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
128+
k8s.io/kube-openapi v0.30.0 // indirect
129+
k8s.io/metrics v0.31.2 // indirect
123130
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect
124131
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
125132
sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96 // indirect
126-
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
127133
sigs.k8s.io/yaml v1.4.0 // indirect
128134
)

0 commit comments

Comments
 (0)