demos

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package demos holds the contract every bundled demo implements, the registry the command tree is built from, and the shared behavior of a demo that is one manifest template.

Each demo lives in its own package under this one and registers itself from init, so adding a demo means adding a directory and one import rather than editing a shared switch, and no demo can reach into another's placeholders, namespaces, or template.

Index

Constants

View Source
const MicroVMGoldenTimeout = 600 * time.Second

MicroVMGoldenTimeout is the golden-snapshot budget the micro-VM demos set as their Substrate.GoldenTimeout: a micro-VM golden is a cloud-hypervisor cold boot plus a checkpoint, on nested KVM in CI, which does not fit in steps.DemoTimeout.

Variables

View Source
var ExternalVolumePlaceholders = []string{
	"VALIDATE_EXISTING_FILE_PATH_ARG",
	"EXTERNAL_VOLUME_MOUNTS",
	"EXTERNAL_VOLUMES",
}

ExternalVolumePlaceholders are the optional external-volume hooks in the counter and autoscaled-workerpool templates. Every path except `deploy demo counter --with-external-volume` drops them, which removes the lines entirely.

Functions

func Deleters

func Deleters(cfg *config.Config) []steps.Deleter

Deleters returns the demos that apply to cfg as the narrower interface steps.Env.DeleteAll takes.

The conversion lives here because the dependency only runs one way: the demos import steps for Env, so steps cannot name this package's Demo.

func Register

func Register(d Demo)

Register adds a demo to the registry. It panics on a duplicate name, which can only be a programming error.

func Render

func Render(e *steps.Env, relPath string, extraValues map[string]string, drop []string) ([]byte, error)

Render expands a demo template with the configured bucket name and the build version (pool templates pin worker pods to version-labeled nodes).

Types

type Demo

type Demo interface {
	// Name is the demo's registry name, e.g. "demo-counter".
	Name() string
	// Description is the one-line summary shown in help.
	Description() string
	// Flags registers demo-specific flags, if any.
	Flags(fs *pflag.FlagSet)
	// Deploy installs the demo.
	Deploy(ctx context.Context, e *steps.Env) error
	// Delete removes the demo. It must succeed on a cluster where the demo was
	// never installed, because DeleteAll runs every demo's Delete.
	Delete(ctx context.Context, e *steps.Env) error
}

Demo is one installable example workload.

The shell scripts expressed this with naming conventions: a name appended to ATE_DEMOS plus `${name}_deploy`, `${name}_delete`, `${name}_usage`, and `${name}_cmdline` functions discovered with `declare -F`. An interface makes the same contract explicit, and a demo that forgets a method no longer fails silently at runtime.

func All

func All() []Demo

All returns every registered demo, sorted by name.

func For

func For(cfg *config.Config) []Demo

For returns the demos that apply to cfg, sorted by name.

Kind-only demos are filtered out for non-Kind installs, mirroring how the autoscaled-workerpool demo only registered itself with the shell installer when ATE_INSTALL_KIND was true. DeleteAll iterates this, so a GKE teardown does not try to delete resources that could never have been installed.

type Substrate

type Substrate struct {
	// DemoName is the registry name, e.g. "demo-parking".
	DemoName string
	// Short is the one-line summary, in cobra's sense of the word.
	Short string

	// WorkerPoolManifest is the *.yaml.tmpl holding the namespace and
	// WorkerPool, relative to the repository root.
	WorkerPoolManifest string

	// Deployments are the pool Deployments to wait for at deploy time, in
	// order. The WorkerPool controller names each Deployment after its
	// WorkerPool.
	Deployments []steps.TemplateRef

	// Templates are the demo's ActorTemplates, created in order.
	Templates []SubstrateTemplate

	// GoldenTimeout budgets the wait for each template's golden snapshot.
	// Zero means [steps.DemoTimeout]. Micro-VM demos need more: their golden
	// 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 func(ctx context.Context, e *steps.Env) (map[string]string, error)
}

Substrate covers demos in the substrate-resource shape: one CRD manifest for the namespace and worker pool, plus ActorTemplates created through the ate API. Most demos are one of these; a demo needing more supplies its own Deploy and Delete.

