Skip to content

Commit

Permalink
Sync updated proto files
Browse files Browse the repository at this point in the history
  • Loading branch information
akoserwal authored and github-actions[bot] committed Sep 30, 2024
1 parent b54c5cd commit ea34033
Show file tree
Hide file tree
Showing 17 changed files with 700 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/proto/kessel/inventory/v1beta1/k8s_cluster.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";

package kessel.inventory.v1beta1.resources;

import "buf/validate/validate.proto";

import "kessel/inventory/v1beta1/resources/k8s_cluster_detail.proto";
import "kessel/inventory/v1beta1/resources/metadata.proto";
import "kessel/inventory/v1beta1/resources/reporter_data.proto";

option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources";
option java_multiple_files = true;
option java_package = "org.project_kessel.api.inventory.v1beta1.resources";
option java_outer_classname = "K8sClusterProto";

message K8sCluster {
// Metadata about this resource
Metadata metadata = 1;

// Write only reporter specific data
ReporterData reporter_data = 245278792 [ json_name = "reporter_data", (buf.validate.field).required = true ];

K8sClusterDetail resource_data = 2122698 [ json_name = "resource_data", (buf.validate.field).required = true ];
}
78 changes: 78 additions & 0 deletions src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
syntax = "proto3";

package kessel.inventory.v1beta1.resources;

import "kessel/inventory/v1beta1/resources/k8s_cluster_detail_nodes_inner.proto";
import "buf/validate/validate.proto";

option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources";
option java_multiple_files = true;
option java_package = "org.project_kessel.api.inventory.v1beta1.resources";
option java_outer_classname = "K8sClusterDetailProto";

