File tree Expand file tree Collapse file tree 5 files changed +25
-0
lines changed Expand file tree Collapse file tree 5 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -448,6 +448,7 @@ The `PrometheusOperatorAdmissionWebhookConfig` resource defines settings for the
448
448
| Property | Type | Description |
449
449
| -------- | ---- | ----------- |
450
450
| resources | * [ v1.ResourceRequirements] ( https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#resourcerequirements-v1-core ) | Defines resource requests and limits for the prometheus-operator-admission-webhook container. |
451
+ | topologySpreadConstraints | [ ] v1.TopologySpreadConstraint | Defines a pod's topology spread constraints. |
451
452
452
453
[ Back to TOC] ( #table-of-contents )
453
454
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ Appears in: link:clustermonitoringconfiguration.adoc[ClusterMonitoringConfigurat
20
20
| Property | Type | Description
21
21
|resources|*v1.ResourceRequirements|Defines resource requests and limits for the prometheus-operator-admission-webhook container.
22
22
23
+ |topologySpreadConstraints|[]v1.TopologySpreadConstraint|Defines a pod's topology spread constraints.
24
+
23
25
|===
24
26
25
27
link:../index.adoc[Back to TOC]
Original file line number Diff line number Diff line change @@ -2170,6 +2170,11 @@ func (f *Factory) PrometheusOperatorAdmissionWebhookDeployment() (*appsv1.Deploy
2170
2170
d .Spec .Template .Spec .Tolerations = f .config .ClusterMonitoringConfiguration .PrometheusOperatorConfig .Tolerations
2171
2171
}
2172
2172
2173
+ if len (f .config .ClusterMonitoringConfiguration .PrometheusOperatorAdmissionWebhookConfig .TopologySpreadConstraints ) > 0 {
2174
+ d .Spec .Template .Spec .TopologySpreadConstraints =
2175
+ f .config .ClusterMonitoringConfiguration .PrometheusOperatorAdmissionWebhookConfig .TopologySpreadConstraints
2176
+ }
2177
+
2173
2178
for i , container := range d .Spec .Template .Spec .Containers {
2174
2179
switch container .Name {
2175
2180
case "prometheus-operator-admission-webhook" :
Original file line number Diff line number Diff line change @@ -899,6 +899,13 @@ prometheusOperatorAdmissionWebhook:
899
899
limits:
900
900
cpu: 200m
901
901
memory: 200Mi
902
+ topologySpreadConstraints:
903
+ - maxSkew: 1
904
+ topologyKey: type
905
+ whenUnsatisfiable: DoNotSchedule
906
+ labelSelector:
907
+ matchLabels:
908
+ foo: bar
902
909
` , false )
903
910
if err != nil {
904
911
t .Fatal (err )
@@ -910,6 +917,14 @@ prometheusOperatorAdmissionWebhook:
910
917
t .Fatal (err )
911
918
}
912
919
920
+ if d .Spec .Template .Spec .TopologySpreadConstraints [0 ].MaxSkew != 1 {
921
+ t .Fatal ("prometheus-operator-admission-webhook topology spread constraints MaxSkew not configured correctly" )
922
+ }
923
+
924
+ if d .Spec .Template .Spec .TopologySpreadConstraints [0 ].WhenUnsatisfiable != "DoNotSchedule" {
925
+ t .Fatal ("prometheus-operator-admission-webhook topology spread constraints WhenUnsatisfiable not configured correctly" )
926
+ }
927
+
913
928
for _ , container := range d .Spec .Template .Spec .Containers {
914
929
switch container .Name {
915
930
case "prometheus-operator-admission-webhook" :
Original file line number Diff line number Diff line change @@ -681,6 +681,8 @@ type ThanosRulerConfig struct {
681
681
type PrometheusOperatorAdmissionWebhookConfig struct {
682
682
// Defines resource requests and limits for the prometheus-operator-admission-webhook container.
683
683
Resources * v1.ResourceRequirements `json:"resources,omitempty"`
684
+ // Defines a pod's topology spread constraints.
685
+ TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
684
686
}
685
687
686
688
// The `MonitoringPluginConfig` resource defines settings for the
You can’t perform that action at this time.
0 commit comments