Skip to content

Commit 2f6d3d1

Browse files
committed
MON-4036: Add TelemeterClientConfig to ClusterMonitoring API
Migrate the telemeter-client configmap settings to a CRD field within ClusterMonitoringSpec in config/v1alpha1. The new TelemeterClientConfig struct supports: - nodeSelector: pod scheduling to specific nodes - resources: compute resource requests and limits - tolerations: pod tolerations for scheduling - topologySpreadConstraints: pod distribution across topology domains Signed-off-by: Daniel Mellado <dmellado@fedoraproject.org>
1 parent f6ee4c0 commit 2f6d3d1

8 files changed

Lines changed: 1822 additions & 129 deletions

File tree

config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml

Lines changed: 341 additions & 46 deletions
Large diffs are not rendered by default.

config/v1alpha1/types_cluster_monitoring.go

Lines changed: 95 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ type ClusterMonitoringSpec struct {
113113
// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
114114
// +optional
115115
OpenShiftStateMetricsConfig OpenShiftStateMetricsConfig `json:"openShiftStateMetricsConfig,omitempty,omitzero"`
116+
// telemeterClientConfig is an optional field that can be used to configure the Telemeter Client
117+
// component that runs in the openshift-monitoring namespace. The Telemeter Client collects
118+
// selected monitoring metrics and forwards them to Red Hat for telemetry purposes.
119+
// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
120+
// +optional
121+
TelemeterClientConfig TelemeterClientConfig `json:"telemeterClientConfig,omitempty,omitzero"`
116122
}
117123

