diff --git a/Cargo.lock b/Cargo.lock index c0d6f61..8f3101e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1780,6 +1780,29 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "pvc-snapshotter-client" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "aws-config", + "aws-sdk-ec2", + "clap", + "colored", + "k8s-openapi", + "kube", + "kube-custom-resources-rs", + "pretty_assertions", + "pvc-snapshotter", + "schemars", + "serde", + "serde_json", + "tokio", + "tracing", + "tracing-subscriber", +] + [[package]] name = "quote" version = "1.0.37" diff --git a/Cargo.toml b/Cargo.toml index 7a22151..4abfc56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,15 +3,16 @@ name = "pvc-snapshotter" version = "0.1.0" edition = "2021" license = "MIT" -description = "A Rust tool that can backup and restore k8s PVCs using EBS snapshots" +description = "The pvc-snapshotter is a Rust tool that can backup and restore k8s PVCs using EBS snapshots" readme = "README.md" homepage = "https://github.com/nikoshet/pvc-snapshotter" repository = "https://github.com/nikoshet/pvc-snapshotter" keywords = ["k8s", "pvc", "snapshot", "ebs", "backup", "restore", "aws"] documentation = "https://docs.rs/pvc-snapshotter" +exclude = ["script.sh"] -# [workspace] -# members = ["pvc-snapshotter-cli"] +[workspace] +members = ["pvc-snapshotter-client"] [workspace.dependencies] anyhow = "1.0.89" @@ -30,6 +31,7 @@ serde_json = "1.0.128" tokio = { version = "1", features = ["full"] } tracing = "0.1.40" tracing-subscriber = "0.3.18" +pvc-snapshotter = { path = ".", version = "0.1" } [dependencies] anyhow.workspace = true @@ -49,11 +51,11 @@ tokio.workspace = true tracing.workspace = true tracing-subscriber.workspace = true -# [lib] -# test = true -# edition = "2021" -# crate-type = ["lib"] -# name = "pvc_snapshotter" +[lib] +test = true +edition = "2021" +crate-type = ["lib"] +name = "pvc_snapshotter" [features] default = ["full"] diff --git a/pvc-snapshotter-client/Cargo.toml b/pvc-snapshotter-client/Cargo.toml new file mode 100644 index 0000000..a11dedf --- /dev/null +++ b/pvc-snapshotter-client/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "pvc-snapshotter-client" +version = "0.1.0" +edition = "2021" +license = "MIT" +description = "The pvc-snapshotter-client is a Rust tool that can backup and restore k8s PVCs using EBS snapshots" +readme = "../README.md" +homepage = "https://github.com/nikoshet/pvc-snapshotter" +repository = "https://github.com/nikoshet/pvc-snapshotter" +keywords = ["k8s", "pvc", "snapshot", "ebs", "backup", "restore", "aws"] +documentation = "https://docs.rs/pvc-snapshotter-client" + +[dependencies] +anyhow.workspace = true +async-trait.workspace = true +aws-config.workspace = true +aws-sdk-ec2.workspace = true +clap.workspace = true +colored.workspace = true +k8s-openapi.workspace = true +kube.workspace = true +kube-custom-resources-rs.workspace = true +pretty_assertions.workspace = true +schemars.workspace = true +serde.workspace = true +serde_json.workspace = true +tokio.workspace = true +tracing.workspace = true +tracing-subscriber.workspace = true +pvc-snapshotter.workspace = true + +[features] +default = ["full"] +full = ["backup", "restore"] +backup = [] +restore = [] diff --git a/src/main.rs b/pvc-snapshotter-client/src/main.rs similarity index 96% rename from src/main.rs rename to pvc-snapshotter-client/src/main.rs index 35f7aa5..a1bf1a0 100644 --- a/src/main.rs +++ b/pvc-snapshotter-client/src/main.rs @@ -1,16 +1,14 @@ -mod aws_ops; -mod backup; -mod k8s_ops; -mod restore; use anyhow::Result; -#[cfg(feature = "backup")] -use backup::{backup_operator::BackupOperator, backup_payload::BackupPayload}; use clap::{Parser, Subcommand}; use colored::Colorize; +#[cfg(feature = "backup")] +use pvc_snapshotter::backup::{backup_operator::BackupOperator, backup_payload::BackupPayload}; #[cfg(feature = "restore")] -use k8s_ops::vsc::retain_policy::VSCRetainPolicy; +use pvc_snapshotter::k8s_ops::vsc::retain_policy::VSCRetainPolicy; #[cfg(feature = "restore")] -use restore::{restore_operator::RestoreOperator, restore_payload::RestorePayload}; +use pvc_snapshotter::restore::{ + restore_operator::RestoreOperator, restore_payload::RestorePayload, +}; use tracing::info; #[derive(Parser)] diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..d6cb0a4 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,4 @@ +pub mod aws_ops; +pub mod backup; +pub mod k8s_ops; +pub mod restore;