message K8sClusterDetail {

// the aggregate status of the cluster
enum ClusterStatus {
CLUSTER_STATUS_UNSPECIFIED = 0;
CLUSTER_STATUS_OTHER = 1;
READY = 2;
FAILED = 3;
OFFLINE = 4;
}

// The kubernetes vendor
enum KubeVendor {
KUBE_VENDOR_UNSPECIFIED = 0;
KUBE_VENDOR_OTHER = 1;
AKS = 2;
EKS = 3;
IKS = 4;
OPENSHIFT = 5;
GKE = 6;
}

// The platform on which this cluster is hosted
enum CloudPlatform {
CLOUD_PLATFORM_UNSPECIFIED = 0;
CLOUD_PLATFORM_OTHER = 1;
NONE_UPI = 2;
BAREMETAL_IPI = 3;
BAREMETAL_UPI = 4;
AWS_IPI = 5;
AWS_UPI = 6;
AZURE_IPI = 7;
AZURE_UPI = 8;
IBMCLOUD_IPI = 9;
IBMCLOUD_UPI = 10;
KUBEVIRT_IPI = 11;
OPENSTACK_IPI = 12;
OPENSTACK_UPI = 13;
GCP_IPI = 14;
GCP_UPI = 15;
NUTANIX_IPI = 16;
NUTANIX_UPI = 17;
VSPHERE_IPI = 18;
VSPHERE_UPI = 19;
OVIRT_IPI = 20;


}

// The OCP cluster ID or ARN etc for *KS
string external_cluster_id = 219571597 [ json_name = "external_cluster_id", (buf.validate.field).string.min_len = 1 ];

ClusterStatus cluster_status = 499346904 [ json_name = "cluster_status", (buf.validate.field).enum = {not_in: [0], defined_only: true} ];

// The version of kubernetes
string kube_version = 395858490 [ json_name = "kube_version" ];

KubeVendor kube_vendor = 264191642 [ json_name = "kube_vendor", (buf.validate.field).enum = {not_in: [0], defined_only: true} ];

// The version of the productized kubernetes distribution
string vendor_version = 23961827 [ json_name = "vendor_version", (buf.validate.field).string.min_len = 1 ];

CloudPlatform cloud_platform = 476768062 [ json_name = "cloud_platform", (buf.validate.field).enum = {not_in: [0], defined_only: true} ];

repeated K8sClusterDetailNodesInner nodes = 75440785 [ (buf.validate.field).repeated = {min_items: 1, items: { required: true}} ];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";

package kessel.inventory.v1beta1.resources;

import "buf/validate/validate.proto";

import "kessel/inventory/v1beta1/resources/resource_label.proto";

option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources";
option java_multiple_files = true;
option java_package = "org.project_kessel.api.inventory.v1beta1.resources";
option java_outer_classname = "K8sClusterDetailNodesInnerProto";

message K8sClusterDetailNodesInner {

// The name of the node (this can contain private info)
string name = 3373707 [ (buf.validate.field).string.min_len = 1 ];

// CPU Capacity of the node defined in CPU units, e.g. \"0.5\"
string cpu = 98728 [ (buf.validate.field).string.min_len = 1 ];

// Memory Capacity of the node defined as MiB, e.g. \"50Mi\"
string memory = 4014849 [ (buf.validate.field).string.min_len = 1 ];

// Map of string keys and string values that can be used to organize and
// categorize (scope and select) resources
// Todo: Do we require at least 1 label?
repeated ResourceLabel labels = 36675587 [ (buf.validate.field).repeated.items.required = true ];
}
61 changes: 61 additions & 0 deletions src/main/proto/kessel/inventory/v1beta1/k8s_clusters_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
syntax = "proto3";

package kessel.inventory.v1beta1.resources;

import "google/api/annotations.proto";
import "buf/validate/validate.proto";

import "kessel/inventory/v1beta1/resources/k8s_cluster.proto";
import "kessel/inventory/v1beta1/resources/reporter_data.proto";

option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources";
option java_multiple_files = true;
option java_package = "org.project_kessel.api.inventory.v1beta1.resources";

message CreateK8sClusterRequest {
// The k8s cluster to create in Kessel Asset Inventory
K8sCluster k8s_cluster = 1 [ json_name = "k8s_cluster" ];
}

message CreateK8sClusterResponse {}

message UpdateK8sClusterRequest {
// The resource to be updated will be defined by
// \"<reporter_data.reporter_type>:<reporter_instaance_id>:<reporter_data.local_resource_id>\"
// from the request body.
K8sCluster k8s_cluster = 1 [ json_name = "k8s_cluster" ];
}

message UpdateK8sClusterResponse {}

message DeleteK8sClusterRequest {
// The resource to be deleted will be defined by
// \"<reporter_data.reporter_type>:<reporter_instaance_id>:<reporter_data.local_resource_id>\"
// from the request body.
ReporterData reporter_data = 1 [ json_name = "reporter_data", (buf.validate.field).required = true ];
}

message DeleteK8sClusterResponse {}

service KesselK8sClusterService {
rpc CreateK8sCluster(CreateK8sClusterRequest) returns (CreateK8sClusterResponse) {
option (google.api.http) = {
post : "/api/inventory/v1beta1/resources/k8s-clusters"
body : "*"
};
};

rpc UpdateK8sCluster(UpdateK8sClusterRequest) returns (UpdateK8sClusterResponse) {
option (google.api.http) = {
put : "/api/inventory/v1beta1/resources/k8s-clusters"
body : "*"
};
};

rpc DeleteK8sCluster(DeleteK8sClusterRequest) returns (DeleteK8sClusterResponse) {
option (google.api.http) = {
delete : "/api/inventory/v1beta1/resources/k8s-clusters"
body : "*"
};
};
}
61 changes: 61 additions & 0 deletions src/main/proto/kessel/inventory/v1beta1/k8s_policies_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
syntax = "proto3";

package kessel.inventory.v1beta1.resources;

import "google/api/annotations.proto";
import "buf/validate/validate.proto";

import "kessel/inventory/v1beta1/resources/k8s_policy.proto";
import "kessel/inventory/v1beta1/resources/reporter_data.proto";

option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources";
option java_multiple_files = true;
option java_package = "org.project_kessel.api.inventory.v1beta1.resources";

message CreateK8sPolicyRequest {
// The policy to create in Kessel Asset Inventory
K8sPolicy k8s_policy = 1 [ json_name = "k8s_policy", (buf.validate.field).required = true ];
}

message CreateK8sPolicyResponse {}

message UpdateK8sPolicyRequest {
// The resource to be updated will be defined by
// \"<reporter_data.reporter_type>:<reporter_instaance_id>:<reporter_data.local_resource_id>\"
// from the request body.
K8sPolicy k8s_policy = 1 [ json_name = "k8s_policy", (buf.validate.field).required = true ];
}

message UpdateK8sPolicyResponse {}

message DeleteK8sPolicyRequest {
// The resource to be deleted will be defined by
// \"<reporter_data.reporter_type>:<reporter_instaance_id>:<reporter_data.local_resource_id>\"
// from the request body.
ReporterData reporter_data = 1 [ json_name = "reporter_data", (buf.validate.field).required = true ];
}

message DeleteK8sPolicyResponse {}

service KesselK8sPolicyService {
rpc CreateK8sPolicy(CreateK8sPolicyRequest) returns (CreateK8sPolicyResponse) {
option (google.api.http) = {
post : "/api/inventory/v1beta1/resources/k8s-policies"
body : "*"
};
};

rpc UpdateK8sPolicy(UpdateK8sPolicyRequest) returns (UpdateK8sPolicyResponse) {
option (google.api.http) = {
put : "/api/inventory/v1beta1/resources/k8s-policies"
body : "*"
};
};

rpc DeleteK8sPolicy(DeleteK8sPolicyRequest) returns (DeleteK8sPolicyResponse) {
option (google.api.http) = {
delete : "/api/inventory/v1beta1/resources/k8s-policies"
body : "*"
};
};
}
24 changes: 24 additions & 0 deletions src/main/proto/kessel/inventory/v1beta1/k8s_policy.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";

package kessel.inventory.v1beta1.resources;

import "buf/validate/validate.proto";

import "kessel/inventory/v1beta1/resources/metadata.proto";
import "kessel/inventory/v1beta1/resources/k8s_policy_detail.proto";
import "kessel/inventory/v1beta1/resources/reporter_data.proto";

option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources";
option java_multiple_files = true;
option java_package = "org.project_kessel.api.inventory.v1beta1.resources";
option java_outer_classname = "K8sPolicyProto";

message K8sPolicy {
// Metadata about this resource
Metadata metadata = 1;

// Write only reporter specific data
ReporterData reporter_data = 245278792 [ json_name = "reporter_data", (buf.validate.field).required = true ];

K8sPolicyDetail resource_data = 2122698 [ json_name = "resource_data", (buf.validate.field).required = true ];
}
28 changes: 28 additions & 0 deletions src/main/proto/kessel/inventory/v1beta1/k8s_policy_detail.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
syntax = "proto3";

package kessel.inventory.v1beta1.resources;

import "buf/validate/validate.proto";

option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/resources";
option java_multiple_files = true;
option java_package = "org.project_kessel.api.inventory.v1beta1.resources";
option java_outer_classname = "K8sPolicyDetailProto";

message K8sPolicyDetail {

// The kind of policy
enum Severity {
SEVERITY_UNSPECIFIED = 0;
SEVERITY_OTHER = 1;
LOW = 2;
MEDIUM = 3;
HIGH = 4;
CRITICAL = 5;
}

// Defines if the policy is currently enabled or disabled across all targets
bool disabled = 270940797;

Severity severity = 404558592 [ (buf.validate.field).enum.defined_only = true ];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";

package kessel.inventory.v1beta1.relationships;

import "kessel/inventory/v1beta1/relationships/metadata.proto";
import "kessel/inventory/v1beta1/relationships/reporter_data.proto";
import "kessel/inventory/v1beta1/relationships/k8spolicy_ispropagatedto_k8scluster_detail.proto";
import "buf/validate/validate.proto";

option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/relationships";
option java_multiple_files = true;
option java_package = "org.project_kessel.api.inventory.v1beta1.relationships";
option java_outer_classname = "K8SPolicyIsPropagatedToK8SClusterProto";

message K8SPolicyIsPropagatedToK8SCluster {

// Metadata about this resource
Metadata metadata = 1 [ (buf.validate.field) = {required: false, ignore: IGNORE_ALWAYS} ];

// Write only reporter specific data
ReporterData reporter_data = 245278793 [ json_name = "reporter_data", (buf.validate.field).required = true ];

K8SPolicyIsPropagatedToK8SClusterDetail relationship_data = 2122699 [ json_name = "relationship_data", (buf.validate.field).required = true ];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
syntax = "proto3";

package kessel.inventory.v1beta1.relationships;

import "google/api/field_behavior.proto";
import "buf/validate/validate.proto";

option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1/relationships";
option java_multiple_files = true;
option java_package = "org.project_kessel.api.inventory.v1beta1.relationships";
option java_outer_classname = "K8SPolicyIsPropagatedToK8SClusterDetailProto";

message K8SPolicyIsPropagatedToK8SClusterDetail {

// the aggregate status of the cluster
enum Status {
STATUS_UNSPECIFIED = 0;
STATUS_OTHER = 1;
VIOLATIONS = 2;
NO_VIOLATIONS = 3;
}

// The resource ID assigned to the resource by Kessel Asset Inventory.
int64 k8s_policy_id = 225679544 [ json_name = "k8s_policy_id", (google.api.field_behavior) = OUTPUT_ONLY ];

// The resource ID assigned to the resource by Kessel Asset Inventory.
int64 k8s_cluster_id = 240280960 [ json_name = "k8s_cluster_id", (google.api.field_behavior) = OUTPUT_ONLY ];

Status status = 355610639 [ json_name = "status",(buf.validate.field).enum = {not_in: [0], defined_only: true} ];
}
Loading

0 comments on commit ea34033

Please sign in to comment.