File tree Expand file tree Collapse file tree
src/libraries/rust/stargate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ ARG TARGETARCH
129129# Health probe changes less often than the binary, so copy it first for layer caching.
130130COPY --from=health-probe-downloader /usr/local/bin/grpc_health_probe /usr/local/bin/grpc_health_probe
131131COPY --from=binary-builder /out/stargate /usr/local/bin/stargate
132+ COPY --from=binary-builder /out/stargate-k8s-router /usr/local/bin/stargate-k8s-router
132133
133134ENTRYPOINT ["stargate" ]
134135CMD []
Original file line number Diff line number Diff line change @@ -91,6 +91,10 @@ load-balancer topology for production backend traffic.
9191- ` crates/mock-dynamo ` : local OpenAI-style backend
9292- ` crates/stargate-bench ` : benchmark runner
9393
94+ The versioned Stargate runtime image also includes
95+ ` /usr/local/bin/stargate-k8s-router ` . Kubernetes deployments can run the main
96+ Stargate process and the backend router from the same immutable image tag.
97+
9498## Benchmarks
9599
96100``` bash
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ rust_test(
4848# Multi-arch OCI image. distroless/cc base, binary at
4949# /usr/local/bin/stargate-k8s-router.
5050rust_oci_image (
51- name = "image" ,
51+ name = "stargate-k8s-router- image" ,
5252 base = "@distroless_cc" ,
5353 binary = ":stargate-k8s-router" ,
5454 binary_path = "/usr/local/bin/stargate-k8s-router" ,
@@ -62,8 +62,8 @@ sh_test(
6262 name = "image_entrypoint_mode_test" ,
6363 srcs = ["//src/libraries/rust/stargate/tools/ci:image_entrypoint_mode_test.sh" ],
6464 args = [
65- "$(location :image_layer)" ,
65+ "$(location :stargate-k8s-router- image_layer)" ,
6666 "/usr/local/bin/stargate-k8s-router" ,
6767 ],
68- data = [":image_layer" ],
68+ data = [":stargate-k8s-router- image_layer" ],
6969)
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ rust_oci_image(
116116 base = "@distroless_cc" ,
117117 binary = ":stargate" ,
118118 binary_path = "/usr/local/bin/stargate" ,
119+ extra_layers = ["//src/libraries/rust/stargate/crates/stargate-k8s-router:stargate-k8s-router-image_layer" ],
119120 tags = ["stargate" ],
120121 visibility = ["//visibility:public" ],
121122)
@@ -132,3 +133,15 @@ sh_test(
132133 ],
133134 data = [":image_layer" ],
134135)
136+
137+ # Composite-image guard. Inspect the assembled OCI layout so removing the
138+ # router's extra layer fails this test.
139+ sh_test (
140+ name = "image_router_binary_test" ,
141+ srcs = ["//src/libraries/rust/stargate/tools/ci:test-oci-image-contains-path.sh" ],
142+ args = [
143+ "$(location :image)" ,
144+ "/usr/local/bin/stargate-k8s-router" ,
145+ ],
146+ data = [":image" ],
147+ )
Original file line number Diff line number Diff line change 44exports_files (
55 [
66 "image_entrypoint_mode_test.sh" ,
7+ "test-oci-image-contains-path.sh" ,
78 ],
89 visibility = ["//visibility:public" ],
910)
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+ # SPDX-License-Identifier: Apache-2.0
4+
5+ set -euo pipefail
6+
7+ if [[ $# -ne 2 ]]; then
8+ echo " usage: $0 <oci-image-layout> <path>" >&2
9+ exit 2
10+ fi
11+
12+ image_layout=" $1 "
13+ image_path=" ${2#/ } "
14+
15+ if [[ ! -f " ${image_layout} /index.json" || ! -d " ${image_layout} /blobs/sha256" ]]; then
16+ echo " ${image_layout} is not an OCI image layout" >&2
17+ exit 1
18+ fi
19+
20+ while IFS= read -r -d ' ' blob; do
21+ if entries=" $( tar -tf " ${blob} " 2> /dev/null) " ; then
22+ while IFS= read -r entry; do
23+ entry=" ${entry# ./ } "
24+ entry=" ${entry#/ } "
25+ if [[ " ${entry} " == " ${image_path} " ]]; then
26+ exit 0
27+ fi
28+ done <<< " ${entries}"
29+ fi
30+ # rules_oci may symlink blob files to their source layers. Select those links
31+ # directly without following symlinked directories outside the blob tree.
32+ done < <( find " ${image_layout} /blobs/sha256" \( -type f -o -type l \) -print0)
33+
34+ echo " missing /${image_path} in ${image_layout} " >&2
35+ exit 1
You can’t perform that action at this time.
0 commit comments