Skip to content

Commit d86746d

Browse files
authored
Reject snapshotConfig.storageLocation without its preview gate (#3357)
Follow-up to #2544, from review comment #2544 (comment). `snapshotConfig.storageLocation` was accepted and ignored while the `PerTemplateSnapshotLocation` gate was off. A user could name a bucket, get a success response, and have snapshots written under the cluster `--snapshot-location`. ### What changed? Tested on kind with the cluster `--snapshot-location=gs://ate-snapshots/`. `<loc>` is the template's `storageLocation`. | Gate | Case | Before (`7e6476cbd`) | This PR | |---|---|---|---| | ON | with `storageLocation`, `--preview` | created, snapshot under `<loc>` | created, snapshot under `<loc>` | | ON | with `storageLocation`, no `--preview` | rejected: `Forbidden: requires a client that opts in to preview features ...` | rejected: `Forbidden` | | ON | without `storageLocation` | created, snapshot under `gs://ate-snapshots/` | same | | OFF | with `storageLocation`, `--preview` | created, but snapshot under `gs://ate-snapshots/`, not `<loc>` | rejected: `Forbidden` | | OFF | with `storageLocation`, no `--preview` | created, field ignored | rejected: `Forbidden` | | OFF | without `storageLocation` | created, snapshot under `gs://ate-snapshots/` | same | ### API validation - With preview off, a template that sets `storageLocation` is rejected with `InvalidArgument`. Before, it was accepted and silently ignored. - The old custom check is replaced by the standard ifDisabled forbidden rule that other preview fields use. ### Demos and benchmarks - No demo or benchmark template sets `storageLocation` any more. They all store snapshots under the cluster `--snapshot-location`. - `${BUCKET_NAME}` templating is gone from the demo rendering and the benchmark deploy scripts. The traffic-driver script loses `--bucket-name`. ### Install (ate-setup) - The comments and operator docs now say that the demos, benchmarks and e2e need `SNAPSHOT_LOCATION` even with the gate on. ### E2E fixtures and suites - With the gate on, the fixtures, combinedvolumes, and the demo, golden and template-update tests each set their own per-template location through `e2e.SnapshotLocation`. With it off, they leave the field out. - Templates copied from a demo also get their own location with the gate on. This brings per-template coverage back to the networkpolicy and egress suites. ### Unit tests - Validation tests now expect `Forbidden` when preview is off. Length and URI checks run with preview on. - The control API tests no longer rely on a default `storageLocation`. They set the cluster default the way nearby tests do. - The demo manifest tests and the kubectl-ate template tests fail if a shipped manifest sets `storageLocation` again. ### Docs - The API guide, operator install docs, demo READMEs, benchmarking README and the preview gate doc no longer mention bucket templating. They describe the field as preview-only. --------- Signed-off-by: Sneha Aradhey <[email protected]>
1 parent ea4018f commit d86746d

98 files changed

Lines changed: 283 additions & 359 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎api/ateapi/v1/ateapi.pb.go‎

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/ateapi/v1/ateapi.proto‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,9 +1279,10 @@ message SnapshotConfig {
12791279
// storage_location is the base object-storage URI snapshots of actors on
12801280
// this version are stored under. If unset, ate-api-server's
12811281
// --snapshot-location is used. Requires the PerTemplateSnapshotLocation preview
1282-
// gate; ignored without it.
1282+
// gate.
12831283
//
12841284
// +ate:preview=PerTemplateSnapshotLocation
1285+
// +k8s:ifDisabled(PerTemplateSnapshotLocation)=+k8s:forbidden
12851286
// +k8s:optional
12861287
// +k8s:maxLength=1024
12871288
// +k8s:customValidation # Validate URI

‎benchmarking/README.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ scenario ladder, read [observability.md](observability.md).
1212

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

‎benchmarking/deploy_locust.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ usage() {
6363
echo " -h|--help Show this help message"
6464
echo ""
6565
echo "Environment:"
66-
echo " PROJECT_ID, BUCKET_NAME, etc. are read from .ate-dev-env.sh by the"
66+
echo " PROJECT_ID etc. are read from .ate-dev-env.sh by the"
6767
echo " scripts this wrapper invokes."
6868
}
6969

‎benchmarking/nighthawk-egress/deploy-traffic-driver.sh‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ EGRESS_POLICY_MANIFEST="${SCRIPT_DIR}/egress-policy.yaml"
3535
KUBECTL_ATE_BIN="kubectl-ate"
3636
WAIT_TIMEOUT_SECS=300
3737
CONTEXT="${KUBECTL_CONTEXT:-}"
38-
BUCKET_NAME="${BUCKET_NAME:-ate-snapshots}"
3938
KO_DOCKER_REPO="${KO_DOCKER_REPO:-localhost:5001}"
4039

4140
usage() {
@@ -44,7 +43,6 @@ usage() {
4443
echo "Options:"
4544
echo " --deploy Deploy the ${ATESPACE}/${TEMPLATE_NAME} worker pool, actor template, and ${ACTOR_NAME} actor (default)"
4645
echo " --delete Delete the ${ACTOR_NAME} actor, template, atespace, and worker pool"
47-
echo " --bucket-name BUCKET GCS bucket name for actor snapshots (default: \$BUCKET_NAME)"
4846
echo " --ko-docker-repo REPO Container registry for ko image builds (default: \$KO_DOCKER_REPO)"
4947
echo " --context CONTEXT kubectl context to use (default: \$KUBECTL_CONTEXT or current context)"
5048
echo " --wait-timeout SECONDS Timeout waiting for worker pool and golden snapshot readiness (default: ${WAIT_TIMEOUT_SECS})"
@@ -60,13 +58,6 @@ while [[ "$#" -gt 0 ]]; do
6058
--delete)
6159
action="delete"
6260
;;
63-
--bucket-name)
64-
shift
65-
BUCKET_NAME="$1"
66-
;;
67-
--bucket-name=*)
68-
BUCKET_NAME="${1#*=}"
69-
;;
7061
--ko-docker-repo)
7162
shift
7263
KO_DOCKER_REPO="$1"
@@ -150,10 +141,6 @@ wait_template_ready() {
150141
}
151142

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

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

