-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: akoserwal <[email protected]>
- Loading branch information
1 parent
79c19e8
commit 43bf92c
Showing
17 changed files
with
399 additions
and
199 deletions.
There are no files selected for viewing
26 changes: 10 additions & 16 deletions
26
src/main/proto/kessel/inventory/v1beta1/k8s_cluster.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
syntax = "proto3"; | ||
|
||
package kessel.inventory.v1beta1; | ||
package kessel.inventory.v1beta1.resources; | ||
|
||
import "google/api/field_behavior.proto"; | ||
import "buf/validate/validate.proto"; | ||
|
||
import "kessel/inventory/v1beta1/k8s_cluster_detail.proto"; | ||
import "kessel/inventory/v1beta1/metadata.proto"; | ||
import "kessel/inventory/v1beta1/reporter_data.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"; | ||
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"; | ||
option java_package = "org.project_kessel.api.inventory.v1beta1.resources"; | ||
option java_outer_classname = "K8sClusterProto"; | ||
|
||
message K8sCluster { | ||
// Metadata about this resource | ||
Metadata metadata = 1 [ (google.api.field_behavior) = REQUIRED ]; | ||
Metadata metadata = 1; | ||
|
||
// Write only reporter specific data | ||
ReporterData reporter_data = 245278792 | ||
[ (google.api.field_behavior) = INPUT_ONLY ]; | ||
ReporterData reporter_data = 245278792 [ json_name = "reporter_data", (buf.validate.field).required = true ]; | ||
|
||
// The entities that registered this item in the Kessel Asset Inventory. The | ||
// same resource may be registered by multiple reporters. | ||
repeated ReporterData reporters = 353323086 | ||
[ (google.api.field_behavior) = OUTPUT_ONLY ]; | ||
|
||
K8sClusterDetail data = 2122698; | ||
K8sClusterDetail resource_data = 2122698 [ json_name = "resource_data", (buf.validate.field).required = true ]; | ||
} |
81 changes: 43 additions & 38 deletions
81
src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,78 @@ | ||
syntax = "proto3"; | ||
|
||
package kessel.inventory.v1beta1; | ||
package kessel.inventory.v1beta1.resources; | ||
|
||
import "kessel/inventory/v1beta1/k8s_cluster_detail_nodes_inner.proto"; | ||
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"; | ||
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"; | ||
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_READY = 1; | ||
CLUSTER_STATUS_FAILED = 2; | ||
CLUSTER_STATUS_OFFLINE = 3; | ||
CLUSTER_STATUS_OTHER = 1; | ||
READY = 2; | ||
FAILED = 3; | ||
OFFLINE = 4; | ||
} | ||
|
||
// The kubernetes vendor | ||
enum KubeVendor { | ||
KUBE_VENDOR_UNSPECIFIED = 0; | ||
KUBE_VENDOR_OTHER = 1; | ||
KUBE_VENDOR_AKS = 2; | ||
KUBE_VENDOR_EKS = 3; | ||
KUBE_VENDOR_IKS = 4; | ||
KUBE_VENDOR_OPENSHIFT = 5; | ||
KUBE_VENDOR_GKE = 6; | ||
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_NONE_UPI = 1; | ||
CLOUD_PLATFORM_BAREMETAL_IPI = 2; | ||
CLOUD_PLATFORM_BAREMETAL_UPI = 3; | ||
CLOUD_PLATFORM_AWS_IPI = 4; | ||
CLOUD_PLATFORM_AWS_UPI = 5; | ||
CLOUD_PLATFORM_AZURE_IPI = 6; | ||
CLOUD_PLATFORM_AZURE_UPI = 7; | ||
CLOUD_PLATFORM_IBMCLOUD_IPI = 8; | ||
CLOUD_PLATFORM_IBMCLOUD_UPI = 9; | ||
CLOUD_PLATFORM_KUBEVIRT_IPI = 10; | ||
CLOUD_PLATFORM_OPENSTACK_IPI = 11; | ||
CLOUD_PLATFORM_OPENSTACK_UPI = 12; | ||
CLOUD_PLATFORM_GCP_IPI = 13; | ||
CLOUD_PLATFORM_GCP_UPI = 14; | ||
CLOUD_PLATFORM_NUTANIX_IPI = 15; | ||
CLOUD_PLATFORM_NUTANIX_UPI = 16; | ||
CLOUD_PLATFORM_VSPHERE_IPI = 17; | ||
CLOUD_PLATFORM_VSPHERE_UPI = 18; | ||
CLOUD_PLATFORM_OVIRT_IPI = 19; | ||
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; | ||
string external_cluster_id = 219571597 [ json_name = "external_cluster_id", (buf.validate.field).string.min_len = 1 ]; | ||
|
||
ClusterStatus cluster_status = 499346904; | ||
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; | ||
string kube_version = 395858490 [ json_name = "kube_version" ]; | ||
|
||
KubeVendor kube_vendor = 264191642; | ||
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; | ||
string vendor_version = 23961827 [ json_name = "vendor_version", (buf.validate.field).string.min_len = 1 ]; | ||
|
||
CloudPlatform cloud_platform = 476768062; | ||
CloudPlatform cloud_platform = 476768062 [ json_name = "cloud_platform", (buf.validate.field).enum = {not_in: [0], defined_only: true} ]; | ||
|
||
repeated K8sClusterDetailNodesInner nodes = 75440785; | ||
repeated K8sClusterDetailNodesInner nodes = 75440785 [ (buf.validate.field).repeated = {min_items: 1, items: { required: true}} ]; | ||
} |
19 changes: 11 additions & 8 deletions
19
src/main/proto/kessel/inventory/v1beta1/k8s_cluster_detail_nodes_inner.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
syntax = "proto3"; | ||
|
||
package kessel.inventory.v1beta1; | ||
package kessel.inventory.v1beta1.resources; | ||
|
||
import "kessel/inventory/v1beta1/resource_label.proto"; | ||
import "buf/validate/validate.proto"; | ||
|
||
option go_package = "github.com/project-kessel/inventory-api/api/kessel/inventory/v1beta1"; | ||
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"; | ||
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; | ||
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; | ||
string cpu = 98728 [ (buf.validate.field).string.min_len = 1 ]; | ||
|
||
// Memory Capacity of the node defined as MiB, e.g. \"50Mi\" | ||
string memory = 4014849; | ||
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 | ||
repeated ResourceLabel labels = 36675587; | ||
// Todo: Do we require at least 1 label? | ||
repeated ResourceLabel labels = 36675587 [ (buf.validate.field).repeated.items.required = true ]; | ||
} |
40 changes: 20 additions & 20 deletions
40
src/main/proto/kessel/inventory/v1beta1/k8s_clusters_service.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,61 @@ | ||
syntax = "proto3"; | ||
|
||
package kessel.inventory.v1beta1; | ||
package kessel.inventory.v1beta1.resources; | ||
|
||
import "google/api/annotations.proto"; | ||
import "buf/validate/validate.proto"; | ||
|
||
import "kessel/inventory/v1beta1/k8s_cluster.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"; | ||
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"; | ||
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; | ||
K8sCluster k8s_cluster = 1 [ json_name = "k8s_cluster" ]; | ||
} | ||
|
||
message CreateK8sClusterResponse { | ||
// The K8s cluster created in Kessel Asset Inventory | ||
K8sCluster k8s_cluster = 1; | ||
} | ||
message CreateK8sClusterResponse {} | ||
|
||
message UpdateK8sClusterRequest { | ||
// The {resource} format | ||
// \"<reporter_data.reporter_type>:<reporter_data.resourceId_alias>\". | ||
string resource = 1; | ||
// The k8s clsuter to update | ||
K8sCluster k8s_cluster = 2; | ||
// 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} format | ||
// \"<reporter_data.reporter_type>:<reporter_data.resourceId_alias>\". | ||
string resource = 1; | ||
// 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/k8sClusters" | ||
post : "/api/inventory/v1beta1/resources/k8s-clusters" | ||
body : "*" | ||
}; | ||
}; | ||
|
||
rpc UpdateK8sCluster(UpdateK8sClusterRequest) returns (UpdateK8sClusterResponse) { | ||
option (google.api.http) = { | ||
put : "/api/inventory/v1beta1/k8sClusters/{resource}" | ||
put : "/api/inventory/v1beta1/resources/k8s-clusters" | ||
body : "*" | ||
}; | ||
}; | ||
|
||
rpc DeleteK8sCluster(DeleteK8sClusterRequest) returns (DeleteK8sClusterResponse) { | ||
option (google.api.http) = { | ||
delete : "/api/inventory/v1beta1/k8sClusters/{resource}" | ||
delete : "/api/inventory/v1beta1/resources/k8s-clusters" | ||
body : "*" | ||
}; | ||
}; | ||
} |
61 changes: 61 additions & 0 deletions
61
src/main/proto/kessel/inventory/v1beta1/k8s_policies_service.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 : "*" | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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"; | ||
|
||
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 ]; | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/proto/kessel/inventory/v1beta1/k8s_policy_detail.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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"; | ||
|
||
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 ]; | ||
} |
Oops, something went wrong.