From 694f0dc04581b9d44b1971c1d74b7b24e47d5d0f Mon Sep 17 00:00:00 2001 From: tahahawa Date: Fri, 11 Jul 2025 09:41:18 -0400 Subject: [PATCH] fix app name/namespace --- examples/rust/src/main.rs | 8 +++----- .../src/modules/application/features/monitoring.rs | 14 +++++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/examples/rust/src/main.rs b/examples/rust/src/main.rs index 6df2ce9..92bcbd0 100644 --- a/examples/rust/src/main.rs +++ b/examples/rust/src/main.rs @@ -4,12 +4,10 @@ use harmony::{ inventory::Inventory, maestro::Maestro, modules::application::{ - ApplicationScore, RustWebFramework, RustWebapp, - features::{ContinuousDelivery, Monitoring}, - }, - topology::{ - K8sAnywhereTopology, Url, + ApplicationScore, RustWebFramework, RustWebapp, + features::{ContinuousDelivery, Monitoring}, }, + topology::{K8sAnywhereTopology, Url}, }; #[tokio::main] diff --git a/harmony/src/modules/application/features/monitoring.rs b/harmony/src/modules/application/features/monitoring.rs index fa7ac71..126718d 100644 --- a/harmony/src/modules/application/features/monitoring.rs +++ b/harmony/src/modules/application/features/monitoring.rs @@ -1,3 +1,5 @@ +use std::sync::Arc; + use async_trait::async_trait; use base64::{Engine as _, engine::general_purpose}; use log::{debug, info}; @@ -5,7 +7,7 @@ use log::{debug, info}; use crate::{ inventory::Inventory, modules::{ - application::ApplicationFeature, + application::{ApplicationFeature, OCICompliant}, monitoring::{ alert_channel::webhook_receiver::WebhookReceiver, kube_prometheus::{ @@ -19,8 +21,10 @@ use crate::{ topology::{HelmCommand, K8sclient, Topology, Url, tenant::TenantManager}, }; -#[derive(Debug, Default, Clone)] -pub struct Monitoring {} +#[derive(Debug, Clone)] +pub struct Monitoring { + pub application: Arc, +} #[async_trait] impl ApplicationFeature @@ -35,7 +39,7 @@ impl Applicatio // .await // .expect("couldn't get tenant config") // .name, - namespace: "harmonydemo-staging".to_string(), + namespace: self.application.name(), host: "localhost".to_string(), }; ntfy.create_interpret() @@ -66,7 +70,7 @@ impl Applicatio url::Url::parse( format!( "http://ntfy.{}.svc.cluster.local/rust-web-app?auth={ntfy_default_auth_param}", - "harmonydemo-staging".to_string() + self.application.name() ) .as_str(), )