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 .PrometheusOperatorConfig .TopologySpreadConstraints ) > 0 {
2174
+ d .Spec .Template .Spec .TopologySpreadConstraints =
2175
+ f .config .ClusterMonitoringConfiguration .PrometheusOperatorConfig .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 @@ -828,6 +828,13 @@ func TestPrometheusOperatorAdmissionWebhookConfiguration(t *testing.T) {
828
828
c , err := NewConfigFromString (`prometheusOperator:
829
829
nodeSelector:
830
830
type: master
831
+ topologySpreadConstraints:
832
+ - maxSkew: 1
833
+ topologyKey: type
834
+ whenUnsatisfiable: DoNotSchedule
835
+ labelSelector:
836
+ matchLabels:
837
+ foo: bar
831
838
` , false )
832
839
833
840
c .SetImages (map [string ]string {
@@ -852,6 +859,14 @@ func TestPrometheusOperatorAdmissionWebhookConfiguration(t *testing.T) {
852
859
t .Fatalf ("expected node selector to be master, got %q" , got )
853
860
}
854
861
862
+ if d .Spec .Template .Spec .TopologySpreadConstraints [0 ].MaxSkew != 1 {
863
+ t .Fatal ("k8s-prometheus-operator topology spread contraints MaxSkew not configured correctly" )
864
+ }
865
+
866
+ if d .Spec .Template .Spec .TopologySpreadConstraints [0 ].WhenUnsatisfiable != "DoNotSchedule" {
867
+ t .Fatal ("k8s-prometheus-operator topology spread contraints WhenUnsatisfiable not configured correctly" )
868
+ }
869
+
855
870
webTLSCipherSuitesArg := ""
856
871
webTLSVersionArg := ""
857
872
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