Skip to content
Draft
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
5 changes: 5 additions & 0 deletions .github/workflows/pr-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ jobs:
# features", not an unset value. The e2e steps pass it to the suites as
# --preview, so tests of a disabled gate skip themselves (see
# internal/e2e/preview.go).
GOFLAGS: -tags=e2e_runtime_identity
E2E_RUNTIME_GOLDEN_REQUIRED: ${{ matrix.preview == 'on' && 'true' || 'false' }}
ATE_PREVIEW: ${{ matrix.preview == 'on' && 'ALL' || '' }}
# Appended to the lane and artifact names: e2e-gvisor runs without
# preview features, e2e-gvisor-preview with them.
Expand Down Expand Up @@ -272,6 +274,8 @@ jobs:
run: hack/e2e-focus-sandbox-class.sh gvisor
- name: Run E2E tests (gVisor)
env:
E2E_SANDBOX_CLASS: gvisor
E2E_RUNTIME_LOG_DIR: ${{ github.workspace }}/_artifacts/runtime-golden-gvisor
E2E_PARALLELISM: 8
E2E_JUNIT_FILE: ${{ github.workspace }}/_artifacts/e2e-gvisor${{ env.LANE_SUFFIX }}.xml
run: hack/run-e2e-kind.sh -v -args --no-color --preview="${ATE_PREVIEW}"
Expand All @@ -282,6 +286,7 @@ jobs:
# variant by the single E2E_SANDBOX_CLASS knob (see internal/e2e/sandbox.go).
env:
E2E_SANDBOX_CLASS: microvm
E2E_RUNTIME_LOG_DIR: ${{ github.workspace }}/_artifacts/runtime-golden
E2E_PARALLELISM: 8
E2E_JUNIT_FILE: ${{ github.workspace }}/_artifacts/e2e-microvm${{ env.LANE_SUFFIX }}.xml
run: hack/run-e2e-kind.sh -v -args --no-color --preview="${ATE_PREVIEW}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ workerSelector:
workload: benchmark-worker
volumes:
- name: external-storage
externalVolumeTemplate:
capacity: 1Gi
storageClassName: ${STORAGE_CLASS_NAME}
external:
template:
capacity: 1Gi
storageClassName: ${STORAGE_CLASS_NAME}
containers:
- name: glutton-storage
image: ko://github.com/agent-substrate/substrate/cmd/benchmarking/glutton
Expand Down
7 changes: 4 additions & 3 deletions cmd/ate-setup/internal/demos/counter/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ func (d *demo) externalVolumeValues(e *steps.Env) map[string]string {
"EXTERNAL_VOLUME_MOUNTS": " - name: external-data\n" +
" mountPath: /external-data",
"EXTERNAL_VOLUMES": "- name: external-data\n" +
" externalVolumeTemplate:\n" +
" capacity: 1Gi\n" +
" storageClassName: " + sc,
" external:\n" +
" template:\n" +
" capacity: 1Gi\n" +
" storageClassName: " + sc,
}
}

