feat: PostgreSQL public and Connection test score, also moved k8s_anywhere in a folder
Some checks failed
Run Check Script / check (pull_request) Failing after 40s

This commit is contained in:
2025-12-16 14:57:02 -05:00
parent 29821d5e9f
commit c3ec7070ec
7 changed files with 383 additions and 42 deletions

View File

@@ -1,32 +1,33 @@
use harmony::{
inventory::Inventory,
modules::{network::TlsPassthroughScore, postgresql::PostgreSQLScore},
topology::{K8sAnywhereTopology, TlsRoute},
modules::postgresql::{PostgreSQLConnectionScore, PostgreSQLScore, PublicPostgreSQLScore},
topology::K8sAnywhereTopology,
};
#[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 postgres = PublicPostgreSQLScore {
postgres_score: PostgreSQLScore {
name: "harmony-postgres-example".to_string(), // Override default name
namespace: "harmony-public-postgres".to_string(),
..Default::default() // Use harmony defaults, they are based on CNPG's default values :
// "default" namespace, 1 instance, 1Gi storage
},
hostname: "postgrestest.sto1.nationtech.io".to_string(),
};
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
},
let test_connection = PostgreSQLConnectionScore {
name: "harmony-postgres-example".to_string(),
namespace: "harmony-public-postgres".to_string(),
cluster_name: "harmony-postgres-example".to_string(),
hostname: Some("postgrestest.sto1.nationtech.io".to_string()),
port_override: Some(443),
};
harmony_cli::run(
Inventory::autoload(),
K8sAnywhereTopology::from_env(),
vec![Box::new(postgresql), Box::new(tls_passthrough)],
vec![Box::new(postgres), Box::new(test_connection)],
None,
)
.await