mod controller;
mod crd;
mod executor;
mod function;
mod manifests;
mod membership;
mod resources;
mod site;
use clap::Subcommand;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("kubernetes: {0}")]
Kube(#[from] kube::Error),
#[error("manifest: {0}")]
Yaml(#[from] serde_yaml::Error),
#[error("cluster api: {0}")]
Http(#[from] reqwest::Error),
#[error("operator: {0}")]
Other(String),
}
type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, clap::Args)]
pub struct OperatorArgs {
#[command(subcommand)]
command: OperatorCommand,
}
#[derive(Debug, Subcommand)]
enum OperatorCommand {
Run(controller::RunArgs),
Crds,
Manifests(manifests::ManifestArgs),
}
pub async fn run(args: OperatorArgs) -> Result<()> {
match args.command {
OperatorCommand::Run(a) => controller::run(a).await,
OperatorCommand::Crds => manifests::print_crds(),
OperatorCommand::Manifests(a) => manifests::print_manifests(&a),
}
}