Skip to content

Commit 4c2dda2

Browse files
committed
fix: add involvedObject.apiVersion to SSE event payload
The frontend destructures apiVersion from involvedObject when rendering the EventList widget. Add it to the SQL query and the SSEK8sEvent struct to match the Kubernetes core/v1.Event shape the frontend expects. Made-with: Cursor
1 parent 7cad4fc commit 4c2dda2

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

sse-proxy/main.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ type SSEK8sEvent struct {
3535
CreationTimestamp string `json:"creationTimestamp"`
3636
} `json:"metadata"`
3737
InvolvedObject struct {
38-
Kind string `json:"kind"`
39-
Name string `json:"name"`
40-
Namespace string `json:"namespace"`
41-
UID string `json:"uid"`
38+
APIVersion string `json:"apiVersion"`
39+
Kind string `json:"kind"`
40+
Name string `json:"name"`
41+
Namespace string `json:"namespace"`
42+
UID string `json:"uid"`
4243
} `json:"involvedObject"`
4344
Reason string `json:"reason"`
4445
Message string `json:"message"`
@@ -61,6 +62,7 @@ type SSEK8sEvent struct {
6162
type chRow struct {
6263
TsUnix int64 `json:"ts_unix"`
6364
CompositionID string `json:"composition_id"`
65+
ObjAPIVersion string `json:"obj_apiversion"`
6466
ObjName string `json:"obj_name"`
6567
ObjNamespace string `json:"obj_namespace"`
6668
ObjUID string `json:"obj_uid"`
@@ -78,6 +80,7 @@ func (row chRow) toSSEK8sEvent() SSEK8sEvent {
7880
evt.Metadata.Namespace = row.ObjNamespace
7981
evt.Metadata.UID = row.ObjUID
8082
evt.Metadata.CreationTimestamp = row.EventTime
83+
evt.InvolvedObject.APIVersion = row.ObjAPIVersion
8184
evt.InvolvedObject.Kind = row.ObjKind
8285
evt.InvolvedObject.Name = row.ObjName
8386
evt.InvolvedObject.Namespace = row.ObjNamespace
@@ -183,6 +186,7 @@ func getEnv(key, fallback string) string {
183186
const pollSQL = `SELECT
184187
toUnixTimestamp(Timestamp) AS ts_unix,
185188
ifNull(LogAttributes['krateo.io/composition-id'], '') AS composition_id,
189+
ifNull(JSONExtractString(Body, 'object', 'involvedObject', 'apiVersion'), '') AS obj_apiversion,
186190
ifNull(JSONExtractString(Body, 'object', 'involvedObject', 'name'), '') AS obj_name,
187191
ifNull(JSONExtractString(Body, 'object', 'involvedObject', 'namespace'), '') AS obj_namespace,
188192
ifNull(JSONExtractString(Body, 'object', 'involvedObject', 'uid'), '') AS obj_uid,

0 commit comments

Comments
 (0)