From 39aaf7c3742316a52dca7fb78bf6fe4851825f36 Mon Sep 17 00:00:00 2001 From: Ian Letourneau Date: Tue, 12 Aug 2025 12:06:53 -0400 Subject: [PATCH] reconfigure ntffy + add more logs --- harmony/src/domain/topology/k8s.rs | 2 +- .../features/continuous_delivery.rs | 2 +- .../application/features/monitoring.rs | 6 ++-- .../monitoring/ntfy/helm/ntfy_helm_chart.rs | 32 ++++++------------- harmony_cli/src/cli_logger.rs | 9 +++++- 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/harmony/src/domain/topology/k8s.rs b/harmony/src/domain/topology/k8s.rs index 1314f6a..388ff9d 100644 --- a/harmony/src/domain/topology/k8s.rs +++ b/harmony/src/domain/topology/k8s.rs @@ -120,7 +120,7 @@ impl K8sClient { .expect("Couldn't unwrap status"); if let Some(s) = status.status { - debug!("Status: {}", s); + debug!("Status: {} - {:?}", s, status.details); if s == "Success" { Ok(()) } else { Err(s) } } else { Err("Couldn't get inner status of pod exec".to_string()) diff --git a/harmony/src/modules/application/features/continuous_delivery.rs b/harmony/src/modules/application/features/continuous_delivery.rs index d483b84..7b447d0 100644 --- a/harmony/src/modules/application/features/continuous_delivery.rs +++ b/harmony/src/modules/application/features/continuous_delivery.rs @@ -178,7 +178,7 @@ impl< info!("Deploying {} to target {target:?}", self.application.name()); let score = ArgoHelmScore { namespace: "harmony-example-rust-webapp".to_string(), - openshift: false, + openshift: true, domain: "argo.harmonydemo.apps.ncd0.harmony.mcd".to_string(), argo_apps: vec![ArgoApplication::from(CDApplicationConfig { // helm pull oci://hub.nationtech.io/harmony/harmony-example-rust-webapp-chart --version 0.1.0 diff --git a/harmony/src/modules/application/features/monitoring.rs b/harmony/src/modules/application/features/monitoring.rs index 1ffdace..e44679b 100644 --- a/harmony/src/modules/application/features/monitoring.rs +++ b/harmony/src/modules/application/features/monitoring.rs @@ -55,11 +55,11 @@ impl< }; let ntfy = NtfyScore { namespace: namespace.clone(), - host: "localhost".to_string(), + host: "ntfy.harmonydemo.apps.ncd0.harmony.mcd".to_string(), }; ntfy.interpret(&Inventory::empty(), topology) .await - .expect("couldn't create interpret for ntfy"); + .map_err(|e| e.to_string())?; let ntfy_default_auth_username = "harmony"; let ntfy_default_auth_password = "harmony"; @@ -96,7 +96,7 @@ impl< alerting_score .interpret(&Inventory::empty(), topology) .await - .unwrap(); + .map_err(|e| e.to_string())?; Ok(()) } fn name(&self) -> String { diff --git a/harmony/src/modules/monitoring/ntfy/helm/ntfy_helm_chart.rs b/harmony/src/modules/monitoring/ntfy/helm/ntfy_helm_chart.rs index 5f88fa5..444ecc5 100644 --- a/harmony/src/modules/monitoring/ntfy/helm/ntfy_helm_chart.rs +++ b/harmony/src/modules/monitoring/ntfy/helm/ntfy_helm_chart.rs @@ -25,24 +25,14 @@ serviceAccount: service: type: ClusterIP - port: 80 - targetPort: 8080 + port: 8080 ingress: - enabled: true -# annotations: - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: {host} - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local + enabled: false +route: + enabled: true + host: {host} autoscaling: enabled: false @@ -50,7 +40,7 @@ autoscaling: config: enabled: true data: -# base-url: "https://ntfy.something.com" + base-url: "https://{host}" auth-file: "/var/cache/ntfy/user.db" auth-default-access: "deny-all" cache-file: "/var/cache/ntfy/cache.db" @@ -71,16 +61,12 @@ persistence: HelmChartScore { namespace: Some(NonBlankString::from_str(&namespace).unwrap()), release_name: NonBlankString::from_str("ntfy").unwrap(), - chart_name: NonBlankString::from_str("sarab97/ntfy").unwrap(), - chart_version: Some(NonBlankString::from_str("0.1.7").unwrap()), + chart_name: NonBlankString::from_str("oci://hub.nationtech.io/harmony/ntfy").unwrap(), + chart_version: Some(NonBlankString::from_str("0.1.7-nationtech.1").unwrap()), values_overrides: None, values_yaml: Some(values.to_string()), create_namespace: true, install_only: false, - repository: Some(HelmRepository::new( - "sarab97".to_string(), - url::Url::parse("https://charts.sarabsingh.com").unwrap(), - true, - )), + repository: None, } } diff --git a/harmony_cli/src/cli_logger.rs b/harmony_cli/src/cli_logger.rs index 6f11265..9078e5d 100644 --- a/harmony_cli/src/cli_logger.rs +++ b/harmony_cli/src/cli_logger.rs @@ -5,7 +5,12 @@ use harmony::{ }; use indicatif::MultiProgress; use indicatif_log_bridge::LogWrapper; -use std::sync::{Arc, Mutex}; +use log::error; +use std::{ + sync::{Arc, Mutex}, + thread, + time::Duration, +}; use crate::progress::{IndicatifProgressTracker, ProgressTracker}; @@ -59,6 +64,7 @@ async fn handle_events(base_progress: MultiProgress) { &format!("\n{} Harmony completed\n\n", crate::theme::EMOJI_HARMONY), ); progress_tracker.add_section("harmony-finished", "\n\n"); + thread::sleep(Duration::from_millis(200)); return false; } HarmonyEvent::TopologyStateChanged { @@ -157,6 +163,7 @@ async fn handle_events(base_progress: MultiProgress) { _ => progress_tracker.fail_task(&task_key, &outcome.message), }, Err(err) => { + error!("Interpret error: {err}"); progress_tracker.fail_task(&task_key, &err.to_string()); } }