Skip to content
Merged
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
3 changes: 2 additions & 1 deletion api/ateapi/v1/ateapi.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion api/ateapi/v1/ateapi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1279,9 +1279,10 @@ message SnapshotConfig {
// storage_location is the base object-storage URI snapshots of actors on
// this version are stored under. If unset, ate-api-server's
// --snapshot-location is used. Requires the PerTemplateSnapshotLocation preview
// gate; ignored without it.
// gate.
//
// +ate:preview=PerTemplateSnapshotLocation
// +k8s:ifDisabled(PerTemplateSnapshotLocation)=+k8s:forbidden
// +k8s:optional
// +k8s:maxLength=1024
// +k8s:customValidation # Validate URI
Expand Down
3 changes: 1 addition & 2 deletions benchmarking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ scenario ladder, read [observability.md](observability.md).

> [!IMPORTANT]
> Source the environment configuration file (e.g., `source .ate-dev-env.sh`)
> first so `PROJECT_ID`, `BUCKET_NAME`, etc. are set.
> first so `PROJECT_ID` etc. are set.
>
> **For Local Kind Clusters**: Set `KO_DOCKER_REPO` to the local registry so images are pulled without remote cloud credentials:
> ```bash
> export KO_DOCKER_REPO="localhost:5001"
> export BUCKET_NAME="ate-snapshots"
> ```

> [!IMPORTANT]
Expand Down
2 changes: 1 addition & 1 deletion benchmarking/deploy_locust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ usage() {
echo " -h|--help Show this help message"
echo ""
echo "Environment:"
echo " PROJECT_ID, BUCKET_NAME, etc. are read from .ate-dev-env.sh by the"
echo " PROJECT_ID etc. are read from .ate-dev-env.sh by the"
echo " scripts this wrapper invokes."
}

Expand Down
16 changes: 1 addition & 15 deletions benchmarking/nighthawk-egress/deploy-traffic-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ EGRESS_POLICY_MANIFEST="${SCRIPT_DIR}/egress-policy.yaml"
KUBECTL_ATE_BIN="kubectl-ate"
WAIT_TIMEOUT_SECS=300
CONTEXT="${KUBECTL_CONTEXT:-}"
BUCKET_NAME="${BUCKET_NAME:-ate-snapshots}"
KO_DOCKER_REPO="${KO_DOCKER_REPO:-localhost:5001}"

usage() {
Expand All @@ -44,7 +43,6 @@ usage() {
echo "Options:"
echo " --deploy Deploy the ${ATESPACE}/${TEMPLATE_NAME} worker pool, actor template, and ${ACTOR_NAME} actor (default)"
echo " --delete Delete the ${ACTOR_NAME} actor, template, atespace, and worker pool"
echo " --bucket-name BUCKET GCS bucket name for actor snapshots (default: \$BUCKET_NAME)"
echo " --ko-docker-repo REPO Container registry for ko image builds (default: \$KO_DOCKER_REPO)"
echo " --context CONTEXT kubectl context to use (default: \$KUBECTL_CONTEXT or current context)"
echo " --wait-timeout SECONDS Timeout waiting for worker pool and golden snapshot readiness (default: ${WAIT_TIMEOUT_SECS})"
Expand All @@ -60,13 +58,6 @@ while [[ "$#" -gt 0 ]]; do
--delete)
action="delete"
;;
--bucket-name)
shift
BUCKET_NAME="$1"
;;
--bucket-name=*)
BUCKET_NAME="${1#*=}"
;;
--ko-docker-repo)
shift
KO_DOCKER_REPO="$1"
Expand Down Expand Up @@ -150,10 +141,6 @@ wait_template_ready() {
}

