Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions bundle/manifests/monitoring.rhobs_alertmanagerconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
controller-gen.kubebuilder.io/version: v0.20.1
observability.openshift.io/api-support: TechPreview
operator.prometheus.io/version: 0.90.1-rhobs1
operator.prometheus.io/version: 0.91.0-rhobs1
creationTimestamp: null
labels:
app.kubernetes.io/part-of: observability-operator
Expand Down Expand Up @@ -1155,6 +1155,22 @@ spec:
This provides a fallback for email clients that don't support HTML.
minLength: 1
type: string
threading:
description: |-
threading defines the threading configuration for email receiver.
It requires Alertmanager >= v0.30.0.
properties:
threadByDate:
description: |-
threadByDate defines what granularity of current date to thread by. Accepted values: Daily, None.
(None means group by alert group key, no date).
enum:
- Daily
- None
type: string
required:
- threadByDate
type: object
tlsConfig:
description: |-
tlsConfig defines the TLS configuration for SMTP connections.
Expand Down Expand Up @@ -8136,6 +8152,12 @@ spec:
- key
type: object
x-kubernetes-map-type: atomic
externalId:
description: |-
externalId defines the external ID used when assuming an AWS role. Can only be used with roleArn.
It requires Prometheus >= v3.11.0 or Alertmanager >= v0.33.0. Currently not supported by Thanos.
minLength: 1
type: string
profile:
description: profile defines the named AWS profile
used to authenticate.
Expand Down Expand Up @@ -8180,6 +8202,10 @@ spec:
It requires Prometheus >= v2.54.0.
type: boolean
type: object
x-kubernetes-validations:
- message: externalId can only be used when roleArn is
specified
rule: '!has(self.externalId) || has(self.roleArn)'
subject:
description: |-
subject defines the subject line when the message is delivered to email endpoints.
Expand Down
35 changes: 33 additions & 2 deletions bundle/manifests/monitoring.rhobs_alertmanagers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
controller-gen.kubebuilder.io/version: v0.20.1
observability.openshift.io/api-support: Experimental-SSA
operator.prometheus.io/version: 0.90.1-rhobs1
operator.prometheus.io/version: 0.91.0-rhobs1
creationTimestamp: null
labels:
app.kubernetes.io/part-of: observability-operator
Expand Down Expand Up @@ -1862,6 +1862,37 @@ spec:
pattern: ^(http|https)://.+$
type: string
type: object
mattermost:
description: mattermost defines the default Mattermost Config
properties:
webhookURL:
description: |-
webhookURL defines the default Mattermost Webhook URL.

It requires Alertmanager >= v0.32.0.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
optional:
description: Specify whether the Secret or its key
must be defined
type: boolean
required:
- key
type: object
x-kubernetes-map-type: atomic
type: object
opsGenieApiKey:
description: opsGenieApiKey defines the default OpsGenie API
Key.
Expand Down
4 changes: 2 additions & 2 deletions bundle/manifests/monitoring.rhobs_podmonitors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
controller-gen.kubebuilder.io/version: v0.20.1
observability.openshift.io/api-support: TechPreview
operator.prometheus.io/version: 0.90.1-rhobs1
operator.prometheus.io/version: 0.91.0-rhobs1
creationTimestamp: null
labels:
app.kubernetes.io/part-of: observability-operator
Expand Down
4 changes: 2 additions & 2 deletions bundle/manifests/monitoring.rhobs_probes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
controller-gen.kubebuilder.io/version: v0.20.1
observability.openshift.io/api-support: TechPreview
operator.prometheus.io/version: 0.90.1-rhobs1
operator.prometheus.io/version: 0.91.0-rhobs1
creationTimestamp: null
labels:
app.kubernetes.io/part-of: observability-operator
Expand Down
75 changes: 71 additions & 4 deletions bundle/manifests/monitoring.rhobs_prometheusagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.19.0
controller-gen.kubebuilder.io/version: v0.20.1
observability.openshift.io/api-support: TechPreview
operator.prometheus.io/version: 0.90.1-rhobs1
operator.prometheus.io/version: 0.91.0-rhobs1
creationTimestamp: null
labels:
app.kubernetes.io/part-of: observability-operator
Expand Down Expand Up @@ -6261,6 +6261,12 @@ spec:
- key
type: object
x-kubernetes-map-type: atomic
externalId:
description: |-
externalId defines the external ID used when assuming an AWS role. Can only be used with roleArn.
It requires Prometheus >= v3.11.0 or Alertmanager >= v0.33.0. Currently not supported by Thanos.
minLength: 1
type: string
profile:
description: profile defines the named AWS profile used
to authenticate.
Expand Down Expand Up @@ -6305,6 +6311,9 @@ spec:
It requires Prometheus >= v2.54.0.
type: boolean
type: object
x-kubernetes-validations:
- message: externalId can only be used when roleArn is specified
rule: '!has(self.externalId) || has(self.roleArn)'
tlsConfig:
description: tlsConfig to use for the URL.
properties:
Expand Down Expand Up @@ -7194,7 +7203,8 @@ spec:
matches all namespaces. A null label selector matches the current
namespace only.

