File tree 2 files changed +24
-3
lines changed 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -2274,6 +2274,10 @@ func (f *Factory) PrometheusOperatorUserWorkloadDeployment() (*appsv1.Deployment
2274
2274
d .Spec .Template .Spec .Tolerations = f .config .UserWorkloadConfiguration .PrometheusOperator .Tolerations
2275
2275
}
2276
2276
2277
+ if len (f .config .UserWorkloadConfiguration .PrometheusOperator .TopologySpreadConstraints ) > 0 {
2278
+ d .Spec .Template .Spec .TopologySpreadConstraints = f .config .UserWorkloadConfiguration .PrometheusOperator .TopologySpreadConstraints
2279
+ }
2280
+
2277
2281
for i , container := range d .Spec .Template .Spec .Containers {
2278
2282
switch container .Name {
2279
2283
case "kube-rbac-proxy" :
Original file line number Diff line number Diff line change @@ -4386,9 +4386,18 @@ func TestPodDisruptionBudget(t *testing.T) {
4386
4386
}
4387
4387
4388
4388
func TestPrometheusOperatorUserWorkloadConfiguration (t * testing.T ) {
4389
- c , err := NewConfigFromString (`
4390
- enableUserWorkload: true
4391
- ` , false )
4389
+ c := NewDefaultConfig ()
4390
+ uwc , err := NewUserConfigFromString (`prometheusOperator:
4391
+ topologySpreadConstraints:
4392
+ - maxSkew: 1
4393
+ topologyKey: type
4394
+ whenUnsatisfiable: DoNotSchedule
4395
+ labelSelector:
4396
+ matchLabels:
4397
+ foo: bar
4398
+ ` )
4399
+
4400
+ c .UserWorkloadConfiguration = uwc
4392
4401
4393
4402
c .SetImages (map [string ]string {
4394
4403
"prometheus-operator" : "docker.io/openshift/origin-prometheus-operator:latest" ,
@@ -4463,6 +4472,14 @@ enableUserWorkload: true
4463
4472
if ! reflect .DeepEqual (d , d2 ) {
4464
4473
t .Fatal ("expected PrometheusOperatorUserWorkloadDeployment to be an idempotent function" )
4465
4474
}
4475
+
4476
+ if d .Spec .Template .Spec .TopologySpreadConstraints [0 ].MaxSkew != 1 {
4477
+ t .Fatal ("prometheus-operator UWM spread contraints MaxSkew not configured correctly" )
4478
+ }
4479
+
4480
+ if d .Spec .Template .Spec .TopologySpreadConstraints [0 ].WhenUnsatisfiable != "DoNotSchedule" {
4481
+ t .Fatal ("prometheus-operator UWM spread contraints WhenUnsatisfiable not configured correctly" )
4482
+ }
4466
4483
}
4467
4484
4468
4485
func TestPrometheusOperatorNodeSelector (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments