Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func preserveExtraRuntimeFields(resourceJSON []byte) []option.RequestOption {
return nil
}

extraKeys := []string{"dockerConfig", "skipBuild", "ports"}
extraKeys := []string{"dockerConfig", "skipBuild", "ports", "storageMb"}
var opts []option.RequestOption
for _, key := range extraKeys {
if val, ok := raw.Spec.Runtime[key]; ok {
Expand Down
14 changes: 14 additions & 0 deletions cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,20 @@ func TestSetBodyFieldsFromJSON(t *testing.T) {
assert.Equal(t, 42, parent.Inner.Value)
}

func TestPreserveExtraRuntimeFieldsIncludesSandboxStorage(t *testing.T) {
resourceJSON := []byte(`{
"spec": {
"runtime": {
"storageMb": 102400
}
}
}`)

opts := preserveExtraRuntimeFields(resourceJSON)

assert.Len(t, opts, 1)
}

func TestApplyResourcesEmpty(t *testing.T) {
results := []core.Result{}

Expand Down
2 changes: 2 additions & 0 deletions cli/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ MY_VAR = "my-value"
# Runtime configuration (optional)
[runtime]
memory = 4096
# Sandbox root storage in MB (optional)
# storageMb = 102400
# Job configuration (optional)
# maxConcurrentTasks = 10
# timeout = "15m" # Supports: 30s, 5m, 1h, 2d, 1w or plain seconds (900)
Expand Down
1 change: 1 addition & 0 deletions cli/core/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ func TestGetBlaxelTomlSample(t *testing.T) {
assert.Contains(t, sample, "[env]")
assert.Contains(t, sample, "[runtime]")
assert.Contains(t, sample, "memory = 4096")
assert.Contains(t, sample, "storageMb = 102400")
}

func TestBuildBlaxelTomlWarning(t *testing.T) {
Expand Down
15 changes: 15 additions & 0 deletions samples/sandbox-with-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: blaxel.ai/v1alpha1
kind: Sandbox
metadata:
name: sandbox-with-storage
displayName: Sandbox with Storage
spec:
enabled: true
runtime:
image: blaxel/base-image:latest
ports:
- name: sandbox-api
target: 8080
protocol: HTTP
memory: 4096
storageMb: 102400
Loading