Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoshet committed Oct 18, 2024
1 parent 0aadb96 commit cd7f7ad
Show file tree
Hide file tree
Showing 15 changed files with 454 additions and 175 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,26 @@ jobs:
format-and-clippy:
uses: ./.github/workflows/format-workflow.yaml
secrets: inherit
tests:
uses: ./.github/workflows/tests-workflow.yaml
secrets: inherit
build:
runs-on: ubuntu-latest
needs: [format-and-clippy]
needs: [format-and-clippy, tests]
strategy:
fail-fast: true
matrix:
include:
- name: "library"
path: "."
- name: "client"
path: "snap-kube-client"
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
toolchain: ${{ env.RUST_VERSION }}
- name: Build
- name: Cargo Build ${{ matrix.name }}
run: cargo build --verbose
working-directory: ${{ matrix.path }}
24 changes: 24 additions & 0 deletions .github/workflows/tests-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tests Pipeline

on:
workflow_call:

env:
RUST_VERSION: 1.81.0

jobs:
tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
toolchain: ${{ env.RUST_VERSION }}
- name: Install cargo-nextest
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-nextest
- name: Run tests
run: cargo nextest run --all
162 changes: 117 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[package]
name = "pvc-snapshotter"
name = "snap-kube"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "The pvc-snapshotter is a Rust tool that can backup and restore k8s PVCs using EBS snapshots"
description = "The snap-kube 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"
homepage = "https://github.com/nikoshet/snap-kube"
repository = "https://github.com/nikoshet/snap-kube"
keywords = ["k8s", "pvc", "snapshot", "ebs", "backup", "restore", "aws"]
documentation = "https://docs.rs/pvc-snapshotter"
documentation = "https://docs.rs/snap-kube"
exclude = ["script.sh"]

[workspace]
members = ["pvc-snapshotter-client"]
members = ["snap-kube-client"]

[workspace.dependencies]
anyhow = "1.0.89"
Expand All @@ -31,7 +31,8 @@ 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" }
snap-kube = { path = ".", version = "0.1" }
mockall = "0.13"

[dependencies]
anyhow.workspace = true
Expand All @@ -50,12 +51,13 @@ serde_json.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
mockall.workspace = true

[lib]
test = true
edition = "2021"
crate-type = ["lib"]
name = "pvc_snapshotter"
name = "snap_kube"

[features]
default = ["full"]
Expand Down
32 changes: 13 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
<h1 align="center">PVC-Snapshotter</h1>
<h1 align="center">SnapKube</h1>
<div align="center">
<strong>
A Rust 🦀 tool supports PVC snapshots across Kubernetes namespaces (Velerust/Rustero)
A Rust 🦀 tool supports (for now) PVC snapshots across Kubernetes namespaces
</strong>
</div>

<br />

<div align="center">
<!-- Github Actions -->
<a href="https://github.com/nikoshet/pvc-snapshotter/actions/workflows/ci.yaml?query=branch%3Amain">
<img src="https://img.shields.io/github/actions/workflow/status/nikoshet/pvc-snapshotter/ci.yaml?branch=main&style=flat-square" alt="actions status" /></a>
<a href="https://github.com/nikoshet/snap-kube/actions/workflows/ci.yaml?query=branch%3Amain">
<img src="https://img.shields.io/github/actions/workflow/status/nikoshet/snap-kube/ci.yaml?branch=main&style=flat-square" alt="actions status" /></a>
<!-- Version -->
<a href="https://crates.io/crates/pvc-snapshotter">
<img src="https://img.shields.io/crates/v/pvc-snapshotter.svg?style=flat-square"
<a href="https://crates.io/crates/snap-kube">
<img src="https://img.shields.io/crates/v/snap-kube.svg?style=flat-square"
alt="Crates.io version" /></a>
<!-- Docs -->
<a href="https://docs.rs/pvc-snapshotter">
<a href="https://docs.rs/snap-kube">
<img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square" alt="docs.rs docs" /></a>
<!-- Downloads -->
<a href="https://crates.io/crates/pvc-snapshotter">
<img src="https://img.shields.io/crates/d/pvc-snapshotter.svg?style=flat-square" alt="Download" />
<a href="https://crates.io/crates/snap-kube">
<img src="https://img.shields.io/crates/d/snap-kube.svg?style=flat-square" alt="Download" />
</a>
</div>

## Overview
The PVC-Snapshotter Tool is a Rust-based utility that allows Kubernetes users to backup and restore Persistent Volume Claim (PVC) snapshots. The tool provides robust mechanisms to back up data to AWS Elastic Block Store (EBS) and restore it to any Kubernetes namespace. This tool is designed to work with Kubernetes VolumeSnapshot resources, making backup and restoration operations seamless.
The SnapKube Tool is a Rust-based utility that allows Kubernetes users to backup and restore Persistent Volume Claim (PVC) snapshots. The tool provides robust mechanisms to back up data to AWS Elastic Block Store (EBS) and restore it to any Kubernetes namespace. This tool is designed to work with Kubernetes VolumeSnapshot resources, making backup and restoration operations seamless.

The tool supports three primary modes of operation:

Backup: Create snapshots of one or more PVCs.
Restore: Restore PVCs from existing snapshots.
Full: Run both backup and restore operations in a single process.


<br>
> [!NOTE]
> Average percentage of time saved by PVC-Snapshotter compared to [Velero](https://github.com/vmware-tanzu/velero): **X%**.
<br>
## Features
- **Backup**: Create Kubernetes VolumeSnapshots from existing PVCs
- **Restore**: Restore PVCs to any namespace from a VolumeSnapshot
Expand All @@ -48,7 +42,7 @@ The tool supports three primary modes of operation:
- **Error Handling**: Robust error handling and retries to ensure operations complete reliably

## Prerequisites
Before using PVC-Snapshotter, please ensure you have the following:
Before using SnapKube, please ensure you have the following:
- You need Rust installed to compile the tool. Install Rust via rustup
- An AWS Account with the appropriate access policy
- AWS EBS CSI Driver: Required to be installed in your Kubernetes cluster, which is a CSI Driver to manage the lifecycle of EBS Volumes
Expand All @@ -61,7 +55,7 @@ In order to use the tool as a client, you can use `cargo`.

The tool provides 3 features for running it, which are `backup` `restore`, and `full` (default).
```shell
Usage: pvc-snapshotter-client full [OPTIONS] --source-ns <SOURCE_NS> --target-ns <TARGET_NS> --volume-snapshot-class <VOLUME_SNAPSHOT_CLASS> --volume-snapshot-name-prefix <VOLUME_SNAPSHOT_NAME_PREFIX> --target-snapshot-content-name-prefix <TARGET_SNAPSHOT_CONTENT_NAME_PREFIX> --storage-class-name <STORAGE_CLASS_NAME>
Usage: snap-kube-client full [OPTIONS] --source-ns <SOURCE_NS> --target-ns <TARGET_NS> --volume-snapshot-class <VOLUME_SNAPSHOT_CLASS> --volume-snapshot-name-prefix <VOLUME_SNAPSHOT_NAME_PREFIX> --target-snapshot-content-name-prefix <TARGET_SNAPSHOT_CONTENT_NAME_PREFIX> --storage-class-name <STORAGE_CLASS_NAME>

Options:
--region <REGION>
Expand Down Expand Up @@ -113,7 +107,7 @@ cargo run --no-default-features --features restore -- restore
```shell
cargo fmt --all
cargo clippy --all

cargo nextest run --all
cargo build

RUST_LOG=info \
Expand Down
Loading

0 comments on commit cd7f7ad

Please sign in to comment.