@@ -94,6 +94,14 @@ type ClusterMonitoringSpec struct {
94
94
// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
95
95
// +optional
96
96
MetricsServerConfig MetricsServerConfig `json:"metricsServerConfig,omitempty,omitzero"`
97
+ // kubeStateMetricsConfig is an optional field that can be used to configure the kube-state-metrics agent that runs in the openshift-monitoring namespace.
98
+ // KubeStateMetrics (KSM) is a service that listens to the Kubernetes API server
99
+ // and generates metrics about the state of Kubernetes objects. Metrics reflect
100
+ // the raw, unmodified data of objects such as Deployments, Nodes, and Pods.
101
+ // Specifically, it can configure how the kube-state-metrics instance is deployed, pod scheduling, and resource allocation.
102
+ // When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
103
+ // +optional
104
+ KubeStateMetricsConfig KubeStateMetricsConfig `json:"kubeStateMetricsConfig,omitempty,omitzero"`
97
105
}
98
106
99
107
// UserDefinedMonitoring config for user-defined projects.
@@ -460,3 +468,74 @@ type Audit struct {
460
468
// +required
461
469
Profile AuditProfile `json:"profile,omitempty"`
462
470
}
471
+
472
+ // KubeStateMetricsConfig provides configuration options for the kube-state-metrics agent
473
+ // that runs in the `openshift-monitoring` namespace. Use this configuration to control
474
+ // how the kube-state-metrics instance is deployed, pod scheduling, and resource allocation.
475
+ // +kubebuilder:validation:MinProperties=1
476
+ type KubeStateMetricsConfig struct {
477
+ // nodeSelector defines the nodes on which the Pods are scheduled
478
+ // nodeSelector is optional.
479
+ //
480
+ // When omitted, this means the user has no opinion and the platform is left
481
+ // to choose reasonable defaults. These defaults are subject to change over time.
482
+ // The current default value is `kubernetes.io/os: linux`.
483
+ // +optional
484
+ // +kubebuilder:validation:MinProperties=1
485
+ // +kubebuilder:validation:MaxProperties=10
486
+ NodeSelector map [string ]string `json:"nodeSelector,omitempty"`
487
+ // resources defines the compute resource requests and limits for the KubeStateMetrics container.
488
+ // This includes CPU, memory and HugePages constraints to help control scheduling and resource usage.
489
+ // When not specified, defaults are used by the platform. Requests cannot exceed limits.
490
+ // This field is optional.
491
+ // More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
492
+ // This is a simplified API that maps to Kubernetes ResourceRequirements.
493
+ // The current default values are:
494
+ // resources:
495
+ // - name: cpu
496
+ // request: 4m
497
+ // limit: null
498
+ // - name: memory
499
+ // request: 40Mi
500
+ // limit: null
501
+ // Maximum length for this list is 10.
502
+ // Minimum length for this list is 1.
503
+ // +optional
504
+ // +listType=map
505
+ // +listMapKey=name
506
+ // +kubebuilder:validation:MaxItems=10
507
+ // +kubebuilder:validation:MinItems=1
508
+ Resources []ContainerResource `json:"resources,omitempty"`
509
+ // tolerations defines tolerations for the pods.
510
+ // tolerations is optional.
511
+ //
512
+ // When omitted, this means the user has no opinion and the platform is left
513
+ // to choose reasonable defaults. These defaults are subject to change over time.
514
+ // Defaults are empty/unset.
515
+ // Maximum length for this list is 10
516
+ // Minimum length for this list is 1
517
+ // +kubebuilder:validation:MaxItems=10
518
+ // +kubebuilder:validation:MinItems=1
519
+ // +listType=atomic
520
+ // +optional
521
+ Tolerations []v1.Toleration `json:"tolerations,omitempty"`
522
+ // topologySpreadConstraints defines rules for how KubeStateMetrics Pods should be distributed
523
+ // across topology domains such as zones, nodes, or other user-defined labels.
524
+ // topologySpreadConstraints is optional.
525
+ // This helps improve high availability and resource efficiency by avoiding placing
526
+ // too many replicas in the same failure domain.
527
+ //
528
+ // When omitted, this means no opinion and the platform is left to choose a default, which is subject to change over time.
529
+ // This field maps directly to the `topologySpreadConstraints` field in the Pod spec.
530
+ // Default is empty list.
531
+ // Maximum length for this list is 10.
532
+ // Minimum length for this list is 1
533
+ // Entries must have unique topologyKey and whenUnsatisfiable pairs.
534
+ // +kubebuilder:validation:MaxItems=10
535
+ // +kubebuilder:validation:MinItems=1
536
+ // +listType=map
537
+ // +listMapKey=topologyKey
538
+ // +listMapKey=whenUnsatisfiable
539
+ // +optional
540
+ TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
541
+ }
0 commit comments