deploy() {
if [[ -z "${BUCKET_NAME}" ]]; then
echo "Error: BUCKET_NAME is not set. Pass --bucket-name or configure .ate-dev-env.sh." >&2
exit 1
fi
if [[ -z "${KO_DOCKER_REPO}" ]]; then
echo "Error: KO_DOCKER_REPO is not set. Pass --ko-docker-repo or configure .ate-dev-env.sh." >&2
exit 1
Expand Down Expand Up @@ -181,8 +168,7 @@ deploy() {
run_kubectl_ate delete actor-template "${TEMPLATE_NAME}" -a "${ATESPACE}" >/dev/null 2>&1 || true

echo "Creating actor template ${ATESPACE}/${TEMPLATE_NAME} from ${MANIFEST}..."
sed "s|\${BUCKET_NAME}|${BUCKET_NAME}|g" "${MANIFEST}" \
| run_kubectl_ate create actor-template -f -
run_kubectl_ate create actor-template -f "${MANIFEST}"

wait_template_ready

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Substrate ActorTemplate resource (protojson-shaped ateapi.ActorTemplate,
# NOT the ate.dev/v1 CRD) for the Nighthawk egress traffic-driver actor.
# Applied with `kubectl-ate create actor-template -f -` by
# Applied with `kubectl-ate create actor-template -f` by
# deploy-traffic-driver.sh; the `nighthawk` atespace must exist.
#
# Runs Envoy's `nighthawk_service` gRPC server on port 80 (the default actor
Expand Down Expand Up @@ -65,4 +65,3 @@ resources:
memoryBytes: 1073741824 # 1Gi
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/nighthawk/traffic-driver/
9 changes: 1 addition & 8 deletions benchmarking/workloads/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ if [[ -f .ate-dev-env.sh ]]; then
source .ate-dev-env.sh
fi

# Ensure BUCKET_NAME is set
if [[ -z "${BUCKET_NAME:-}" ]]; then
echo "Error: BUCKET_NAME environment variable is not set." >&2
exit 1
fi

MANIFEST_DIR="benchmarking/workloads/manifests"
POOL_MANIFEST="${MANIFEST_DIR}/workloads.yaml.tmpl"
# Generated sweperf ActorTemplates; see manifests/sweperf/generate_sweperf_templates.py.
Expand Down Expand Up @@ -192,8 +186,7 @@ substitute() {
if [[ -n "${WORKER_MEMORY}" ]]; then
worker_resources="resources: {requests: {memory: \"${WORKER_MEMORY}\"}, limits: {memory: \"${WORKER_MEMORY}\"}}"
fi
sed -e "s|\${BUCKET_NAME}|${BUCKET_NAME}|g" \
-e "s|\${WORKER_COUNT}|${WORKER_COUNT}|g" \
sed -e "s|\${WORKER_COUNT}|${WORKER_COUNT}|g" \
-e "s|\${SANDBOX_CLASS}|${SANDBOX_CLASS}|g" \
-e "s|\${OTLP_ENDPOINT}|${OTLP_ENDPOINT}|g" \
-e "s|\${ACTOR_MEMORY}|${ACTOR_MEMORY}|g" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ resources:
memoryBytes: "${ACTOR_MEMORY_BYTES}"
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/ate-env/
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ resources:
memoryBytes: "${ACTOR_MEMORY_BYTES}"
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_VOLUMES
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton-durdir-data/
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ resources:
memoryBytes: "${ACTOR_MEMORY_BYTES}"
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton-durdir-full/
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ resources:
memoryBytes: "${ACTOR_MEMORY_BYTES}"
snapshotConfig:
onCommit: SNAPSHOT_CONTENT_SCOPE_FULL
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton-storage/
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ resources:
memoryBytes: "${ACTOR_MEMORY_BYTES}"
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton/
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ resources:
memoryBytes: 8589934592 # 8Gi
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/kernelmem/
1 change: 0 additions & 1 deletion benchmarking/workloads/manifests/sleep-template.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ resources:
memoryBytes: "${ACTOR_MEMORY_BYTES}"
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/sleep/
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Generated by benchmarking/workloads/manifests/sweperf/generate_sweperf_templates.py
# from sweperf-images.json and sweperf-template.yaml.j2; edit those, not this
# file. The ${...} values are filled in by benchmarking/workloads/deploy.sh.
# file.
metadata:
atespace: benchmark-workloads
name: sweperf-astropy-7336
Expand Down Expand Up @@ -47,4 +47,3 @@ resources:
memoryBytes: 4294967296 # 4Gi
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/sweperf-astropy-7336/
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Generated by benchmarking/workloads/manifests/sweperf/generate_sweperf_templates.py
# from sweperf-images.json and sweperf-template.yaml.j2; edit those, not this
# file. The ${...} values are filled in by benchmarking/workloads/deploy.sh.
# file.
metadata:
atespace: benchmark-workloads
name: sweperf-django-11099
Expand Down Expand Up @@ -47,4 +47,3 @@ resources:
memoryBytes: 4294967296 # 4Gi
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/sweperf-django-11099/
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Generated by benchmarking/workloads/manifests/sweperf/generate_sweperf_templates.py
# from sweperf-images.json and sweperf-template.yaml.j2; edit those, not this
# file. The ${...} values are filled in by benchmarking/workloads/deploy.sh.
# file.
metadata:
atespace: benchmark-workloads
name: sweperf-matplotlib-20826
Expand Down Expand Up @@ -47,4 +47,3 @@ resources:
memoryBytes: 4294967296 # 4Gi
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/sweperf-matplotlib-20826/
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Generated by benchmarking/workloads/manifests/sweperf/generate_sweperf_templates.py
# from sweperf-images.json and sweperf-template.yaml.j2; edit those, not this
# file. The ${...} values are filled in by benchmarking/workloads/deploy.sh.
# file.
metadata:
atespace: benchmark-workloads
name: sweperf-sphinx-8638
Expand Down Expand Up @@ -47,4 +47,3 @@ resources:
memoryBytes: 4294967296 # 4Gi
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/sweperf-sphinx-8638/
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Generated by benchmarking/workloads/manifests/sweperf/generate_sweperf_templates.py
# from sweperf-images.json and sweperf-template.yaml.j2; edit those, not this
# file. The ${...} values are filled in by benchmarking/workloads/deploy.sh.
# file.
metadata:
atespace: benchmark-workloads
name: sweperf-sympy-13647
Expand Down Expand Up @@ -47,4 +47,3 @@ resources:
memoryBytes: 4294967296 # 4Gi
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/sweperf-sympy-13647/
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Generated by benchmarking/workloads/manifests/sweperf/generate_sweperf_templates.py
# from sweperf-images.json and sweperf-template.yaml.j2; edit those, not this
# file. The ${...} values are filled in by benchmarking/workloads/deploy.sh.
# file.
metadata:
atespace: benchmark-workloads
name: {{ name }}
Expand Down Expand Up @@ -47,4 +47,3 @@ resources:
memoryBytes: 4294967296 # 4Gi
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/{{ name }}/
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ def test_render_fills_task_values(self):
self.assertIn("name: sweperf-django-11099", content)
self.assertIn(f'image: "{PINNED}"', content)
self.assertIn('value: "15"', content)
# deploy.sh fills these, so they must survive rendering.
self.assertIn("${BUCKET_NAME}", content)

def test_check_reports_missing_stale_and_orphaned_files(self):
rendered = gen.render([{"name": n, "image": PINNED, "steps": 1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ resources:
memoryBytes: 1610612736 # 1536Mi
snapshotConfig:
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/usermem/
2 changes: 1 addition & 1 deletion cmd/ate-setup/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ is absent); the other two are flags of the benchmark commands. See
| `deploy demo sandbox` | An on-demand sandbox actor driven by the sandbox client |
| `deploy demo multi-template` | Two ActorTemplates sharing one WorkerPool |
| `deploy demo parking` | Actor parking and unparking on a small WorkerPool |
| `deploy demo claude-code-multiplex` | Several Claude Code agents multiplexed onto one WorkerPool (requires `ANTHROPIC_API_KEY`, `BUCKET_NAME`, `KO_DOCKER_REPO`) |
| `deploy demo claude-code-multiplex` | Several Claude Code agents multiplexed onto one WorkerPool (requires `ANTHROPIC_API_KEY`, `KO_DOCKER_REPO`) |

Each has a matching `delete demo NAME`. Demo flags bind
to the deploy side only; teardown never reads them.
Expand Down
8 changes: 6 additions & 2 deletions cmd/ate-setup/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,18 @@ type Config struct {
// defaults to the in-cluster URL of the install's ate-idp-server Service.
ActorJWTIssuer string

// BucketName is the snapshot bucket demos are templated with.
// BucketName is the object-storage bucket (BUCKET_NAME) passed to install
// scripts such as hack/install-microvm-deps.sh. The kind profile also
// derives SnapshotLocation from it.
BucketName string

// SnapshotLocation is ate-api-server's --snapshot-location
// (SNAPSHOT_LOCATION): the cluster-wide object-storage URI actor snapshots
// are stored under. Required unless the PerTemplateSnapshotLocation
// preview gate is enabled, which also lets a
// template's snapshotConfig.storageLocation override it.
// template's snapshotConfig.storageLocation override it. The demos and
// benchmarks, and so e2e runs, need it even with the gate, since they do
// not set storageLocation.
SnapshotLocation string

// TransferGSAName is the name of the Google service account snapshot
Expand Down
2 changes: 1 addition & 1 deletion cmd/ate-setup/internal/config/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ var Registry = []Setting{

{
Key: "storage.bucketName", Env: "BUCKET_NAME", Flag: "storage-bucket-name", Kind: KindString,
Usage: "Snapshot bucket the demos are templated with",
Usage: "Object-storage bucket passed to install scripts; the kind profile derives --snapshot-location from it",
},
{
Key: "storage.snapshotLocation", Env: "SNAPSHOT_LOCATION", Flag: "snapshot-location", Kind: KindString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func init() {
d := &demo{}
d.sub = demos.Substrate{
DemoName: "demo-claude-code-multiplex",
Short: "Several Claude Code agents multiplexed onto one WorkerPool (requires ANTHROPIC_API_KEY, BUCKET_NAME, KO_DOCKER_REPO)",
Short: "Several Claude Code agents multiplexed onto one WorkerPool (requires ANTHROPIC_API_KEY, KO_DOCKER_REPO)",
WorkerPoolManifest: poolManifest,
Deployments: []steps.TemplateRef{{Atespace: atespace, Name: "claude-workerpool"}},
Templates: agentTemplates(),
Expand Down Expand Up @@ -85,9 +85,6 @@ func (d *demo) Deploy(ctx context.Context, e *steps.Env) error {
if e.Cfg.AnthropicAPIKey == "" {
return fmt.Errorf("ANTHROPIC_API_KEY must be set")
}
if e.Cfg.BucketName == "" {
return fmt.Errorf("BUCKET_NAME must be set")
}
if e.Cfg.KODockerRepo == "" {
return fmt.Errorf("KO_DOCKER_REPO must be set (see hack/ate-dev-env.sh.example)")
}
Expand Down
6 changes: 5 additions & 1 deletion cmd/ate-setup/internal/demos/demotest/demotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func Env(t *testing.T) *steps.Env {
if err != nil {
t.Fatalf("Resolve: %v", err)
}
cfg := &config.Config{Root: root, BucketName: "ate-snapshots"}
cfg := &config.Config{Root: root}
cfg.SetResolved(r)
return &steps.Env{Cfg: cfg}
}
Expand Down Expand Up @@ -85,6 +85,10 @@ func AssertRenderedActorTemplate(t *testing.T, manifest []byte, want resources.A
if got := resources.ActorTemplateRefFromActorTemplate(template); got != want {
t.Errorf("manifest names template %s, want %s", got, want)
}
// The API rejects storageLocation without its preview gate.
if got := template.GetSnapshotConfig().GetStorageLocation(); got != "" {
t.Errorf("manifest sets storageLocation %q, want none", got)
}
}

// assertNoPlaceholders checks that no non-comment line still contains a
Expand Down
14 changes: 2 additions & 12 deletions cmd/ate-setup/internal/demos/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ import (
"go.ate.dev/substrate/cmd/ate-setup/internal/steps"
)

// bucketNamePlaceholder is substituted into every demo template with the
// snapshot bucket for this environment.
const bucketNamePlaceholder = "BUCKET_NAME"

// ExternalVolumePlaceholders are the optional external-volume hooks in the
// counter templates. Every path except
// `deploy demo counter --with-external-volume` drops them, which removes the
Expand All @@ -33,13 +29,7 @@ var ExternalVolumePlaceholders = []string{
"EXTERNAL_VOLUMES",
}

// Render expands a demo template with the configured bucket name.
func Render(e *steps.Env, relPath string, extraValues map[string]string, drop []string) ([]byte, error) {
values := map[string]string{
bucketNamePlaceholder: e.Cfg.BucketName,
}
for k, v := range extraValues {
values[k] = v
}
// Render expands a demo template with values.
func Render(e *steps.Env, relPath string, values map[string]string, drop []string) ([]byte, error) {
return render.Template(e.Cfg.Path(relPath), values, drop)
}
8 changes: 4 additions & 4 deletions cmd/ate-setup/internal/demos/substrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ type Substrate struct {
// is a cloud-hypervisor cold boot plus a checkpoint, on nested KVM in CI.
GoldenTimeout time.Duration

// RenderValues optionally supplies extra placeholder values at deploy
// time, for demos whose manifests need more than ${BUCKET_NAME} (e.g. a
// freshly built image digest). Delete renders only the pool manifest, so
// deploy-only values may live solely here.
// RenderValues optionally supplies placeholder values at deploy time, for
// demos whose manifests need them (e.g. a freshly built image digest).
// Delete renders only the pool manifest, so deploy-only values may live
// solely here.
RenderValues func(ctx context.Context, e *steps.Env) (map[string]string, error)
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/ate-setup/internal/steps/apienv.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ func sharedBootstrapOwnerWarning(bootstrapOwners, namespace string) string {
// snapshots. It is used whether or not the PerTemplateSnapshotLocation preview
// gate is enabled; with the gate, an actor template's
// snapshotConfig.storageLocation overrides it. It may be empty only when the
// gate is enabled, in which case every template must set its own.
// gate is enabled. CreateActorTemplate then fails with FailedPrecondition for
// a template without storageLocation, which includes every demo and
// benchmark.
func clusterSnapshotLocation(location string, gates []string) (string, error) {
if location != "" {
if err := resources.ValidateSnapshotLocation(location); err != nil {
Expand Down
Loading
Loading