wip: public postgres many fixes and refactoring to have a more cohesive routing management
Some checks failed
Run Check Script / check (pull_request) Failing after 41s

This commit is contained in:
2025-12-15 17:04:30 -05:00
parent e0da5764fb
commit 446e079595
7 changed files with 88 additions and 71 deletions

View File

@@ -0,0 +1,34 @@
use harmony::{
inventory::Inventory,
modules::{network::TlsPassthroughScore, postgresql::PostgreSQLScore},
topology::{K8sAnywhereTopology, TlsRoute},
};
#[tokio::main]
async fn main() {
let namespace = "harmony-postgres-example".to_string();
let postgresql = PostgreSQLScore {
name: "harmony-postgres-example".to_string(), // Override default name
namespace: namespace.clone(),
..Default::default() // Use harmony defaults, they are based on CNPG's default values :
// "default" namespace, 1 instance, 1Gi storage
};
let tls_passthrough = TlsPassthroughScore {
route: TlsRoute {
hostname: "postgres.example.com".to_string(), // CNPG creates a -rw service for read-write endpoint
backend: format!("{}-rw", postgresql.name), // Public hostname for TLS SNI
namespace: namespace.clone(),
target_port: 5432, // PostgreSQL default port
},
};
harmony_cli::run(
Inventory::autoload(),
K8sAnywhereTopology::from_env(),
vec![Box::new(postgresql), Box::new(tls_passthrough)],
None,
)
.await
.unwrap();
}