v0.4.0 #571
fslongjin
announced in
Announcements
v0.4.0
#571
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
2026.06.14 Release v0.4.0
CubeSandbox 0.4.0 introduces CubeEgress, an OpenResty-based security proxy that brings credential injection, domain filtering, and access auditing to sandbox egress traffic. This release also delivers container log forwarding with a new
cubecli logscommand, a node component version matrix with cluster-wide visibility, template replica compatibility checking, a daemonless template image build pipeline, and significant network performance improvements (35% faster network P50). The builder base image has been downgraded toubuntu:20.04, lowering the minimum glibc requirement from 2.34 to 2.31 for broader distribution compatibility. 58 commits from 15 contributors.🎯 Major Features
CubeEgress: Security Proxy
CubeEgress is a new OpenResty-based egress gateway that sits in the sandbox outbound traffic path via TPROXY, enforcing L7 policy before requests leave the cluster. It consists of ~2,200 lines of Lua across 9 modules running on OpenResty/nginx, plus Go-side integration in CubeMaster (CA provisioning, policy push), network-agent (TPROXY iptables rules), and Cubelet (per-sandbox routing, protobuf egress rule model).
EgressRule.inject— user code inside the sandbox never handles raw credentials. TheCubeNetworkConfigprotobuf message (formerlyCubeVSContext) now carries L7 egress rules with match conditions (SNI, host, method, path, scheme) and actions (allow/deny, audit, inject). Credential material is redacted as***REDACTED***in CubeMaster safe-log output (cubemaster: redact CubeNetworkConfig inject secrets in safe log #520).redactorLua module, enabling downstream compliance review.tx-tcp-mangleid-segmentationare enabled on TAP devices so redirected packets skip GSO before reaching the guest./admin/v1/healthendpoint extension, release manifest entries, and cubelet-side file-based collection.New files:
CubeEgress/(20 files — Lua modules, nginx config, Dockerfile, iptables scripts, systemd units, CA generation);CubeMaster/pkg/service/httpservice/cube/ca_download.go;CubeMaster/pkg/templatecenter/cube_egress_ca/;CubeMaster/pkg/templatecenter/cube_egress_ca_bake.go; DB migration0005_cube_egress.sql.Container Log Forwarding
Container init-process stdout/stderr is now streamed from the agent to the shim via a dedicated vsock connection and appended to log files on the host. A new
cubecli cubebox logssubcommand lets operators read these logs from outside the sandbox.cube.container.log_forwarding=trueannotation into the OCI spec, causing the agent to create stdout/stderr pipes (1 MiB buffer,O_NONBLOCK) for the init process. A dedicated vsock channel carries the log stream to the shim, which appends to/data/log/template/<id>/stdout|stderrduring template builds and to./stdout/./stderrin the bundle directory for normal sandboxes. Log forwarding is cleanly cancelled before pause/snapshot/teardown, and pipe write fds are closed on process exit so readers receive EOF (fix(log-forwarding): close pipe write fds and cancel log forward on kill #541). Exec I/O relay (FIFO-based) is kept separate from init log forwarding.cubecli cubebox logs(cubecli: add cubebox logs subcommand #528): New subcommand to read container stdout/stderr from/data/cubelet/state/io.containerd.runtime.v2.task/default/<id>/stdout|stderr. Supports--tail N,--head N,--all, and--stderrflags. Since log files live inside the cubelet mount namespace, the command re-execs itself via the existing C constructor inpkg/cubemnt/nsenter.cto safely enter the namespace before any Go code runs. IncludesopenNoFollow()path validation hardened against symlink-following attacks.Node Component Version Matrix
A new version tracking infrastructure gives operators cluster-wide visibility of component versions across all nodes, with a dedicated Web UI page.
node_component_versiontable (DB migration0004). The matrix groups nodes by reported version for each component, surfaces version skew, and exposes summary and detail APIs through CubeAPI.build.rs. A machine-readablerelease-manifest.jsonis generated in one-click release bundles so every artifact is traceable to the same release. Thecubecli versionandcubemastercli versionoutput formats are unified across components.Versions.tsxpage (762 lines) with i18n support (en/zh) shows per-component version distribution across nodes. The sidebar and Settings About section now display the actual release tag (injected at build time as__APP_VERSION__) instead of hardcoded versions.New files:
CubeMaster/pkg/nodemeta/versionmatrix.go;web/src/pages/Versions.tsx;web/src/locales/en/versions.json,zh/versions.json; DB migration0004_node_component_version.sql.Template Replica Compatibility
Template replicas are now checked against node component versions, with stale/missing replicas surfaced in both the API and Web UI.
template_versions(DB migration0006) and exposed via/templates/compat(summary) and/templates/compat/{id}(per-template detail). Version binding management lets operators pin a template to specific component versions at creation time.CompatBadge,CompatSection,CompatWarning,CompatNodeCard,VersionDeltaList.New files:
CubeMaster/pkg/templatecenter/compat.go;CubeMaster/pkg/service/httpservice/cube/template_compat.go; DB migration0006_template_replica_compat.sql.Template Image Build Pipeline Overhaul
The template image build pipeline has been rearchitected to support daemonless operation via skopeo/umoci, with a 72% reduction in peak disk usage and file-level content deduplication.
skopeo copyinto a local OCI layout and unpacked withumoci unpack --rootless, eliminating the Docker daemon requirement. Falls back to Docker for backward compatibility. The export strategy is chosen once at image resolution time so preparation and export stay consistent.tar -xfstdin via a 1 MiB pipe (F_SETPIPE_SZ), eliminating the intermediaterootfs.tarfile.CUBEMASTER_DISK_SPACE_SAFETY_MARGIN, default 1.5×).SHA256 computation uses a 4 MiB buffer to reduce read syscalls. A loop-mount streaming ext4 build phase (gated behind
CUBEMASTER_LOOP_MOUNT_EXT4_ENABLED, default false) is also implemented withCAP_SYS_ADMINdetection.POST /templatesand Python/Go SDKs now expose DNS, egress CIDRs, registry auth, command/args, network type, and node scope options, matching the fullcubemastercli template create-from-imageoption set.New files:
CubeMaster/pkg/templatecenter/image/(export, ext4, disk, command, ref, source, types, paths, util);CubeMaster/pkg/templatecenter/artifact_build.go,artifact_cleanup.go,distribution.go,fingerprint.go,image_job_runner.go,job_constants.go,job_dto.go.Network Performance
TAP fd acquisition optimization (perf: optimize TAP fd acquisition hot path #487): A three-tier
GetTapFilestrategy replaces the old single-path approach:state.tap.Fileis already cached, return it immediately (0 syscalls).open+TUNSETIFF), skipping the expensiverestoreTapflow (netlink lookup,LinkSetUp,SetMTU, TC filter attach, ARP entry).restoreTaponly when there is no in-memory state or the tap is held externally.The fdserver JSON response now includes the ifindex, allowing cubelet to skip its own
netlink.LinkByNamecall — eliminating a serialization point during concurrent sandbox creation. Cubelet falls back toLinkByNameonly when ifindex is 0 (backward-compatible with older agents).A TOCTOU race between
EnsureNetworkandReleaseNetworkis fixed by replacing singleflight-style dedup with a per-sandboxcreatingguard channel registered in the same critical section as the state check. Includes a pprof debug server (--pprof-listenflag) and 390 lines of concurrency tests (6 functions, 64-goroutine stress test clean under-race).Benchmarks (BMI5, Xeon Platinum 8255C, kernel 6.6.119): Network P50 35.3→23.1ms (35% faster), Network P99 86.6→51.2ms (41% faster), Total P50 106.1→92.0ms (13% faster), Throughput 194.8→209.8 sandboxes/s (8% higher).
BPF checksum optimization (Improve network performance #469):
bpf_csum_diff()is replaced withbpf_{l3,l4}_csum_replacehelpers in bothfrom_worldandfrom_cubeBPF programs. Combined with the TAP TX offload work (network-agent: enable TX csum/TSO offload and tx-tcp-mangleid-segmentation on tap #505), this enables TSO/UFO/CSUM offloads to be re-enabled on virtio-net TAPs (reverting hypervisor: Disable TSO/UFO/CSUM offloads on virtio-net TAPs #110), and thedisableGRO()requirement on host NICs is dropped.✨ Enhancements
Scheduling
overcommit_ratio(default CPU=3, Mem=2) with optional per-instance-type overrides viaovercommit_ratio_conf, andignore_redis_allocation(default false) to treat Redis-recorded allocations as zero. Applied consistently across filter and score plugins, with non-positive ratios clamped back to defaults. Physical load guards (CPU utilization ceiling, real-time free memory) are intentionally preserved.Affinity
com.nodeaffinity.selectorannotation now accepts arbitraryNodeSelectorRequirements(In, NotIn, Exists, DoesNotExist, Gt, Lt) as a JSON array of{key, operator, values}. Node labels from registration are carried throughNode.NodeLabels, merged intoLabels()with anatomic.Pointercache andInvalidateLabelsCache()for mutation safety. DoS hardening: max annotation size 4 KB, 10 selectors per request, 50 values per In/NotIn. Configurable allowed keys default to zone, cluster-id, cpu-type, memory-size, cpu-cores, instance-type. 872 lines of tests covering 47 cases.Template Management
tpl-prefix across all creation paths (API, CLI, Web UI, sandbox commit). User-specified IDs are accepted for backward compatibility but silently ignored — the server always returns an auto-generatedtpl-prefixed ID as the authoritative template identifier. Validation rejects baretpl-/snap-prefixes and non-conforming annotation prefixes.ubuntu:22.04toubuntu:20.04, lowering the minimum glibc requirement from 2.34 to 2.31. AffectsDockerfile.builder, one-click installer preflight checks, CI workflows, and documentation.Web UI
createRequest. A dedicated "Network Policy" section includes per-rule copy buttons. ABoolBadgecomponent is extracted as a shared UI primitive.SDK
PVM
LOCALVERSIONis renamed to a clean descriptive scheme so the distribution base and host/guest role are obvious fromuname -r. Deployment configs, user-facing guides, and blog references are updated to match.🐛 Bug Fixes
These fixes address issues present in v0.3.1:
AllowOutto ensure DNS resolution works through egress policy. Includes regression test coverage.cleanupHostDirVolumesnow resolves base-path symlinks when walking sandbox directories, so bind mounts under paths like/data → /mnt/ssd/dataare correctly identified and unmounted instead of leaking or having their backing directories wiped.AllowInternetAccess=false, resolved DNS servers are no longer appended toallow_out, so the deny-all outbound policy consistently blocks DNS resolution. Fixes # [Question] Why are DNS servers auto-whitelisted in allowOut when AllowInternetAccess=false? #408.ripgrep. Shell checks now use grep-based helpers.MigrationOnError::GuestErrorinstead ofAbort. Per-inode failures during snapshot restore surface as guest FS errors (ENOENT/EIO) on the affected paths rather than tearing down the entire live migration.process_queue_serial()no longer panics on malformed descriptors. Failures are recovered by writing an EIO FUSE error reply to the guest and continuing to serve the queue. A newdevice_memoryview is added for device-backed memory regions (virtio-pmem, virtio-fs DAX, ivshmem/zshm BARs).cgroups-rsand attaches container processes throughcgroup.procs, avoiding v1 controller name failures in unified cgroup mode. Process ID collection for cleanup and signals also reads fromcgroup.procs.ldd --versionoutput is now fully captured before parsing, preventing strict-mode preflight checks from exiting on an expected SIGPIPE.IPOverrideTransportare now buffered before copying, so multipart uploads no longer fail withRequestNotRead.cuebcli→cubecli), spelling mistakes, outdated deprecation hints, and truncated descriptions in bothcubecliandcubemastercli.📚 Documentation
e2b_code_interpreterexamples,CUBE_API_URL+ CubeProxy settings for CubeSandbox SDK examples.--template-idflags fromcreate-from-imagedocumentation and examples since template IDs are now auto-generated withtpl-prefix.install.sh,online-install.sh, andcheck-deps.sh. Updated install docs to use direct links to the Releases page.⚙️ Engineering Improvements
.PHONYdeclarations replace the single bulk list. A newclean-rust-target-dirstarget removestarget/under each top-level Rust workspace. Thealltarget is driven from a sharedBINARIESlist.fmttargets are added to all component Makefiles (Go and Rust), with a new.github/workflows/fmt-check.ymlCI workflow that runs format checking on PRs. The agent'sfmttarget automatically generates required files (version.rs, protocol.rs) before formatting.--body-file -) instead of temp files, keeping review content out of the checkout directory.[t, 1.5t]) to prevent thundering herd issues when multiple agents start concurrently.This discussion was created from the release v0.4.0.
Beta Was this translation helpful? Give feedback.
All reactions