Skip to content

Commit

Permalink
Working on gotify message format
Browse files Browse the repository at this point in the history
  • Loading branch information
LawiK974 committed Mar 14, 2024
1 parent ca7a8ec commit 6bf8f6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions kube_notify/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ async def core_stream(kube_notify_config):
involved_object_name = str(obj.involved_object.name)
involved_object_namespace = str(obj.involved_object.namespace)

title = f"{resource_kind} {event_type}"
title = f"{event_type} {resource_kind}"
description = f"{event_type} {resource_kind} : {involved_object_kind} {involved_object_name} {reason}."
fields = {
"Message": message,
"Reason": reason,
"Type": event_type,
"Message": message,
"Object kind": involved_object_kind,
"Object name": involved_object_name,
"Timestamp": last_timestamp.isoformat(),
"Involved Object kind": involved_object_kind,
"Involved Object name": involved_object_name,
"Namespace": str(obj.metadata.namespace),
}
event_info = (
Expand Down
4 changes: 2 additions & 2 deletions kube_notify/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ def send_gotify_message(url, token, title, description, fields):
url = f"{url}/message?token={token}&format=markdown"
headers = {"Content-Type": "application/json"}
message = f"**{description}**\n\n"
message += "| Clé | Valeur |\n"
message += "| | |\n"
message += "| ---- | ---- |\n"
for key, value in fields.items():
message += f"| {key} | {value} |\n"
message += f"| {key} | **{value}** |\n"
data = {
"title": title,
"message": message,
Expand Down

0 comments on commit 6bf8f6c

Please sign in to comment.