controller/
lib.rs

1/// Expose all controller components used by main
2pub mod controller;
3pub use crate::controller::*;
4
5/// Log and trace integrations
6pub mod telemetry;
7
8/// Metrics
9mod metrics;
10pub use metrics::Metrics;
11
12mod defaults;
13#[cfg(test)] pub mod fixtures;
14mod psql;
15mod service;
16mod statefulset;
17use thiserror::Error;
18
19#[derive(Error, Debug)]
20pub enum Error {
21    #[error("SerializationError: {0}")]
22    SerializationError(#[source] serde_json::Error),
23
24    #[error("Kube Error: {0}")]
25    KubeError(#[source] kube::Error),
26
27    #[error("Finalizer Error: {0}")]
28    // NB: awkward type because finalizer::Error embeds the reconciler error (which is this)
29    // so boxing this error to break cycles
30    FinalizerError(#[source] Box<kube::runtime::finalizer::Error<Error>>),
31}
32pub type Result<T, E = Error> = std::result::Result<T, E>;
33
34impl Error {
35    pub fn metric_label(&self) -> String {
36        format!("{self:?}").to_lowercase()
37    }
38}