Compare commits
No commits in common. "cf0b8326dc9d896cec1d16fb013fa4aeb371ce9b" and "7f50c36f11a18171446903947f8ae8b0bafc86c9" have entirely different histories.
cf0b8326dc
...
7f50c36f11
@ -64,13 +64,12 @@ impl<
|
|||||||
application: self.application.clone(),
|
application: self.application.clone(),
|
||||||
receivers: self.alert_receiver.clone(),
|
receivers: self.alert_receiver.clone(),
|
||||||
};
|
};
|
||||||
let domain = topology
|
|
||||||
.get_domain("ntfy")
|
|
||||||
.await
|
|
||||||
.map_err(|e| format!("could not get domain {e}"))?;
|
|
||||||
let ntfy = NtfyScore {
|
let ntfy = NtfyScore {
|
||||||
namespace: namespace.clone(),
|
namespace: namespace.clone(),
|
||||||
host: domain.clone(),
|
host: topology
|
||||||
|
.get_domain("ntfy")
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Could not get domain {e}"))?,
|
||||||
};
|
};
|
||||||
ntfy.interpret(&Inventory::empty(), topology)
|
ntfy.interpret(&Inventory::empty(), topology)
|
||||||
.await
|
.await
|
||||||
@ -92,33 +91,27 @@ impl<
|
|||||||
.replace("=", "");
|
.replace("=", "");
|
||||||
|
|
||||||
debug!("ntfy_default_auth_param: {ntfy_default_auth_param}");
|
debug!("ntfy_default_auth_param: {ntfy_default_auth_param}");
|
||||||
|
|
||||||
let ntfy_receiver = WebhookReceiver {
|
let ntfy_receiver = WebhookReceiver {
|
||||||
name: "ntfy-webhook".to_string(),
|
name: "ntfy-webhook".to_string(),
|
||||||
url: Url::Url(
|
url: Url::Url(
|
||||||
url::Url::parse(
|
url::Url::parse(
|
||||||
format!(
|
format!(
|
||||||
"http://{domain}/{}?auth={ntfy_default_auth_param}",
|
"http://ntfy.{}.svc.cluster.local/rust-web-app?auth={ntfy_default_auth_param}",
|
||||||
self.application.name()
|
namespace.clone()
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
debug!(
|
|
||||||
"ntfy webhook receiver \n{:#?}\nntfy topic: {}",
|
|
||||||
ntfy_receiver.clone(),
|
|
||||||
self.application.name()
|
|
||||||
);
|
|
||||||
alerting_score.receivers.push(Box::new(ntfy_receiver));
|
alerting_score.receivers.push(Box::new(ntfy_receiver));
|
||||||
alerting_score
|
alerting_score
|
||||||
.interpret(&Inventory::empty(), topology)
|
.interpret(&Inventory::empty(), topology)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
Ok(InstallationOutcome::success_with_details(vec![format!(
|
Ok(InstallationOutcome::success())
|
||||||
"ntfy topic: {}",
|
|
||||||
self.application.name()
|
|
||||||
)]))
|
|
||||||
}
|
}
|
||||||
fn name(&self) -> String {
|
fn name(&self) -> String {
|
||||||
"Monitoring".to_string()
|
"Monitoring".to_string()
|
||||||
|
|||||||
@ -257,7 +257,6 @@ impl RustWebapp {
|
|||||||
".harmony_generated",
|
".harmony_generated",
|
||||||
"harmony",
|
"harmony",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"Dockerfile.harmony",
|
|
||||||
];
|
];
|
||||||
let mut entries: Vec<_> = WalkDir::new(project_root)
|
let mut entries: Vec<_> = WalkDir::new(project_root)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|||||||
@ -35,24 +35,6 @@ pub struct DiscordWebhook {
|
|||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl AlertReceiver<RHOBObservability> for DiscordWebhook {
|
impl AlertReceiver<RHOBObservability> for DiscordWebhook {
|
||||||
async fn install(&self, sender: &RHOBObservability) -> Result<Outcome, InterpretError> {
|
async fn install(&self, sender: &RHOBObservability) -> Result<Outcome, InterpretError> {
|
||||||
let ns = sender.namespace.clone();
|
|
||||||
let secret_name = format!("{}-secret", self.name.clone());
|
|
||||||
let webhook_key = format!("{}", self.url.clone());
|
|
||||||
|
|
||||||
let mut string_data = BTreeMap::new();
|
|
||||||
string_data.insert("webhook-url".to_string(), webhook_key.clone());
|
|
||||||
|
|
||||||
let secret = Secret {
|
|
||||||
metadata: kube::core::ObjectMeta {
|
|
||||||
name: Some(secret_name.clone()),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
string_data: Some(string_data),
|
|
||||||
type_: Some("Opaque".to_string()),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let _ = sender.client.apply(&secret, Some(&ns)).await;
|
|
||||||
let spec = crate::modules::monitoring::kube_prometheus::crd::rhob_alertmanager_config::AlertmanagerConfigSpec {
|
let spec = crate::modules::monitoring::kube_prometheus::crd::rhob_alertmanager_config::AlertmanagerConfigSpec {
|
||||||
data: json!({
|
data: json!({
|
||||||
"route": {
|
"route": {
|
||||||
@ -61,14 +43,9 @@ impl AlertReceiver<RHOBObservability> for DiscordWebhook {
|
|||||||
"receivers": [
|
"receivers": [
|
||||||
{
|
{
|
||||||
"name": self.name,
|
"name": self.name,
|
||||||
"discordConfigs": [
|
"webhookConfigs": [
|
||||||
{
|
{
|
||||||
"apiURL": {
|
"url": self.url,
|
||||||
"name": secret_name,
|
|
||||||
"key": "webhook-url",
|
|
||||||
},
|
|
||||||
"title": "{{ template \"discord.default.title\" . }}",
|
|
||||||
"message": "{{ template \"discord.default.message\" . }}"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,11 +43,6 @@ impl AlertReceiver<RHOBObservability> for WebhookReceiver {
|
|||||||
"webhookConfigs": [
|
"webhookConfigs": [
|
||||||
{
|
{
|
||||||
"url": self.url,
|
"url": self.url,
|
||||||
"httpConfig": {
|
|
||||||
"tlsConfig": {
|
|
||||||
"insecureSkipVerify": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ pub fn alert_pod_not_ready() -> PrometheusAlertRule {
|
|||||||
PrometheusAlertRule {
|
PrometheusAlertRule {
|
||||||
alert: "PodNotReady".into(),
|
alert: "PodNotReady".into(),
|
||||||
expr: "kube_pod_status_ready{condition=\"true\"} == 0".into(),
|
expr: "kube_pod_status_ready{condition=\"true\"} == 0".into(),
|
||||||
r#for: Some("30s".into()),
|
r#for: Some("2m".into()),
|
||||||
labels: HashMap::from([("severity".into(), "warning".into())]),
|
labels: HashMap::from([("severity".into(), "warning".into())]),
|
||||||
annotations: HashMap::from([
|
annotations: HashMap::from([
|
||||||
("summary".into(), "Pod is not ready".into()),
|
("summary".into(), "Pod is not ready".into()),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user