demos

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 9 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

This section is empty.

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 Simple

type Simple struct {
	// DemoName is the registry name, e.g. "demo-counter". It cannot be called
	// Name: that is the accessor the Demo interface requires.
	DemoName string
	// Short is the one-line summary, in cobra's sense of the word.
	Short string

	// Template is the *.yaml.tmpl path, relative to the repository root.
	Template string

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

	// ActorTemplates are the demo's ActorTemplates. Their actors are removed
	// before the manifests at delete time.
	ActorTemplates []steps.TemplateRef
}

Simple covers the demos that are one template plus a fixed set of readiness waits: render, ko apply, wait; and on delete, remove the actors then the same rendered manifest.

Demos that need more embed it and override a method, calling back into DeployWorkload and WaitReady to keep the shared ordering.

func (*Simple) Delete

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

func (*Simple) Deploy

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

func (*Simple) DeployWorkload

func (d *Simple) DeployWorkload(ctx context.Context, e *steps.Env) error

DeployWorkload renders the demo template and applies it through ko, without waiting. Demos that install add-ons alongside the workload call this directly so they can order the add-ons against it.

func (*Simple) Description

func (d *Simple) Description() string

func (*Simple) Flags

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

Flags registers nothing: most demos take no options.

func (*Simple) Name

func (d *Simple) Name() string

func (*Simple) TemplatePath

func (d *Simple) TemplatePath() string

TemplatePath exposes the demo's template through the Demo interface, so tests can check that every template renders cleanly.

func (*Simple) WaitReady

func (d *Simple) WaitReady(ctx context.Context, e *steps.Env) error

WaitReady blocks until the demo's Deployments are rolled out.

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

	// 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. It is the Go counterpart of deploy_substrate_demo / delete_substrate_demo in hack/install-ate.sh.

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 is the template's (atespace, name) identity.
	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 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 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