Skip to content

Commit

Permalink
protobuf defintion updates for inventory api
Browse files Browse the repository at this point in the history
  • Loading branch information
chainzero authored and chainzero committed Oct 26, 2023
1 parent e2b743b commit 123293c
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 49 deletions.
1 change: 1 addition & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eval "$(direnv hook bash)"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ifeq (, $(shell which direnv))
$(error "No direnv in $(PATH), consider installing. https://direnv.net")
endif

ifneq (1, $(AKASH_DIRENV_SET))
ifneq ("1", "$(AKASH_DIRENV_SET)")
$(error "no envrc detected. might need to run \"direnv allow\"")
endif

Expand Down
6 changes: 1 addition & 5 deletions proto/provider/akash/inventory/v1/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ package akash.inventory.v1;
import "gogoproto/gogo.proto";
import "akash/inventory/v1/node.proto";
import "akash/inventory/v1/resourcepair.proto";
import "akash/inventory/v1/storage.proto";

option go_package = "github.com/akash-network/akash-api/go/inventory/v1";

message Storage {
string class = 1;
ResourcePair quantity = 2;
}

message Cluster {
option (gogoproto.equal) = false;

Expand Down
17 changes: 8 additions & 9 deletions proto/provider/akash/inventory/v1/cpu.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,28 @@ import "akash/inventory/v1/resourcepair.proto";
option go_package = "github.com/akash-network/akash-api/go/inventory/v1";

message CPUInfo {
string id = 2 [
string id = 1 [
(gogoproto.customname) = "ID",
(gogoproto.jsontag) = "id",
(gogoproto.moretags) = "yaml:\"id\""
];
string vendor = 3 [
string vendor = 2 [
(gogoproto.customname) = "Vendor",
(gogoproto.jsontag) = "vendor",
(gogoproto.moretags) = "yaml:\"vendor\""
];
string model = 4 [
string model = 3 [
(gogoproto.customname) = "Model",
(gogoproto.jsontag) = "model",
(gogoproto.moretags) = "yaml:\"model\""
];
uint32 vcores = 4 [
(gogoproto.customname) = "Vcores",
(gogoproto.jsontag) = "vcores",
(gogoproto.moretags) = "yaml:\"vcores\""
];
}

// cpu 1 / 10vcores
// cpu 2 / 10vcores
// --> k8s->CoreV1->Node() -> 20 vcores
// 12 allocated


message CPU {
ResourcePair quantity = 1 [
(gogoproto.customname) = "Quantity",
Expand Down
39 changes: 25 additions & 14 deletions proto/provider/akash/inventory/v1/gpu.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,31 @@ import "akash/inventory/v1/resourcepair.proto";
option go_package = "github.com/akash-network/akash-api/go/inventory/v1";

message GPUInfo {
string id = 2 [
(gogoproto.customname) = "ID",
(gogoproto.jsontag) = "id",
(gogoproto.moretags) = "yaml:\"id\""
];
string vendor = 3 [
string vendor = 1 [
(gogoproto.customname) = "Vendor",
(gogoproto.jsontag) = "vendor",
(gogoproto.moretags) = "yaml:\"vendor\""
];
string model = 4 [
(gogoproto.customname) = "Model",
(gogoproto.jsontag) = "model",
(gogoproto.moretags) = "yaml:\"model\""
string name = 2 [
(gogoproto.customname) = "Name",
(gogoproto.jsontag) = "name",
(gogoproto.moretags) = "yaml:\"name\""
];
string modelid = 3 [
(gogoproto.customname) = "ModelID",
(gogoproto.jsontag) = "modelid",
(gogoproto.moretags) = "yaml:\"modelid\""
];
string interface = 4 [
(gogoproto.customname) = "Interface",
(gogoproto.jsontag) = "interface",
(gogoproto.moretags) = "yaml:\"interface\""
];
string memory = 5 [
(gogoproto.customname) = "Memory",
(gogoproto.jsontag) = "memory",
(gogoproto.moretags) = "yaml:\"memory\""
];


}

message GPU {
Expand All @@ -34,6 +42,9 @@ message GPU {
(gogoproto.jsontag) = "quantity",
(gogoproto.moretags) = "yaml:\"quantity\""
];

repeated GPUInfo info = 2;
repeated GPUInfo info = 2 [
(gogoproto.customname) = "Info",
(gogoproto.jsontag) = "info",
(gogoproto.moretags) = "yaml:\"info\""
];
}
41 changes: 21 additions & 20 deletions proto/provider/akash/inventory/v1/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,11 @@ package akash.inventory.v1;
import "gogoproto/gogo.proto";
import "akash/inventory/v1/cpu.proto";
import "akash/inventory/v1/gpu.proto";
import "akash/inventory/v1/storage.proto";
import "akash/inventory/v1/memory.proto";

option go_package = "github.com/akash-network/akash-api/go/inventory/v1";

message MemoryInfo {

}
message Memory {
ResourcePair quantity = 1 [
(gogoproto.customname) = "Quantity",
(gogoproto.jsontag) = "quantity",
(gogoproto.moretags) = "yaml:\"quantity\""
];

repeated MemoryInfo info = 2 [

]
}
option go_package = "github.com/akash-network/akash-api/go/inventory/v1";

message Node {
CPU cpu = 1 [
Expand All @@ -31,14 +19,27 @@ message Node {
(gogoproto.moretags) = "yaml:\"cpu\""
];

Memory memory = 2;
Memory memory = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "Memory",
(gogoproto.customname) = "Memory",
(gogoproto.jsontag) = "memory",
(gogoproto.moretags) = "yaml:\"memory\""
];

GPU gpu = 3 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "GPUs",
(gogoproto.customname) = "GPU",
(gogoproto.jsontag) = "gpu",
(gogoproto.moretags) = "yaml:\"gpu\""
(gogoproto.customname) = "Gpus",
(gogoproto.jsontag) = "gpus",
(gogoproto.moretags) = "yaml:\"gpus\""
];

EphemeralStorage;
Storage storage = 4 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "Storage",
(gogoproto.customname) = "Storage",
(gogoproto.jsontag) = "storage",
(gogoproto.moretags) = "yaml:\"storage\""
];
}
45 changes: 45 additions & 0 deletions proto/provider/akash/inventory/v1/storage.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
syntax = "proto3";

package akash.inventory.v1;

import "gogoproto/gogo.proto";

import "akash/inventory/v1/resourcepair.proto";

option go_package = "github.com/akash-network/akash-api/go/inventory/v1";

message StorageInfo {
string vendor = 1 [
(gogoproto.customname) = "Vendor",
(gogoproto.jsontag) = "vendor",
(gogoproto.moretags) = "yaml:\"vendor\""
];
string class = 2 [
(gogoproto.customname) = "Class",
(gogoproto.jsontag) = "class",
(gogoproto.moretags) = "yaml:\"class\""
];
string capacity = 3 [
(gogoproto.customname) = "Capacity",
(gogoproto.jsontag) = "capacity",
(gogoproto.moretags) = "yaml:\"capacity\""
];
string IO = 4 [
(gogoproto.customname) = "IO",
(gogoproto.jsontag) = "io",
(gogoproto.moretags) = "yaml:\"io\""
];
}

message Storage {
ResourcePair quantity = 1 [
(gogoproto.customname) = "Quantity",
(gogoproto.jsontag) = "quantity",
(gogoproto.moretags) = "yaml:\"quantity\""
];
StorageInfo info = 2 [
(gogoproto.customname) = "Info",
(gogoproto.jsontag) = "info",
(gogoproto.moretags) = "yaml:\"info\""
];
}

0 comments on commit 123293c

Please sign in to comment.