Expand Down
3 changes: 2 additions & 1 deletion cmd/ate-setup/internal/demos/counter/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func TestExternalVolumeRenders(t *testing.T) {
for _, want := range []string{
"--validate-existing-file-path=/external-data/test.txt",
"mountPath: /external-data",
"externalVolumeTemplate:",
"external:",
"template:",
tc.wantSC,
} {
if !strings.Contains(string(manifest), want) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/ateapi/internal/apivalidation/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ func ValidateCustom_WorkerAssignment_WorkerPodIps(_ context.Context, _ operation
return validateDualStackIPs(fldPath, value)
}

func ValidateCustom_ExternalVolume_VolumeType(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList {
func ValidateCustom_ExternalVolumeRef_VolumeType(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList {
return resources.ValidateVolumeType(fldPath, *value)
}

func ValidateCustom_ExternalVolume_StorageVolumeId(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList {
func ValidateCustom_ExternalVolumeRef_StorageVolumeId(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *string) field.ErrorList {
return resources.ValidateStorageVolumeID(fldPath, *value)
}

func ValidateCustom_ExternalVolume_VolumeContext(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ map[string]string) field.ErrorList {
func ValidateCustom_ExternalVolumeRef_VolumeContext(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ map[string]string) field.ErrorList {
return resources.ValidateCSIMap(fldPath, value)
}
56 changes: 34 additions & 22 deletions cmd/ateapi/internal/apivalidation/actor_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ func TestValidateCreateActorTemplateRequest(t *testing.T) {
"valid",
&ateapipb.CreateActorTemplateRequest{ActorTemplate: validActorTemplate()},
nil,
}, {
"runtime golden gvisor",
&ateapipb.CreateActorTemplateRequest{ActorTemplate: validActorTemplate(func(x *ateapipb.ActorTemplate) {
x.SnapshotConfig.GoldenSnapshotConfig = &ateapipb.GoldenSnapshotConfig{Mode: ateapipb.GoldenSnapshotMode_GOLDEN_SNAPSHOT_MODE_RUNTIME}
})},
nil,
}, {
"runtime golden microvm",
&ateapipb.CreateActorTemplateRequest{ActorTemplate: validActorTemplate(func(x *ateapipb.ActorTemplate) {
x.SnapshotConfig.GoldenSnapshotConfig = &ateapipb.GoldenSnapshotConfig{Mode: ateapipb.GoldenSnapshotMode_GOLDEN_SNAPSHOT_MODE_RUNTIME}
x.SandboxConfig.SandboxClass = "microvm"
})}, nil,
}, {
"missing actor_template",
&ateapipb.CreateActorTemplateRequest{},
Expand Down Expand Up @@ -217,15 +229,15 @@ func TestValidateCreateActorTemplateRequest(t *testing.T) {
func TestValidateCreateActorTemplateRequest_PreviewRestricted(t *testing.T) {
setPreviewForTest(t, "ALL")
req := &ateapipb.CreateActorTemplateRequest{ActorTemplate: validActorTemplate(func(tmpl *ateapipb.ActorTemplate) {
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", ExternalVolumeTemplate: &ateapipb.ExternalVolumeTemplate{Capacity: "10Gi", StorageClassName: "fast-ssd"}}}
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", External: &ateapipb.ExternalVolumeSource{Template: &ateapipb.ExternalVolumeTemplate{Capacity: "10Gi", StorageClassName: "fast-ssd"}}}}
})}

t.Run("allowed", func(t *testing.T) {
assertValidateErr(t, ValidateCreateActorTemplateRequest(context.Background(), req), nil)
})
t.Run("restricted", func(t *testing.T) {
ctx := preview.ContextWithOptOut(context.Background())
want := field.ErrorList{field.Forbidden(field.NewPath("actor_template", "volumes").Index(0).Child("external_volume_template"), "")}
want := field.ErrorList{field.Forbidden(field.NewPath("actor_template", "volumes").Index(0).Child("external"), "")}
assertValidateErr(t, ValidateCreateActorTemplateRequest(ctx, req), want)
})
}
Expand Down Expand Up @@ -360,7 +372,7 @@ func TestValidateActorTemplate(t *testing.T) {
}, {
name: "golden snapshot mode unknown",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.SnapshotConfig.GoldenSnapshotConfig = &ateapipb.GoldenSnapshotConfig{Mode: ateapipb.GoldenSnapshotMode(3)}
tmpl.SnapshotConfig.GoldenSnapshotConfig = &ateapipb.GoldenSnapshotConfig{Mode: ateapipb.GoldenSnapshotMode(4)}
},
want: field.ErrorList{field.Invalid(field.NewPath("snapshot_config", "golden_snapshot_config", "mode"), nil, "").WithOrigin("maximum")},
}, {
Expand Down Expand Up @@ -832,52 +844,52 @@ func TestValidateActorTemplate(t *testing.T) {
}, {
name: "valid external volume template",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", ExternalVolumeTemplate: &ateapipb.ExternalVolumeTemplate{Capacity: "10Gi", StorageClassName: "fast-ssd"}}}
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", External: &ateapipb.ExternalVolumeSource{Template: &ateapipb.ExternalVolumeTemplate{Capacity: "10Gi", StorageClassName: "fast-ssd"}}}}
},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external_volume_template"), "")},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": nil},
}, {
name: "external volume template missing capacity",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", ExternalVolumeTemplate: &ateapipb.ExternalVolumeTemplate{StorageClassName: "fast-ssd"}}}
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", External: &ateapipb.ExternalVolumeSource{Template: &ateapipb.ExternalVolumeTemplate{StorageClassName: "fast-ssd"}}}}
},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external_volume_template"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.Required(field.NewPath("volumes").Index(0).Child("external_volume_template", "capacity"), "")}},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.Required(field.NewPath("volumes").Index(0).Child("external", "template", "capacity"), "")}},
}, {
name: "external volume template malformed capacity",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", ExternalVolumeTemplate: &ateapipb.ExternalVolumeTemplate{Capacity: "ten gigs", StorageClassName: "fast-ssd"}}}
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", External: &ateapipb.ExternalVolumeSource{Template: &ateapipb.ExternalVolumeTemplate{Capacity: "ten gigs", StorageClassName: "fast-ssd"}}}}
},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external_volume_template"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.Invalid(field.NewPath("volumes").Index(0).Child("external_volume_template", "capacity"), nil, "")}},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.Invalid(field.NewPath("volumes").Index(0).Child("external", "template", "capacity"), nil, "")}},
}, {
name: "external volume template capacity at the length bound",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", ExternalVolumeTemplate: &ateapipb.ExternalVolumeTemplate{Capacity: strings.Repeat("1", 30) + "Gi", StorageClassName: "fast-ssd"}}}
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", External: &ateapipb.ExternalVolumeSource{Template: &ateapipb.ExternalVolumeTemplate{Capacity: strings.Repeat("1", 30) + "Gi", StorageClassName: "fast-ssd"}}}}
},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external_volume_template"), "")},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": nil},
}, {
name: "external volume template capacity too long",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", ExternalVolumeTemplate: &ateapipb.ExternalVolumeTemplate{Capacity: strings.Repeat("1", 31) + "Gi", StorageClassName: "fast-ssd"}}}
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", External: &ateapipb.ExternalVolumeSource{Template: &ateapipb.ExternalVolumeTemplate{Capacity: strings.Repeat("1", 31) + "Gi", StorageClassName: "fast-ssd"}}}}
},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external_volume_template"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.TooLong(field.NewPath("volumes").Index(0).Child("external_volume_template", "capacity"), nil, 32).WithOrigin("maxLength")}},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.TooLong(field.NewPath("volumes").Index(0).Child("external", "template", "capacity"), nil, 32).WithOrigin("maxLength")}},
}, {
name: "external volume template missing storage_class_name",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", ExternalVolumeTemplate: &ateapipb.ExternalVolumeTemplate{Capacity: "10Gi"}}}
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", External: &ateapipb.ExternalVolumeSource{Template: &ateapipb.ExternalVolumeTemplate{Capacity: "10Gi"}}}}
},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external_volume_template"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.Required(field.NewPath("volumes").Index(0).Child("external_volume_template", "storage_class_name"), "")}},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.Required(field.NewPath("volumes").Index(0).Child("external", "template", "storage_class_name"), "")}},
}, {
name: "external volume template invalid storage_class_name",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", ExternalVolumeTemplate: &ateapipb.ExternalVolumeTemplate{Capacity: "10Gi", StorageClassName: "Fast SSD"}}}
tmpl.Volumes = []*ateapipb.Volume{{Name: "data", External: &ateapipb.ExternalVolumeSource{Template: &ateapipb.ExternalVolumeTemplate{Capacity: "10Gi", StorageClassName: "Fast SSD"}}}}
},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external_volume_template"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.Invalid(field.NewPath("volumes").Index(0).Child("external_volume_template", "storage_class_name"), nil, "").WithOrigin("format=k8s-long-name")}},
want: field.ErrorList{field.Forbidden(field.NewPath("volumes").Index(0).Child("external"), "")},
wantWithPreview: map[string]field.ErrorList{"ALL": {field.Invalid(field.NewPath("volumes").Index(0).Child("external", "template", "storage_class_name"), nil, "").WithOrigin("format=k8s-long-name")}},
}, {
name: "valid resources",
mutate: func(tmpl *ateapipb.ActorTemplate) {
Expand Down
14 changes: 7 additions & 7 deletions cmd/ateapi/internal/apivalidation/actor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,25 +605,25 @@ func TestValidateActorUpdate(t *testing.T) {
name: "adding a volume",
oldVal: validActor(withActorStatus()),
newVal: validActor(withActorStatus(func(s *ateapipb.ActorStatus) {
s.ExternalVolumes = []*ateapipb.ExternalVolume{{Name: "vol-a", VolumeType: "substrate.io/mock"}}
s.ExternalVolumes = []*ateapipb.ExternalVolumeRef{{Name: "vol-a", VolumeType: "substrate.io/mock"}}
})),
want: nil,
wantWithPreview: map[string]field.ErrorList{"ALL": nil},
}, {
name: "adding a volume to an actor with no status",
oldVal: validActor(),
newVal: validActor(withActorStatus(func(s *ateapipb.ActorStatus) {
s.ExternalVolumes = []*ateapipb.ExternalVolume{{Name: "vol-a", VolumeType: "substrate.io/mock"}}
s.ExternalVolumes = []*ateapipb.ExternalVolumeRef{{Name: "vol-a", VolumeType: "substrate.io/mock"}}
})),
want: nil,
wantWithPreview: map[string]field.ErrorList{"ALL": nil},
}, {
name: "provisioning transition on an existing volume",
oldVal: validInput(withStatus(func(s *ateapipb.ActorStatus) {
s.ExternalVolumes = []*ateapipb.ExternalVolume{{Name: "vol-a", VolumeType: "substrate.io/mock"}}
s.ExternalVolumes = []*ateapipb.ExternalVolumeRef{{Name: "vol-a", VolumeType: "substrate.io/mock"}}
})),
newVal: validActor(withActorStatus(func(s *ateapipb.ActorStatus) {
s.ExternalVolumes = []*ateapipb.ExternalVolume{{
s.ExternalVolumes = []*ateapipb.ExternalVolumeRef{{
Name: "vol-a",
VolumeType: "substrate.io/mock",
StorageVolumeId: "csi-426d29b7",
Expand All @@ -636,7 +636,7 @@ func TestValidateActorUpdate(t *testing.T) {
name: "duplicate external_volumes volume_name",
oldVal: validActor(withActorStatus()),
newVal: validActor(withActorStatus(func(s *ateapipb.ActorStatus) {
s.ExternalVolumes = []*ateapipb.ExternalVolume{
s.ExternalVolumes = []*ateapipb.ExternalVolumeRef{
{Name: "vol-a", VolumeType: "substrate.io/mock"},
{Name: "vol-a", VolumeType: "substrate.io/mock"},
}
Expand All @@ -649,9 +649,9 @@ func TestValidateActorUpdate(t *testing.T) {
name: "too many external_volumes",
oldVal: validActor(withActorStatus()),
newVal: validActor(withActorStatus(func(s *ateapipb.ActorStatus) {
vols := make([]*ateapipb.ExternalVolume, 33)
vols := make([]*ateapipb.ExternalVolumeRef, 33)
for i := range vols {
vols[i] = &ateapipb.ExternalVolume{Name: fmt.Sprintf("vol-%d", i), VolumeType: "substrate.io/mock"}
vols[i] = &ateapipb.ExternalVolumeRef{Name: fmt.Sprintf("vol-%d", i), VolumeType: "substrate.io/mock"}
}
s.ExternalVolumes = vols
})),
Expand Down
Loading
Loading