Skip to content

Commit

Permalink
fix: make cpu/gpu non-repeatable
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Oct 24, 2023
1 parent 823d3b0 commit e13ad89
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 17 deletions.
2 changes: 1 addition & 1 deletion go/inventory/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type CPUs []CPU
type GPUs []GPU

type Nodes []Node
type ClusterStorage map[string]ResourcePair
type ClusterStorage []Storage

var _ sort.Interface = (*CPUs)(nil)
var _ sort.Interface = (*GPUs)(nil)
Expand Down
11 changes: 11 additions & 0 deletions proto/node/akash/market/v1beta3/bid.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package akash.market.v1beta3;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

import "akash/market/v1beta3/order.proto";
import "akash/base/v1beta3/resources.proto";

Expand Down Expand Up @@ -45,13 +46,23 @@ message MsgCreateBid {
(gogoproto.jsontag) = "deposit",
(gogoproto.moretags) = "yaml:\"deposit\""
];
<<<<<<< Updated upstream
repeated ResourceOffer resources_offer = 5 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "ResourcesOffer",
(gogoproto.customname) = "ResourcesOffer",
(gogoproto.jsontag) = "resources_offer",
(gogoproto.moretags) = "yaml:\"resources_offer\""
];
||||||| Stash base
=======
repeated akash.base.v1beta3.Resources resources = 5 [
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "resources",
(gogoproto.castrepeated) = "Volumes",
(gogoproto.moretags) = "yaml:\"resources\""
];
>>>>>>> Stashed changes
}

// MsgCreateBidResponse defines the Msg/CreateBid response type.
Expand Down
7 changes: 6 additions & 1 deletion proto/provider/akash/inventory/v1/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import "akash/inventory/v1/resourcepair.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 All @@ -19,7 +24,7 @@ message Cluster {
(gogoproto.moretags) = "yaml:\"nodes\""
];

map<string, ResourcePair> Storage = 2 [
repeated Storage storage = 2 [
(gogoproto.nullable) = false,
(gogoproto.casttype) = "ClusterStorage",
(gogoproto.customname) = "Storage",
Expand Down
28 changes: 21 additions & 7 deletions proto/provider/akash/inventory/v1/cpu.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ import "akash/inventory/v1/resourcepair.proto";

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

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

message CPUInfo {
string id = 2 [
(gogoproto.customname) = "ID",
(gogoproto.jsontag) = "id",
Expand All @@ -30,3 +24,23 @@ message CPU {
(gogoproto.moretags) = "yaml:\"model\""
];
}

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


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

repeated CPUInfo info = 2 [
(gogoproto.customname) = "Info",
(gogoproto.jsontag) = "info",
(gogoproto.moretags) = "yaml:\"info\""
];
}
19 changes: 13 additions & 6 deletions proto/provider/akash/inventory/v1/gpu.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ import "akash/inventory/v1/resourcepair.proto";

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

message GPU {
ResourcePair quantity = 1 [
(gogoproto.customname) = "Quantity",
(gogoproto.jsontag) = "quantity",
(gogoproto.moretags) = "yaml:\"quantity\""
];
message GPUInfo {
string id = 2 [
(gogoproto.customname) = "ID",
(gogoproto.jsontag) = "id",
Expand All @@ -29,4 +24,16 @@ message GPU {
(gogoproto.jsontag) = "model",
(gogoproto.moretags) = "yaml:\"model\""
];


}

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

repeated GPUInfo info = 2;
}
23 changes: 21 additions & 2 deletions proto/provider/akash/inventory/v1/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,38 @@ import "akash/inventory/v1/gpu.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 [

]
}

message Node {
repeated CPU cpu = 1 [
CPU cpu = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "CPUs",
(gogoproto.customname) = "CPU",
(gogoproto.jsontag) = "cpu",
(gogoproto.moretags) = "yaml:\"cpu\""
];
repeated GPU gpu = 2 [

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

EphemeralStorage;
}

0 comments on commit e13ad89

Please sign in to comment.