Note that the ScrapeConfig custom resource definition is currently at Alpha level.
Note that the ScrapeConfig custom resource definition is currently at Alpha level
and will be graduated to Beta in a future release.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
Expand Down Expand Up @@ -7253,7 +7263,8 @@ spec:
of the custom resource definition. It is recommended to use
`spec.additionalScrapeConfigs` instead.

Note that the ScrapeConfig custom resource definition is currently at Alpha level.
Note that the ScrapeConfig custom resource definition is currently at Alpha level
and will be graduated to Beta in a future release.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
Expand Down Expand Up @@ -7733,6 +7744,54 @@ spec:
See https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#stable-network-id for more details.
minLength: 1
type: string
shardingStrategy:
description: |-
shardingStrategy defines the sharding strategy for distributing scraped targets across Prometheus shards.

When not defined, the operator defaults to the 'Address' mode which distributes
targets based on a hash of the target address.
properties:
mode:
description: |-
mode defines the sharding mode. Can be 'Address' or 'Topology'.

'Address' is the default mode and distributes targets across shards
based on a hash of the target address.

'Topology' enables zone-aware sharding where each shard is assigned to a
specific topology zone and only scrapes targets in that zone.
(Alpha) Using the 'Topology' mode requires the `PrometheusTopologySharding`
feature gate to be enabled.
enum:
- Address
- Topology
type: string
topology:
description: |-
topology defines the configuration for topology-aware sharding.
This field is only valid when mode is set to 'Topology'.
properties:
externalLabelName:
description: |-
externalLabelName defines the name of the Prometheus external label used
to communicate the topology zone assigned to the Prometheus instance.
If not defined, it defaults to "zone".
If set to the empty string, no external label is added to the Prometheus configuration.
type: string
values:
description: |-
values defines the list of topology values (e.g. zone names) to be used
for sharding. The configured number of shards must be greater than or
equal to the number of values.
items:
type: string
type: array
x-kubernetes-list-type: atomic
type: object
type: object
x-kubernetes-validations:
- message: topology can only be defined when mode is set to 'Topology'
rule: '!has(self.topology) || (has(self.mode) && self.mode == ''Topology'')'
Comment on lines +7781 to +7794
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Require topology.values when mode is Topology.

As written, shardingStrategy.mode: Topology is still valid if topology is missing or topology.values is empty. That admits a config with no zones to assign, and the Line 11372 shard-count rule never fires in that case.

Suggested validation tightening
               x-kubernetes-validations:
               - message: topology can only be defined when mode is set to 'Topology'
                 rule: '!has(self.topology) || (has(self.mode) && self.mode == ''Topology'')'
+              - message: topology.values must be non-empty when mode is set to 'Topology'
+                rule: '!has(self.mode) || self.mode != ''Topology'' || (has(self.topology) && has(self.topology.values) && self.topology.values.size() > 0)'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bundle/manifests/monitoring.rhobs_prometheusagents.yaml` around lines 7781 -
7794, The current validation only ensures topology exists when mode ==
'Topology' but doesn't require topology.values to be present and non-empty;
update the x-kubernetes-validations for the shardingStrategy (the rule that
references self.mode and self.topology) to also require that
self.topology.values exists and has at least one element when self.mode ==
'Topology' (e.g. extend the rule to '!has(self.topology) || (has(self.mode) &&
self.mode == ''Topology'' && has(self.topology.values) &&
size(self.topology.values) > 0)') so mode=Topology is invalid unless
topology.values is set and non-empty.

shards:
description: |-
shards defines the number of shards to distribute the scraped targets onto.
Expand Down Expand Up @@ -11306,6 +11365,14 @@ spec:
rule: '!(has(self.mode) && self.mode == ''DaemonSet'' && has(self.serviceMonitorNamespaceSelector))'
- message: additionalScrapeConfigs cannot be set when mode is DaemonSet
rule: '!(has(self.mode) && self.mode == ''DaemonSet'' && has(self.additionalScrapeConfigs))'
- message: shardingStrategy cannot be set when mode is DaemonSet
rule: '!(has(self.mode) && self.mode == ''DaemonSet'' && has(self.shardingStrategy))'
- message: shards must be greater than or equal to the number of topology
values when sharding strategy mode is Topology
rule: '!has(self.shardingStrategy) || !has(self.shardingStrategy.mode)
|| self.shardingStrategy.mode != ''Topology'' || !has(self.shardingStrategy.topology)
|| !has(self.shardingStrategy.topology.values) || self.shardingStrategy.topology.values.size()
== 0 || (has(self.shards) ? self.shards : 1) >= self.shardingStrategy.topology.values.size()'
status:
description: |-
status defines the most recent observed status of the Prometheus cluster. Read-only.
Expand Down
Loading
Loading