@@ -89,6 +89,12 @@ type ClusterMonitoringSpec struct {
8989 // The current default value is `DefaultConfig`.
9090 // +optional
9191 AlertmanagerConfig AlertmanagerConfig `json:"alertmanagerConfig,omitempty,omitzero"`
92+ // prometheusK8sConfig provides configuration options for the Prometheus instance
93+ // Prometheus deployment, pod scheduling, resource allocation, retention policies, and external integrations.
94+ // prometheusK8sConfig is optional.
95+ // When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
96+ // +optional
97+ PrometheusK8sConfig PrometheusK8sConfig `json:"prometheusK8sConfig,omitempty,omitzero"`
9298 // metricsServerConfig is an optional field that can be used to configure the Kubernetes Metrics Server that runs in the openshift-monitoring namespace.
9399 // Specifically, it can configure how the Metrics Server instance is deployed, pod scheduling, its audit policy and log verbosity.
94100 // When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
@@ -416,6 +422,290 @@ type MetricsServerConfig struct {
416422 TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
417423}
418424
425+ // PrometheusK8sConfig provides configuration options for the Prometheus instance
426+ // Use this configuration to control
427+ // Prometheus deployment, pod scheduling, resource allocation, retention policies, and external integrations.
428+ // +kubebuilder:validation:MinProperties=1
429+ type PrometheusK8sConfig struct {
430+ // additionalAlertmanagerConfigs configures additional Alertmanager instances that receive alerts from
431+ // the Prometheus component. By default, no additional Alertmanager instances are configured.
432+ // +optional
433+ // +kubebuilder:validation:MaxItems=10
434+ // +listType=atomic
435+ AdditionalAlertmanagerConfigs []AdditionalAlertmanagerConfig `json:"additionalAlertmanagerConfigs,omitempty"`
436+ // enforcedBodySizeLimit enforces a body size limit for Prometheus scraped metrics. If a scraped
437+ // target's body response is larger than the limit, the scrape will fail.
438+ // The following values are valid:
439+ // an empty value to specify no limit,
440+ // a numeric value in Prometheus size format (such as `64MB`), or
441+ // the string `automatic`, which indicates that the limit will be
442+ // automatically calculated based on cluster capacity.
443+ // The default value is empty, which indicates no limit.
444+ // +optional
445+ // +kubebuilder:validation:MaxLength=50
446+ EnforcedBodySizeLimit * string `json:"enforcedBodySizeLimit,omitempty"`
447+ // externalLabels defines labels to be added to any time series or alerts when
448+ // communicating with external systems such as federation, remote storage,
449+ // and Alertmanager. By default, no labels are added.
450+ // +optional
451+ ExternalLabels ExternalLabels `json:"externalLabels,omitempty,omitzero"`
452+ // logLevel defines the verbosity of logs emitted by Prometheus.
453+ // This field allows users to control the amount and severity of logs generated, which can be useful
454+ // for debugging issues or reducing noise in production environments.
455+ // Allowed values are Error, Warn, Info, and Debug.
456+ // When set to Error, only errors will be logged.
457+ // When set to Warn, both warnings and errors will be logged.
458+ // When set to Info, general information, warnings, and errors will all be logged.
459+ // When set to Debug, detailed debugging information will be logged.
460+ // When omitted, this means no opinion and the platform is left to choose a reasonable default, that is subject to change over time.
461+ // The current default value is `Info`.
462+ // +optional
463+ LogLevel * string `json:"logLevel,omitempty"`
464+ // nodeSelector defines the nodes on which the Pods are scheduled
465+ // nodeSelector is optional.
466+ //
467+ // When omitted, this means the user has no opinion and the platform is left
468+ // to choose reasonable defaults. These defaults are subject to change over time.
469+ // The current default value is `kubernetes.io/os: linux`.
470+ // +optional
471+ // +kubebuilder:validation:MinProperties=1
472+ // +kubebuilder:validation:MaxProperties=10
473+ NodeSelector map [string ]string `json:"nodeSelector,omitempty"`
474+ // queryLogFile specifies the file to which PromQL queries are logged.
475+ // This setting can be either a filename, in which
476+ // case the queries are saved to an `emptyDir` volume
477+ // at `/var/log/prometheus`, or a full path to a location where
478+ // an `emptyDir` volume will be mounted and the queries saved.
479+ // Writing to `/dev/stderr`, `/dev/stdout` or `/dev/null` is supported, but
480+ // writing to any other `/dev/` path is not supported. Relative paths are
481+ // also not supported.
482+ // By default, PromQL queries are not logged.
483+ // +optional
484+ // +kubebuilder:validation:MaxLength=255
485+ QueryLogFile * string `json:"queryLogFile,omitempty"`
486+ // remoteWrite defines the remote write configuration, including URL, authentication,
487+ // and relabeling settings.
488+ // +optional
489+ // +kubebuilder:validation:MaxItems=10
490+ // +listType=atomic
491+ RemoteWrite []RemoteWriteSpec `json:"remoteWrite,omitempty"`
492+ // resources defines the compute resource requests and limits for the Prometheus container.
493+ // This includes CPU, memory and HugePages constraints to help control scheduling and resource usage.
494+ // When not specified, defaults are used by the platform. Requests cannot exceed limits.
495+ // This field is optional.
496+ // More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
497+ // This is a simplified API that maps to Kubernetes ResourceRequirements.
498+ // The current default values are:
499+ // resources:
500+ // - name: cpu
501+ // request: 4m
502+ // limit: null
503+ // - name: memory
504+ // request: 40Mi
505+ // limit: null
506+ // Maximum length for this list is 10.
507+ // Minimum length for this list is 1.
508+ // +optional
509+ // +listType=map
510+ // +listMapKey=name
511+ // +kubebuilder:validation:MaxItems=10
512+ // +kubebuilder:validation:MinItems=1
513+ Resources []ContainerResource `json:"resources,omitempty"`
514+ // retention defines the duration for which Prometheus retains data.
515+ // This definition must be specified using the following regular
516+ // expression pattern: `[0-9]+(ms|s|m|h|d|w|y)` (ms = milliseconds,
517+ // s= seconds,m = minutes, h = hours, d = days, w = weeks, y = years).
518+ // The default value is `15d`.
519+ // +optional
520+ // +kubebuilder:validation:MaxLength=20
521+ Retention * string `json:"retention,omitempty"`
522+ // retentionSize defines the maximum amount of disk space used by data blocks plus the
523+ // write-ahead log (WAL).
524+ // Supported values are `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`,
525+ // `TiB`, `PB`, `PiB`, `EB`, and `EiB`.
526+ // By default, no limit is defined.
527+ // +optional
528+ // +kubebuilder:validation:MaxLength=20
529+ RetentionSize * string `json:"retentionSize,omitempty"`
530+ // tolerations defines tolerations for the pods.
531+ // tolerations is optional.
532+ //
533+ // When omitted, this means the user has no opinion and the platform is left
534+ // to choose reasonable defaults. These defaults are subject to change over time.
535+ // Defaults are empty/unset.
536+ // Maximum length for this list is 10
537+ // Minimum length for this list is 1
538+ // +kubebuilder:validation:MaxItems=10
539+ // +kubebuilder:validation:MinItems=1
540+ // +listType=atomic
541+ // +optional
542+ Tolerations []v1.Toleration `json:"tolerations,omitempty"`
543+ // topologySpreadConstraints defines rules for how Prometheus Pods should be distributed
544+ // across topology domains such as zones, nodes, or other user-defined labels.
545+ // topologySpreadConstraints is optional.
546+ // This helps improve high availability and resource efficiency by avoiding placing
547+ // too many replicas in the same failure domain.
548+ //
549+ // When omitted, this means no opinion and the platform is left to choose a default, which is subject to change over time.
550+ // This field maps directly to the `topologySpreadConstraints` field in the Pod spec.
551+ // Default is empty list.
552+ // Maximum length for this list is 10.
553+ // Minimum length for this list is 1
554+ // Entries must have unique topologyKey and whenUnsatisfiable pairs.
555+ // +kubebuilder:validation:MaxItems=10
556+ // +kubebuilder:validation:MinItems=1
557+ // +listType=map
558+ // +listMapKey=topologyKey
559+ // +listMapKey=whenUnsatisfiable
560+ // +optional
561+ TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
562+ // collectionProfile defines the metrics collection profile that Prometheus uses to collect
563+ // metrics from the platform components. Supported values are `full` or
564+ // `minimal`. In the `full` profile (default), Prometheus collects all
565+ // metrics that are exposed by the platform components. In the `minimal`
566+ // profile, Prometheus only collects metrics necessary for the default
567+ // platform alerts, recording rules, telemetry and console dashboards.
568+ CollectionProfile CollectionProfile `json:"collectionProfile,omitempty"`
569+ // volumeClaimTemplate Defines persistent storage for Prometheus. Use this setting to
570+ // configure the persistent volume claim, including storage class, volume
571+ // size, and name.
572+ // If omitted, the Pod uses ephemeral storage and Prometheus data will not persist
573+ // across restarts.
574+ // This field is optional.
575+ // +optional
576+ VolumeClaimTemplate * v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`
577+ }
578+
579+ // AdditionalAlertmanagerConfig represents configuration for additional Alertmanager instances.
580+ // The `AdditionalAlertmanagerConfig` resource defines settings for how a
581+ // component communicates with additional Alertmanager instances.
582+ type AdditionalAlertmanagerConfig struct {
583+ // apiVersion defines the API version of Alertmanager.
584+ // `v1` is no longer supported, `v2` is set as the default value.
585+ // +required
586+ // +kubebuilder:validation:MaxLength=10
587+ APIVersion * string `json:"apiVersion,omitempty"`
588+ // bearerToken defines the secret key reference containing the bearer token
589+ // to use when authenticating to Alertmanager.
590+ // +optional
591+ BearerToken * v1.SecretKeySelector `json:"bearerToken,omitempty"`
592+ // pathPrefix defines the path prefix to add in front of the push endpoint path.
593+ // +optional
594+ // +kubebuilder:validation:MaxLength=255
595+ PathPrefix * string `json:"pathPrefix,omitempty"`
596+ // scheme defines the URL scheme to use when communicating with Alertmanager
597+ // instances.
598+ // Possible values are `http` or `https`. The default value is `http`.
599+ // +optional
600+ // +kubebuilder:validation:MaxLength=10
601+ Scheme * string `json:"scheme,omitempty"`
602+ // staticConfigs is a list of statically configured Alertmanager endpoints in the form
603+ // of `<hosts>:<port>`.
604+ // +optional
605+ // +kubebuilder:validation:MaxItems=10
606+ // +kubebuilder:validation:items:MaxLength=255
607+ // +listType=set
608+ StaticConfigs []string `json:"staticConfigs,omitempty"`
609+ // timeout defines the timeout value used when sending alerts.
610+ // +optional
611+ // +kubebuilder:validation:MaxLength=20
612+ Timeout * string `json:"timeout,omitempty"`
613+ // tlsConfig defines the TLS settings to use for Alertmanager connections.
614+ // +optional
615+ TLSConfig * TLSConfig `json:"tlsConfig,omitempty"`
616+ }
617+
618+ // ExternalLabels represents labels to be added to time series and alerts.
619+ type ExternalLabels struct {
620+ // labels is a map of label names to label values.
621+ // +required
622+ Labels map [string ]string `json:"labels,omitempty"`
623+ }
624+
625+ // RemoteWriteSpec represents configuration for remote write endpoints.
626+ type RemoteWriteSpec struct {
627+ // url is the URL of the remote write endpoint.
628+ // +required
629+ // +kubebuilder:validation:MaxLength=2048
630+ URL * string `json:"url,omitempty"`
631+ // name is the name of the remote write configuration.
632+ // +optional
633+ // +kubebuilder:validation:MaxLength=63
634+ Name * string `json:"name,omitempty"`
635+ // remoteTimeout is the timeout for requests to the remote write endpoint.
636+ // +optional
637+ // +kubebuilder:validation:MaxLength=20
638+ RemoteTimeout * string `json:"remoteTimeout,omitempty"`
639+ // writeRelabelConfigs is a list of relabeling rules to apply before sending data to the remote endpoint.
640+ // +optional
641+ // +kubebuilder:validation:MaxItems=10
642+ // +listType=atomic
643+ WriteRelabelConfigs []RelabelConfig `json:"writeRelabelConfigs,omitempty"`
644+ }
645+
646+ // RelabelConfig represents a relabeling rule.
647+ type RelabelConfig struct {
648+ // sourceLabels is a list of source label names.
649+ // +optional
650+ // +kubebuilder:validation:MaxItems=10
651+ // +kubebuilder:validation:items:MaxLength=63
652+ // +listType=set
653+ SourceLabels []string `json:"sourceLabels,omitempty"`
654+ // separator is the separator used to join source label values.
655+ // +optional
656+ // +kubebuilder:validation:MaxLength=10
657+ Separator * string `json:"separator,omitempty"`
658+ // regex is the regular expression to match against the concatenated source label values.
659+ // +optional
660+ // +kubebuilder:validation:MaxLength=1000
661+ Regex * string `json:"regex,omitempty"`
662+ // targetLabel is the target label name.
663+ // +optional
664+ // +kubebuilder:validation:MaxLength=63
665+ TargetLabel * string `json:"targetLabel,omitempty"`
666+ // replacement is the replacement value for the target label.
667+ // +optional
668+ // +kubebuilder:validation:MaxLength=255
669+ Replacement * string `json:"replacement,omitempty"`
670+ // action is the action to perform.
671+ // +optional
672+ // +kubebuilder:validation:MaxLength=20
673+ Action * string `json:"action,omitempty"`
674+ }
675+
676+ // TLSConfig represents TLS configuration for Alertmanager connections.
677+ type TLSConfig struct {
678+ // ca is the CA certificate to use for TLS connections.
679+ // +optional
680+ CA * v1.SecretKeySelector `json:"ca,omitempty"`
681+ // cert is the client certificate to use for TLS connections.
682+ // +optional
683+ Cert * v1.SecretKeySelector `json:"cert,omitempty"`
684+ // key is the client key to use for TLS connections.
685+ // +optional
686+ Key * v1.SecretKeySelector `json:"key,omitempty"`
687+ // serverName is the server name to use for TLS connections.
688+ // +optional
689+ // +kubebuilder:validation:MaxLength=253
690+ ServerName * string `json:"serverName,omitempty"`
691+ // insecureSkipVerify determines whether to skip TLS certificate verification.
692+ // +optional
693+ // +kubebuilder:validation:Enum=true;false
694+ InsecureSkipVerify string `json:"insecureSkipVerify,omitempty"`
695+ }
696+
697+ // CollectionProfile defines the metrics collection profile for Prometheus.
698+ // +kubebuilder:validation:Enum=full;minimal
699+ type CollectionProfile string
700+
701+ const (
702+ // CollectionProfileFull means Prometheus collects all metrics that are exposed by the platform components.
703+ CollectionProfileFull CollectionProfile = "full"
704+ // CollectionProfileMinimal means Prometheus only collects metrics necessary for the default
705+ // platform alerts, recording rules, telemetry and console dashboards.
706+ CollectionProfileMinimal CollectionProfile = "minimal"
707+ )
708+
419709// AuditProfile defines the audit log level for the Metrics Server.
420710// +kubebuilder:validation:Enum=None;Metadata;Request;RequestResponse
421711type AuditProfile string
0 commit comments