From 4a500e4eb745a77561275290ad5755f0a20f26cb Mon Sep 17 00:00:00 2001 From: Jean-Gabriel Gill-Couture Date: Wed, 24 Sep 2025 21:54:32 -0400 Subject: [PATCH] feat: Add openbao example, open-source fork of vault --- examples/openbao/Cargo.toml | 14 ++++++++ examples/openbao/README.md | 7 ++++ examples/openbao/src/main.rs | 66 ++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 examples/openbao/Cargo.toml create mode 100644 examples/openbao/README.md create mode 100644 examples/openbao/src/main.rs diff --git a/examples/openbao/Cargo.toml b/examples/openbao/Cargo.toml new file mode 100644 index 0000000..ae0a793 --- /dev/null +++ b/examples/openbao/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "example-openbao" +edition = "2024" +version.workspace = true +readme.workspace = true +license.workspace = true + +[dependencies] +harmony = { path = "../../harmony" } +harmony_cli = { path = "../../harmony_cli" } +harmony_macros = { path = "../../harmony_macros" } +harmony_types = { path = "../../harmony_types" } +tokio.workspace = true +url.workspace = true diff --git a/examples/openbao/README.md b/examples/openbao/README.md new file mode 100644 index 0000000..d78556c --- /dev/null +++ b/examples/openbao/README.md @@ -0,0 +1,7 @@ +To install an openbao instance with harmony simply `cargo run -p example-openbao` . + +Depending on your environement configuration, it will either install a k3d cluster locally and deploy on it, or install to a remote cluster. + +Then follow the openbao documentation to initialize and unseal, this will make openbao usable. + +https://openbao.org/docs/platform/k8s/helm/run/ diff --git a/examples/openbao/src/main.rs b/examples/openbao/src/main.rs new file mode 100644 index 0000000..34d5973 --- /dev/null +++ b/examples/openbao/src/main.rs @@ -0,0 +1,66 @@ +use std::{collections::HashMap, str::FromStr}; + +use harmony::{ + inventory::Inventory, + modules::helm::chart::{HelmChartScore, HelmRepository, NonBlankString}, + topology::K8sAnywhereTopology, +}; +use harmony_macros::hurl; + +#[tokio::main] +async fn main() { + let values_yaml = Some( + r#"server: + standalone: + enabled: true + config: | + listener "tcp" { + tls_disable = true + address = "[::]:8200" + cluster_address = "[::]:8201" + } + + storage "file" { + path = "/openbao/data" + } + + service: + enabled: true + + dataStorage: + enabled: true + size: 10Gi + storageClass: null + accessMode: ReadWriteOnce + + auditStorage: + enabled: true + size: 10Gi + storageClass: null + accessMode: ReadWriteOnce"#.to_string(), + ); + let openbao = HelmChartScore { + namespace: Some(NonBlankString::from_str("openbao").unwrap()), + release_name: NonBlankString::from_str("openbao").unwrap(), + chart_name: NonBlankString::from_str("openbao/openbao").unwrap(), + chart_version: None, + values_overrides: None, + values_yaml, + create_namespace: true, + install_only: true, + repository: Some(HelmRepository::new( + "openbao".to_string(), + hurl!("https://openbao.github.io/openbao-helm"), + true, + )), + }; + + harmony_cli::run( + Inventory::autoload(), + K8sAnywhereTopology::from_env(), + vec![Box::new(openbao)], + None, + ) + .await + .unwrap(); +}