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