kcr_monitoring_coreos_com 3.20260124.145420

Kubernetes Custom Resource Bindings
Documentation
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --docs --derive=Default --derive=PartialEq --smart-derive-elision --filename crd-catalog/prometheus-operator/prometheus-operator/monitoring.coreos.com/v1/prometheusrules.yaml
// kopium version: 0.22.5

#[allow(unused_imports)]
mod prelude {
    pub use kube::CustomResource;
    pub use serde::{Serialize, Deserialize};
    pub use std::collections::BTreeMap;
    pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
}
use self::prelude::*;

/// spec defines the specification of desired alerting rule definitions for Prometheus.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(group = "monitoring.coreos.com", version = "v1", kind = "PrometheusRule", plural = "prometheusrules")]
#[kube(namespaced)]
#[kube(status = "PrometheusRuleStatus")]
#[kube(schema = "disabled")]
#[kube(derive="Default")]
#[kube(derive="PartialEq")]
pub struct PrometheusRuleSpec {
    /// groups defines the content of Prometheus rule file
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub groups: Option<Vec<PrometheusRuleGroups>>,
}

/// RuleGroup is a list of sequentially evaluated recording and alerting rules.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct PrometheusRuleGroups {
    /// interval defines how often rules in the group are evaluated.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub interval: Option<String>,
    /// labels define the labels to add or overwrite before storing the result for its rules.
    /// The labels defined at the rule level take precedence.
    /// 
    /// It requires Prometheus >= 3.0.0.
    /// The field is ignored for Thanos Ruler.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels: Option<BTreeMap<String, String>>,
    /// limit defines the number of alerts an alerting rule and series a recording
    /// rule can produce.
    /// Limit is supported starting with Prometheus >= 2.31 and Thanos Ruler >= 0.24.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub limit: Option<i64>,
    /// name defines the name of the rule group.
    pub name: String,
    /// partial_response_strategy is only used by ThanosRuler and will
    /// be ignored by Prometheus instances.
    /// More info: <https://github.com/thanos-io/thanos/blob/main/docs/components/rule.md#partial-response>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub partial_response_strategy: Option<String>,
    /// query_offset defines the offset the rule evaluation timestamp of this particular group by the specified duration into the past.
    /// 
    /// It requires Prometheus >= v2.53.0.
    /// It is not supported for ThanosRuler.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub query_offset: Option<String>,
    /// rules defines the list of alerting and recording rules.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub rules: Option<Vec<PrometheusRuleGroupsRules>>,
}

/// Rule describes an alerting or recording rule
/// See Prometheus documentation: [alerting](<https://www.prometheus.io/docs/prometheus/latest/configuration/alerting_rules/)> or [recording](<https://www.prometheus.io/docs/prometheus/latest/configuration/recording_rules/#recording-rules)> rule
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct PrometheusRuleGroupsRules {
    /// alert defines the name of the alert. Must be a valid label value.
    /// Only one of `record` and `alert` must be set.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub alert: Option<String>,
    /// annotations defines annotations to add to each alert.
    /// Only valid for alerting rules.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub annotations: Option<BTreeMap<String, String>>,
    /// expr defines the PromQL expression to evaluate.
    pub expr: IntOrString,
    /// for defines how alerts are considered firing once they have been returned for this long.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "for")]
    pub r#for: Option<String>,
    /// keep_firing_for defines how long an alert will continue firing after the condition that triggered it has cleared.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub keep_firing_for: Option<String>,
    /// labels defines labels to add or overwrite.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels: Option<BTreeMap<String, String>>,
    /// record defines the name of the time series to output to. Must be a valid metric name.
    /// Only one of `record` and `alert` must be set.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub record: Option<String>,
}

/// status defines the status subresource. It is under active development and is updated only when the
/// "StatusForConfigurationResources" feature gate is enabled.
/// 
/// Most recent observed status of the PrometheusRule. Read-only.
/// More info:
/// <https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status>
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct PrometheusRuleStatus {
    /// bindings defines the list of workload resources (Prometheus, PrometheusAgent, ThanosRuler or Alertmanager) which select the configuration resource.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub bindings: Option<Vec<PrometheusRuleStatusBindings>>,
}

/// WorkloadBinding is a link between a configuration resource and a workload resource.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct PrometheusRuleStatusBindings {
    /// conditions defines the current state of the configuration resource when bound to the referenced Workload object.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub conditions: Option<Vec<Condition>>,
    /// group defines the group of the referenced resource.
    pub group: PrometheusRuleStatusBindingsGroup,
    /// name defines the name of the referenced object.
    pub name: String,
    /// namespace defines the namespace of the referenced object.
    pub namespace: String,
    /// resource defines the type of resource being referenced (e.g. Prometheus, PrometheusAgent, ThanosRuler or Alertmanager).
    pub resource: PrometheusRuleStatusBindingsResource,
}

/// WorkloadBinding is a link between a configuration resource and a workload resource.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum PrometheusRuleStatusBindingsGroup {
    #[serde(rename = "monitoring.coreos.com")]
    MonitoringCoreosCom,
}

/// WorkloadBinding is a link between a configuration resource and a workload resource.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum PrometheusRuleStatusBindingsResource {
    #[serde(rename = "prometheuses")]
    Prometheuses,
    #[serde(rename = "prometheusagents")]
    Prometheusagents,
    #[serde(rename = "thanosrulers")]
    Thanosrulers,
    #[serde(rename = "alertmanagers")]
    Alertmanagers,
}