controller/
lib.rs

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