Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Add events page #13

Merged
merged 5 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .uptodate
Empty file.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
UPTODATE := .uptodate

all: test build

ui:
ui: $(UPTODATE)
npm run build

test:
test: ui assets
go test ./...

assets: ui
Expand Down
107 changes: 18 additions & 89 deletions pkg/assets/assets.go

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions pkg/clustersserver/clustersserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,3 +454,29 @@ func (s *Server) ListWorkloads(ctx context.Context, msg *pb.ListWorkloadsReq) (*
return &pb.ListWorkloadsRes{Workloads: workloads}, nil

}

func (s *Server) ListEvents(ctx context.Context, msg *pb.ListEventsReq) (*pb.ListEventsRes, error) {
c, err := s.getClient(msg.ContextName)

if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}

list := corev1.EventList{}
if err := c.List(ctx, &list, namespaceOpts(msg.Namespace)); err != nil {
return nil, fmt.Errorf("could not get events: %w", err)
}

events := []*pb.Event{}

for _, e := range list.Items {
events = append(events, &pb.Event{
Type: e.Type,
Reason: e.Reason,
Message: e.Message,
Timestamp: int32(e.LastTimestamp.Unix()),
})
}

return &pb.ListEventsRes{Events: events}, nil
}
355 changes: 295 additions & 60 deletions pkg/rpc/clusters/clusters.pb.go

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions pkg/rpc/clusters/clusters.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ service Clusters {
rpc SyncKustomization (SyncKustomizationReq) returns (SyncKustomizationRes);
rpc ListHelmReleases (ListHelmReleasesReq) returns (ListHelmReleasesRes);
rpc ListWorkloads (ListWorkloadsReq) returns (ListWorkloadsRes);
rpc ListEvents (ListEventsReq) returns (ListEventsRes);
}

message Context {
Expand Down Expand Up @@ -178,3 +179,19 @@ message ListKustomizationChildrenReq {
message ListKustomizationChildrenRes {
repeated Workload workloads = 1;
}

message Event {
string type = 1;
string reason = 2;
string message = 3;
int32 timestamp = 4;
}

message ListEventsReq {
string contextName = 1;
string namespace = 2;
}

message ListEventsRes {
repeated Event events = 1;
}
Loading