File tree 5 files changed +25
-0
lines changed 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 @@ -2174,6 +2174,11 @@ func (f *Factory) PrometheusOperatorAdmissionWebhookDeployment() (*appsv1.Deploy
2174
2174
d .Spec .Template .Spec .Tolerations = f .config .ClusterMonitoringConfiguration .PrometheusOperatorConfig .Tolerations
2175
2175
}
2176
2176
2177
+ if len (f .config .ClusterMonitoringConfiguration .PrometheusOperatorConfig .TopologySpreadConstraints ) > 0 {
2178
+ d .Spec .Template .Spec .TopologySpreadConstraints =
2179
+ f .config .ClusterMonitoringConfiguration .PrometheusOperatorConfig .TopologySpreadConstraints
2180
+ }
2181
+
2177
2182
for i , container := range d .Spec .Template .Spec .Containers {
2178
2183
switch container .Name {
2179
2184
case "prometheus-operator-admission-webhook" :
Original file line number Diff line number Diff line change @@ -827,6 +827,13 @@ func TestPrometheusOperatorAdmissionWebhookConfiguration(t *testing.T) {
827
827
c , err := NewConfigFromString (`prometheusOperator:
828
828
nodeSelector:
829
829
type: master
830
+ topologySpreadConstraints:
831
+ - maxSkew: 1
832
+ topologyKey: type
833
+ whenUnsatisfiable: DoNotSchedule
834
+ labelSelector:
835
+ matchLabels:
836
+ foo: bar
830
837
` , false )
831
838
832
839
c .SetImages (map [string ]string {
@@ -851,6 +858,14 @@ func TestPrometheusOperatorAdmissionWebhookConfiguration(t *testing.T) {
851
858
t .Fatalf ("expected node selector to be master, got %q" , got )
852
859
}
853
860
861
+ if d .Spec .Template .Spec .TopologySpreadConstraints [0 ].MaxSkew != 1 {
862
+ t .Fatal ("k8s-prometheus-operator topology spread contraints MaxSkew not configured correctly" )
863
+ }
864
+
865
+ if d .Spec .Template .Spec .TopologySpreadConstraints [0 ].WhenUnsatisfiable != "DoNotSchedule" {
866
+ t .Fatal ("k8s-prometheus-operator topology spread contraints WhenUnsatisfiable not configured correctly" )
867
+ }
868
+
854
869
webTLSCipherSuitesArg := ""
855
870
webTLSVersionArg := ""
856
871
for _ , container := range d .Spec .Template .Spec .Containers {
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