Skip to content
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
38 changes: 38 additions & 0 deletions cluster.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/** Service responsible for cluster information */
syntax = "proto3";

package workflow;

option go_package = "./pb";

service cluster {
rpc Get (ClusterGetRequest) returns (ClusterGetResponse) {}
}

/**
* Get the cluster status
*/
message ClusterGetRequest {
}

/**
* Returns the cluster status
*/
message ClusterGetResponse {
enum ClusterStatus {
None = 0;
Operational = 1;
Degraded = 2;
PartialOutage = 3;
MajorOutage = 4;
}
ClusterStatus Status = 1; // Status of the cluster
string Version = 2; // Version number
string BuildDate = 3; // When this version was built
ClusterEndpoints Endpoints = 4; // Endpoints for the cluster
}

message ClusterEndpoints {
string Console = 1; // Base URI for the UI
string SSH = 2; // URI for SSH connections
}
4 changes: 4 additions & 0 deletions cmd/apiserver-mock/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/skpr/api/internal/model"
"github.com/skpr/api/internal/server/mock/backup"
"github.com/skpr/api/internal/server/mock/cluster"
"github.com/skpr/api/internal/server/mock/config"
"github.com/skpr/api/internal/server/mock/cron"
"github.com/skpr/api/internal/server/mock/environment"
Expand Down Expand Up @@ -78,6 +79,9 @@ func main() {
Model: globalModel,
})

log.Println("Registering service: Cluster")
pb.RegisterClusterServer(server, &cluster.Server{})

log.Println("Registering service: Trace")
pb.RegisterTraceServer(server, &trace.Server{})

Expand Down
27 changes: 27 additions & 0 deletions internal/server/mock/cluster/server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cluster

import (
"context"

"github.com/skpr/api/pb"
)

// Server implements the GRPC "cluster" definition.
type Server struct {
pb.UnimplementedClusterServer
}

// Get the cluster status from the server.
func (s *Server) Get(ctx context.Context, req *pb.ClusterGetRequest) (*pb.ClusterGetResponse, error) {
resp := &pb.ClusterGetResponse{
Status: pb.ClusterGetResponse_Operational,
Version: "0.34.5-mock",
BuildDate: "2025-05-06",
Endpoints: &pb.ClusterEndpoints{
Console: "https://console.mock.localhost",
SSH: "console.mock.localhost:5000",
},
}

return resp, nil
}
Loading