118124
// UserDefinedMonitoring config for user-defined projects.
@@ -202,13 +208,13 @@ type AlertmanagerCustomConfig struct {
202208
// - name: memory
203209
// request: 40Mi
204210
// limit: null
205-
// Maximum length for this list is 10.
211+
// Maximum length for this list is 5.
206212
// Minimum length for this list is 1.
207213
// Each resource name must be unique within this list.
208214
// +optional
209215
// +listType=map
210216
// +listMapKey=name
211-
// +kubebuilder:validation:MaxItems=10
217+
// +kubebuilder:validation:MaxItems=5
212218
// +kubebuilder:validation:MinItems=1
213219
Resources []ContainerResource `json:"resources,omitempty"`
214220
// secrets defines a list of secrets that need to be mounted into the Alertmanager.
@@ -309,6 +315,12 @@ const (
309315
)
310316

311317
// ContainerResource defines a single resource requirement for a container.
318+
// MaxItems on []ContainerResource fields is kept at 5 to stay within the
319+
// Kubernetes CRD CEL validation cost budget (StaticEstimatedCRDCostLimit).
320+
// The quantity() CEL function has a high fixed estimated cost per invocation,
321+
// and the limit-vs-request comparison rule is costed per maxItems per location.
322+
// With multiple structs in ClusterMonitoringSpec embedding []ContainerResource,
323+
// maxItems > 5 causes the total estimated rule cost to exceed the budget.
312324
// +kubebuilder:validation:XValidation:rule="has(self.request) || has(self.limit)",message="at least one of request or limit must be set"
313325
// +kubebuilder:validation:XValidation:rule="!(has(self.request) && has(self.limit)) || quantity(self.limit).compareTo(quantity(self.request)) >= 0",message="limit must be greater than or equal to request"
314326
type ContainerResource struct {
@@ -407,13 +419,13 @@ type MetricsServerConfig struct {
407419
// - name: memory
408420
// request: 40Mi
409421
// limit: null
410-
// Maximum length for this list is 10.
422+
// Maximum length for this list is 5.
411423
// Minimum length for this list is 1.
412424
// Each resource name must be unique within this list.
413425
// +optional
414426
// +listType=map
415427
// +listMapKey=name
416-
// +kubebuilder:validation:MaxItems=10
428+
// +kubebuilder:validation:MaxItems=5
417429
// +kubebuilder:validation:MinItems=1
418430
Resources []ContainerResource `json:"resources,omitempty"`
419431
// topologySpreadConstraints defines rules for how Metrics Server Pods should be distributed
@@ -478,13 +490,13 @@ type PrometheusOperatorConfig struct {
478490
// - name: memory
479491
// request: 40Mi
480492
// limit: null
481-
// Maximum length for this list is 10.
493+
// Maximum length for this list is 5.
482494
// Minimum length for this list is 1.
483495
// Each resource name must be unique within this list.
484496
// +optional
485497
// +listType=map
486498
// +listMapKey=name
487-
// +kubebuilder:validation:MaxItems=10
499+
// +kubebuilder:validation:MaxItems=5
488500
// +kubebuilder:validation:MinItems=1
489501
Resources []ContainerResource `json:"resources,omitempty"`
490502
// tolerations defines tolerations for the pods.
@@ -542,13 +554,13 @@ type PrometheusOperatorAdmissionWebhookConfig struct {
542554
// - name: memory
543555
// request: 30Mi
544556
// limit: null
545-
// Maximum length for this list is 10.
557+
// Maximum length for this list is 5.
546558
// Minimum length for this list is 1.
547559
// Each resource name must be unique within this list.
548560
// +optional
549561
// +listType=map
550562
// +listMapKey=name
551-
// +kubebuilder:validation:MaxItems=10
563+
// +kubebuilder:validation:MaxItems=5
552564
// +kubebuilder:validation:MinItems=1
553565
Resources []ContainerResource `json:"resources,omitempty"`
554566
// topologySpreadConstraints defines rules for how admission webhook Pods should be distributed
@@ -602,13 +614,13 @@ type OpenShiftStateMetricsConfig struct {
602614
// - name: memory
603615
// request: 32Mi
604616
// limit: null
605-
// Maximum length for this list is 10.
617+
// Maximum length for this list is 5.
606618
// Minimum length for this list is 1.
607619
// Each resource name must be unique within this list.
608620
// +optional
609621
// +listType=map
610622
// +listMapKey=name
611-
// +kubebuilder:validation:MaxItems=10
623+
// +kubebuilder:validation:MaxItems=5
612624
// +kubebuilder:validation:MinItems=1
613625
Resources []ContainerResource `json:"resources,omitempty"`
614626
// tolerations defines tolerations for the pods.
@@ -645,6 +657,79 @@ type OpenShiftStateMetricsConfig struct {
645657
TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
646658
}
647659

660+
// TelemeterClientConfig provides configuration options for the Telemeter Client component
661+
// that runs in the `openshift-monitoring` namespace. The Telemeter Client collects selected
662+
// monitoring metrics and forwards them to Red Hat for telemetry purposes.
663+
// +kubebuilder:validation:MinProperties=1
664+
type TelemeterClientConfig struct {
665+
// nodeSelector defines the nodes on which the Pods are scheduled.
666+
// This field is optional.
667+
//
668+
// When omitted, this means the user has no opinion and the platform is left
669+
// to choose reasonable defaults. These defaults are subject to change over time.
670+
// The current default value is `kubernetes.io/os: linux`.
671+
// When specified, nodeSelector must contain at least 1 entry and must not contain more than 10 entries.
672+
// +optional
673+
// +kubebuilder:validation:MinProperties=1
674+
// +kubebuilder:validation:MaxProperties=10
675+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
676+
// resources defines the compute resource requests and limits for the Telemeter Client container.
677+
// This includes CPU, memory and HugePages constraints to help control scheduling and resource usage.
678+
// When not specified, defaults are used by the platform. Requests cannot exceed limits.
679+
// This field is optional.
680+
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
681+
// This is a simplified API that maps to Kubernetes ResourceRequirements.
682+
// The current default values are:
683+
// resources:
684+
// - name: cpu
685+
// request: 1m
686+
// limit: null
687+
// - name: memory
688+
// request: 40Mi
689+
// limit: null
690+
// Maximum length for this list is 5.
691+
// Minimum length for this list is 1.
692+
// Each resource name must be unique within this list.
693+
// +optional
694+
// +listType=map
695+
// +listMapKey=name
696+
// +kubebuilder:validation:MaxItems=5
697+
// +kubebuilder:validation:MinItems=1
698+
Resources []ContainerResource `json:"resources,omitempty"`
699+
// tolerations defines tolerations for the pods.
700+
// This field is optional.
701+
//
702+
// When omitted, this means the user has no opinion and the platform is left
703+
// to choose reasonable defaults. These defaults are subject to change over time.
704+
// The current default is an empty list.
705+
// Maximum length for this list is 10.
706+
// Minimum length for this list is 1.
707+
// +kubebuilder:validation:MaxItems=10
708+
// +kubebuilder:validation:MinItems=1
709+
// +listType=atomic
710+
// +optional
711+
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
712+
// topologySpreadConstraints defines rules for how Telemeter Client Pods should be distributed
713+
// across topology domains such as zones, nodes, or other user-defined labels.
714+
// topologySpreadConstraints is optional.
715+
// This helps improve high availability and resource efficiency by avoiding placing
716+
// too many replicas in the same failure domain.
717+
//
718+
// When omitted, this means no opinion and the platform is left to choose a default, which is subject to change over time.
719+
// This field maps directly to the `topologySpreadConstraints` field in the Pod spec.
720+
// Default is empty list.
721+
// Maximum length for this list is 10.
722+
// Minimum length for this list is 1.
723+
// Entries must have unique topologyKey and whenUnsatisfiable pairs.
724+
// +kubebuilder:validation:MaxItems=10
725+
// +kubebuilder:validation:MinItems=1
726+
// +listType=map
727+
// +listMapKey=topologyKey
728+
// +listMapKey=whenUnsatisfiable
729+
// +optional
730+
TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
731+
}
732+
648733
// AuditProfile defines the audit log level for the Metrics Server.
649734
// +kubebuilder:validation:Enum=None;Metadata;Request;RequestResponse
650735
type AuditProfile string

0 commit comments

Comments
 (0)