-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cluster/kube/builder):
"ram"
storage class (#217)
* feat(cluster/kube/builder): `"ram"` storage class * Implement `"ram"` storage class with "empty dir" memory-backed volumes. * No changes to resource accounting - service memory size must include size allocated to ram storage. refs akash-network/support#179 Signed-off-by: Adam Bozanich <[email protected]> * feat(shm): add e2e tests Signed-off-by: Artur Troian <[email protected]> --------- Signed-off-by: Adam Bozanich <[email protected]> Signed-off-by: Artur Troian <[email protected]> Co-authored-by: Adam Bozanich <[email protected]>
- Loading branch information
Showing
12 changed files
with
221 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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,128 @@ | ||
//go:build e2e | ||
|
||
package integration | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"path/filepath" | ||
"time" | ||
|
||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
sdktest "github.com/cosmos/cosmos-sdk/testutil" | ||
"github.com/gyuho/linux-inspect/df" | ||
|
||
dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" | ||
mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4" | ||
clitestutil "github.com/akash-network/node/testutil/cli" | ||
deploycli "github.com/akash-network/node/x/deployment/client/cli" | ||
mcli "github.com/akash-network/node/x/market/client/cli" | ||
|
||
ptestutil "github.com/akash-network/provider/testutil/provider" | ||
) | ||
|
||
type E2EStorageClassRam struct { | ||
IntegrationTestSuite | ||
} | ||
|
||
func (s *E2EStorageClassRam) TestRAM() { | ||
deploymentPath, err := filepath.Abs("../testdata/deployment/deployment-v2-storage-ram.yaml") | ||
s.Require().NoError(err) | ||
|
||
deploymentID := dtypes.DeploymentID{ | ||
Owner: s.keyTenant.GetAddress().String(), | ||
DSeq: uint64(100), | ||
} | ||
|
||
// Create Deployments | ||
res, err := deploycli.TxCreateDeploymentExec( | ||
s.validator.ClientCtx, | ||
s.keyTenant.GetAddress(), | ||
deploymentPath, | ||
cliGlobalFlags(fmt.Sprintf("--dseq=%v", deploymentID.DSeq))..., | ||
) | ||
s.Require().NoError(err) | ||
s.Require().NoError(s.waitForBlocksCommitted(7)) | ||
clitestutil.ValidateTxSuccessful(s.T(), s.validator.ClientCtx, res.Bytes()) | ||
|
||
bidID := mtypes.MakeBidID( | ||
mtypes.MakeOrderID(dtypes.MakeGroupID(deploymentID, 1), 1), | ||
s.keyProvider.GetAddress(), | ||
) | ||
|
||
_, err = mcli.QueryBidExec(s.validator.ClientCtx, bidID) | ||
s.Require().NoError(err) | ||
|
||
_, err = mcli.TxCreateLeaseExec( | ||
s.validator.ClientCtx, | ||
bidID, | ||
s.keyTenant.GetAddress(), | ||
cliGlobalFlags()..., | ||
) | ||
s.Require().NoError(err) | ||
s.Require().NoError(s.waitForBlocksCommitted(2)) | ||
clitestutil.ValidateTxSuccessful(s.T(), s.validator.ClientCtx, res.Bytes()) | ||
|
||
lid := bidID.LeaseID() | ||
|
||
// Send Manifest to Provider ---------------------------------------------- | ||
_, err = ptestutil.TestSendManifest( | ||
s.validator.ClientCtx.WithOutputFormat("json"), | ||
lid.BidID(), | ||
deploymentPath, | ||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.keyTenant.GetAddress().String()), | ||
fmt.Sprintf("--%s=%s", flags.FlagHome, s.validator.ClientCtx.HomeDir), | ||
) | ||
s.Require().NoError(err) | ||
s.Require().NoError(s.waitForBlocksCommitted(2)) | ||
|
||
extraArgs := []string{ | ||
fmt.Sprintf("--%s=%s", flags.FlagFrom, s.keyTenant.GetAddress().String()), | ||
fmt.Sprintf("--%s=%s", flags.FlagHome, s.validator.ClientCtx.HomeDir), | ||
} | ||
|
||
logged := make(map[string]struct{}) | ||
|
||
cmd := `df --all --sync --block-size=1024 --output=source,target,fstype,file,itotal,iavail,iused,ipcent,size,avail,used,pcent` | ||
var out sdktest.BufferWriter | ||
leaseShellCtx, cancel := context.WithTimeout(s.ctx, 2*time.Minute) | ||
defer cancel() | ||
|
||
// Loop until we get a shell or the context times out | ||
for { | ||
select { | ||
case <-leaseShellCtx.Done(): | ||
// s.T().Fatalf("context is done while trying to run lease-shell: %v", leaseShellCtx.Err()) | ||
return | ||
default: | ||
} | ||
out, err = ptestutil.TestLeaseShell(leaseShellCtx, s.validator.ClientCtx.WithOutputFormat("json"), extraArgs, lid, 0, false, false, "web", cmd) | ||
if err != nil { | ||
_, hasBeenLogged := logged[err.Error()] | ||
if !hasBeenLogged { | ||
// Don't spam an error message in a test, that is very annoying | ||
s.T().Logf("encountered %v, waiting before next attempt", err) | ||
logged[err.Error()] = struct{}{} | ||
} | ||
time.Sleep(2000 * time.Millisecond) | ||
continue // Try again until the context times out | ||
} | ||
s.Require().NotNil(s.T(), out) | ||
break | ||
} | ||
|
||
dfRes, err := df.Parse(out.String()) | ||
s.Require().NoError(err) | ||
|
||
var found *df.Row | ||
|
||
for i := range dfRes { | ||
if dfRes[i].MountedOn == "/dev/shm" { | ||
found = &dfRes[i] | ||
break | ||
} | ||
} | ||
|
||
s.Require().NotNil(found) | ||
s.Require().Equal(int64(65536), found.TotalBlocks) | ||
} |
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
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
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,41 @@ | ||
--- | ||
version: "2.0" | ||
services: | ||
web: | ||
image: ghcr.io/ovrclk/e2e-test | ||
expose: | ||
- port: 8080 | ||
as: 80 | ||
to: | ||
- global: true | ||
accept: | ||
- webdistest.localhost | ||
# params: | ||
# storage: | ||
# shm: | ||
# mount: /dev/shm | ||
profiles: | ||
compute: | ||
web: | ||
resources: | ||
cpu: | ||
units: "0.01" | ||
memory: | ||
size: "128Mi" | ||
storage: | ||
- size: "512Mi" | ||
# - name: shm | ||
# size: "256Mi" | ||
# attributes: | ||
# class: ram | ||
placement: | ||
global: | ||
pricing: | ||
web: | ||
denom: uakt | ||
amount: 10 | ||
deployment: | ||
web: | ||
global: | ||
profile: web | ||
count: 1 |