187173
wait_template_ready
188174

‎benchmarking/nighthawk-egress/traffic-driver-template.yaml.tmpl‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# Substrate ActorTemplate resource (protojson-shaped ateapi.ActorTemplate,
1616
# NOT the ate.dev/v1 CRD) for the Nighthawk egress traffic-driver actor.
17-
# Applied with `kubectl-ate create actor-template -f -` by
17+
# Applied with `kubectl-ate create actor-template -f` by
1818
# deploy-traffic-driver.sh; the `nighthawk` atespace must exist.
1919
#
2020
# Runs Envoy's `nighthawk_service` gRPC server on port 80 (the default actor
@@ -65,4 +65,3 @@ resources:
6565
memoryBytes: 1073741824 # 1Gi
6666
snapshotConfig:
6767
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
68-
storageLocation: gs://${BUCKET_NAME}/nighthawk/traffic-driver/

‎benchmarking/workloads/deploy.sh‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ if [[ -f .ate-dev-env.sh ]]; then
2323
source .ate-dev-env.sh
2424
fi
2525

26-
# Ensure BUCKET_NAME is set
27-
if [[ -z "${BUCKET_NAME:-}" ]]; then
28-
echo "Error: BUCKET_NAME environment variable is not set." >&2
29-
exit 1
30-
fi
31-
3226
MANIFEST_DIR="benchmarking/workloads/manifests"
3327
POOL_MANIFEST="${MANIFEST_DIR}/workloads.yaml.tmpl"
3428
# Generated sweperf ActorTemplates; see manifests/sweperf/generate_sweperf_templates.py.
@@ -192,8 +186,7 @@ substitute() {
192186
if [[ -n "${WORKER_MEMORY}" ]]; then
193187
worker_resources="resources: {requests: {memory: \"${WORKER_MEMORY}\"}, limits: {memory: \"${WORKER_MEMORY}\"}}"
194188
fi
195-
sed -e "s|\${BUCKET_NAME}|${BUCKET_NAME}|g" \
196-
-e "s|\${WORKER_COUNT}|${WORKER_COUNT}|g" \
189+
sed -e "s|\${WORKER_COUNT}|${WORKER_COUNT}|g" \
197190
-e "s|\${SANDBOX_CLASS}|${SANDBOX_CLASS}|g" \
198191
-e "s|\${OTLP_ENDPOINT}|${OTLP_ENDPOINT}|g" \
199192
-e "s|\${ACTOR_MEMORY}|${ACTOR_MEMORY}|g" \

‎benchmarking/workloads/manifests/ate-env-template.yaml.tmpl‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,3 @@ resources:
4444
memoryBytes: "${ACTOR_MEMORY_BYTES}"
4545
snapshotConfig:
4646
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
47-
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/ate-env/

‎benchmarking/workloads/manifests/glutton-durdir-data-template.yaml.tmpl‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,3 @@ resources:
5050
memoryBytes: "${ACTOR_MEMORY_BYTES}"
5151
snapshotConfig:
5252
preferredFidelity: SNAPSHOT_FIDELITY_VOLUMES
53-
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton-durdir-data/

‎benchmarking/workloads/manifests/glutton-durdir-full-template.yaml.tmpl‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,3 @@ resources:
4747
memoryBytes: "${ACTOR_MEMORY_BYTES}"
4848
snapshotConfig:
4949
preferredFidelity: SNAPSHOT_FIDELITY_MEMORY
50-
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton-durdir-full/

0 commit comments

Comments
 (0)