Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
feat: introduce node compatibility status API
Browse files Browse the repository at this point in the history
CP modifies the configuration based on the version of DP. These
modifications need to be tracked and exposed to the end-user to inform
the user of (potentially adverse) configuration mutations

This patch contains the user-facing API as well as internal API for
this, Specifically,
- User facing "Node" resource gets a new CompatibilityStatus message.
  The user can consult this object to determine compatibility status and
  issues (if any) associated with the node. The "state" field will be an
  enum that will be defined in code in a subsequent patch. The currently
  planned values are "FULLY-COMPATIBLE" and "PARTIALLY-COMPATIBLE".
- Compatibility for each node is tracked as a separate resource
  internally. CP (ws.Manager) is responsible for tracking compatibility
  status of each node in the database (via the relay service). Foreign
  key relationships ensure easy clean up of NodeStatus resources. The
  (internal) API will be responsible of merging Node and NodeStatus resouces and
  presenting it as a unified single Node resource to the end user.
  The separation is done for performance reasons: Node resource sees frequent
  u pdates (once every 30s) while NodeStatus is expected to see far fewer updates
  which may be very large (128 possible changes with 128 resources each can result
  in > 7000 kilobytes of data)
  • Loading branch information
hbagdi committed Aug 1, 2022
1 parent 06c1b42 commit e807abd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
20 changes: 19 additions & 1 deletion internal/grpc/proto/kong/admin/model/v1/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,23 @@ message Node {
int32 created_at = 6;
int32 updated_at = 7;
string config_hash = 8;
// int32 last_config = 8;
CompatibilityStatus compatibility_status = 9;
}

message CompatibilityStatus {
string state = 1;
repeated CompatibilityIssue issues = 2;
}

message CompatibilityIssue {
string code = 1;
string severity = 2;
string description = 3;
string resolution = 4;
repeated Resource affected_resources = 5;
}

message Resource {
string type = 1;
string id = 2;
}
14 changes: 14 additions & 0 deletions internal/grpc/proto/kong/nonpublic/v1/node_status.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";

package kong.nonpublic.v1;

import "kong/admin/model/v1/node.proto";

option go_package = "github.com/kong/koko/internal/gen/grpc/kong/nonpublic/v1";

message NodeStatus {
string id = 1;
int32 created_at = 2;
int32 updated_at = 3;
repeated kong.admin.model.v1.CompatibilityIssue issues = 5;
}
9 changes: 9 additions & 0 deletions internal/grpc/proto/kong/relay/service/v1/status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package kong.relay.service.v1;

import "kong/admin/model/v1/cluster.proto";
import "kong/admin/model/v1/status.proto";
import "kong/nonpublic/v1/node_status.proto";

option go_package = "github.com/kong/koko/internal/gen/kong/relay/service/v1;v1";

Expand All @@ -15,6 +16,8 @@ service StatusService {
rpc ClearStatus(ClearStatusRequest) returns (ClearStatusResponse);

rpc UpdateExpectedHash(UpdateExpectedHashRequest) returns (UpdateExpectedHashResponse);

rpc UpdateNodeStatus(UpdateNodeStatusRequest) returns (UpdateNodeStatusResponse);
}

message UpdateStatusRequest {
Expand All @@ -39,3 +42,9 @@ message UpdateExpectedHashRequest {
}

message UpdateExpectedHashResponse {}

message UpdateNodeStatusRequest {
nonpublic.v1.NodeStatus node_status = 1;
}

message UpdateNodeStatusResponse {}

0 comments on commit e807abd

Please sign in to comment.