func (*Substrate) Delete

func (d *Substrate) Delete(ctx context.Context, e *steps.Env) error

func (*Substrate) Deploy

func (d *Substrate) Deploy(ctx context.Context, e *steps.Env) error

func (*Substrate) Description

func (d *Substrate) Description() string

func (*Substrate) Flags

func (d *Substrate) Flags(*pflag.FlagSet)

Flags registers nothing: most demos take no options.

func (*Substrate) Name

func (d *Substrate) Name() string

func (*Substrate) SubstrateDemo

func (d *Substrate) SubstrateDemo() *Substrate

SubstrateDemo returns the demo's substrate configuration. It exists so tests can reach the manifests and template refs of demos that embed Substrate as uniformly as of ones that are a plain *Substrate. (A method named Substrate would be shadowed by the embedded field of that name.)

type SubstrateTemplate

type SubstrateTemplate struct {
	// Manifest is the protojson *.yaml.tmpl path, relative to the repository
	// root.
	Manifest string
	// Ref identifies the ActorTemplate by reference.
	Ref resources.ActorTemplateRef
}

SubstrateTemplate names one protojson ActorTemplate manifest and the resource it creates.

Directories

Path Synopsis
Package all links every bundled demo into the binary.
Package all links every bundled demo into the binary.
Package autoscaledworkerpool installs the counter workload plus the custom-metrics stack that drives a HorizontalPodAutoscaler over its WorkerPool.
Package autoscaledworkerpool installs the counter workload plus the custom-metrics stack that drives a HorizontalPodAutoscaler over its WorkerPool.
Package claudemultiplex installs the claude-code-multiplex demo, which runs several Claude Code agents side by side on one WorkerPool.
Package claudemultiplex installs the claude-code-multiplex demo, which runs several Claude Code agents side by side on one WorkerPool.
Package counter installs the counter demo: a counter actor exercising snapshot, resume, and atenet ingress, optionally with an external volume attached so the CSI path is covered end to end.
Package counter installs the counter demo: a counter actor exercising snapshot, resume, and atenet ingress, optionally with an external volume attached so the CSI path is covered end to end.
Package countermicrovm installs the micro-VM variant of the counter demo.
Package countermicrovm installs the micro-VM variant of the counter demo.
Package demotest provides the fixtures the demo packages share in their tests: an Env that needs no cluster, and the assertion that a rendered template is a complete manifest.
Package demotest provides the fixtures the demo packages share in their tests: an Env that needs no cluster, and the assertion that a rendered template is a complete manifest.
Package egress installs the egress demo, which exercises egress policy enforcement through atenet.
Package egress installs the egress demo, which exercises egress policy enforcement through atenet.
Package egressmicrovm installs the micro-VM variant of the egress demo.
Package egressmicrovm installs the micro-VM variant of the egress demo.
Package egressmicrovmmitm installs the micro-VM MITM variant of the egress demo.
Package egressmicrovmmitm installs the micro-VM MITM variant of the egress demo.
Package egressmitm installs the MITM variant of the egress demo.
Package egressmitm installs the MITM variant of the egress demo.
Package jupyter installs the Jupyter demo, which runs an unmodified jupyter/base-notebook image as an actor that suspends when idle and resumes when the notebook is next opened.
Package jupyter installs the Jupyter demo, which runs an unmodified jupyter/base-notebook image as an actor that suspends when idle and resumes when the notebook is next opened.
Package multitemplate installs the multi-template demo, where two ActorTemplates in two different atespaces share a single WorkerPool.
Package multitemplate installs the multi-template demo, where two ActorTemplates in two different atespaces share a single WorkerPool.
Package parking installs the parking demo, which parks and unparks actors on a small WorkerPool.
Package parking installs the parking demo, which parks and unparks actors on a small WorkerPool.
Package sandbox installs the sandbox demo: an ActorTemplate driven on demand by the sandbox client rather than by a long-lived workload.
Package sandbox installs the sandbox demo: an ActorTemplate driven on demand by the sandbox client rather than by a long-lived workload.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL