diff --git a/harmony/src/domain/topology/k8s.rs b/harmony/src/domain/topology/k8s.rs index b969cad..cfaae1f 100644 --- a/harmony/src/domain/topology/k8s.rs +++ b/harmony/src/domain/topology/k8s.rs @@ -26,7 +26,11 @@ impl K8sClient { ::Scope: ApplyStrategy, ::DynamicType: Default, { - debug!("Applying resource {:?} with ns {:?}", resource.meta().name, ns); + debug!( + "Applying resource {:?} with ns {:?}", + resource.meta().name, + ns + ); trace!("{:#?}", serde_json::to_string(resource)); let api: Api = <::Scope as ApplyStrategy>::get_api(&self.client, ns); diff --git a/harmony/src/modules/k8s/ingress.rs b/harmony/src/modules/k8s/ingress.rs index 883d721..d07d82f 100644 --- a/harmony/src/modules/k8s/ingress.rs +++ b/harmony/src/modules/k8s/ingress.rs @@ -1,5 +1,6 @@ use harmony_macros::ingress_path; use k8s_openapi::api::networking::v1::Ingress; +use log::{debug, trace}; use serde::Serialize; use serde_json::json; @@ -56,22 +57,24 @@ impl Score for K8sIngressScore { let ingress = json!( { "metadata": { - "name": self.name + "name": self.name.to_string(), }, "spec": { "rules": [ - { "host": self.host, + { "host": self.host.to_string(), "http": { "paths": [ { "path": path, "pathType": path_type.as_str(), - "backend": [ - { - "service": self.backend_service, - "port": self.port + "backend": { + "service": { + "name": self.backend_service.to_string(), + "port": { + "number": self.port, + } } - ] + } } ] } @@ -81,13 +84,16 @@ impl Score for K8sIngressScore { } ); + trace!("Building ingresss object from Value {ingress:#}"); let ingress: Ingress = serde_json::from_value(ingress).unwrap(); + debug!( + "Successfully built Ingress for host {:?}", + ingress.metadata.name + ); Box::new(K8sResourceInterpret { score: K8sResourceScore::single( ingress.clone(), - self.namespace - .clone() - .map(|f| f.as_c_str().to_str().unwrap().to_string()), + self.namespace.clone().map(|f| f.to_string()), ), }) }