blob: dfa2edf19a933b0d7a5ae23d3a939e51163bf1e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
use kube::Client;
use tracing::{info, level_filters::LevelFilter};
use tracing_subscriber::EnvFilter;
mod backup;
mod context;
mod deploy;
mod error;
mod finalizer;
mod jobspec;
mod resticprofile;
mod schedule;
pub use error::Error;
#[tokio::main]
async fn main() {
tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::builder()
.with_default_directive(LevelFilter::INFO.into())
.from_env_lossy(),
)
.init();
std::panic::set_hook(Box::new(tracing_panic::panic_hook));
let k8s_client = Client::try_default()
.await
.expect("Expected a valid KUBECONFIG environment variable.");
let signal = tokio::signal::ctrl_c();
let backup_fut = tokio::spawn(backup::run_controller(k8s_client.clone()));
let schedule_fut = tokio::spawn(schedule::run_controller(k8s_client.clone()));
tokio::select! {
_ = signal => {}
_ = backup_fut => {}
_ = schedule_fut => {}
}
info!("Successfully shut down.")
}
|