deployment-operator

module
v0.6.76 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0, Apache-2.0, MIT

README

Deployment Operator

Integration Testing

Every PR should be fully e2e tested on a realistic cluster. The simplest mechanism to do this is to:

  1. Grab the image tag that was created from your pr, should be here: https://github.com/pluralsh/deployment-operator/pkgs/container/deployment-operator
  2. Find a safe test cluster in a Plural Console, go to its deploy-operator service, and add a tag secret pointing to that tag. (note this is defined in charts/deployment-operator/values.yaml.liquid)
  3. Virtually all deployment-operator derived functionality will now derive from that tag, including stacks, sentinels and agent runtime runs.

Helm Chart Tests

To test that the deployment-operator Helm chart can be successfully installed, run:

./test/helm/test-chart-install.sh

This script will:

  1. Create a temporary Kind cluster
  2. Validate the chart using helm lint
  3. Verify template rendering with helm template
  4. Perform a dry-run installation with helm install --dry-run
  5. Automatically clean up the cluster when the test completes

See test/helm/README.md for more details.

Unit Tests

Pre Reqs

Ensure that the cluster in your current kube context is reachable

Helm tests will run against this cluster You can test with:

kubectl cluster-info
Install dependencies with make
make tools
Setup Environment

Set the KUBEBUILDER_ASSETS directory

# Mac
export KUBEBUILDER_ASSETS=${GOBIN}/k8s/1.28.3-darwin-arm64

# Linux
export KUBEBUILDER_ASSETS=${GOBIN}/k8s/1.28.3-linux-amd64

Running Unit Tests

make test

Adding Tests

Reference the Ginkgo Getting Started to see the expected structure

Install the Ginkgo CLI
go install github.com/onsi/ginkgo/v2/ginkgo
The Test Suites for several Packages are already Generated in the Deployment-Operator Repo

If creating a new package or testing a package that doesn't already have a test suite

cd pkg/package/that/needs/suite
ginkgo bootstrap
Generate A Basic test

I'm creating a test for ./pkg/manifests/template/tpl.go

cd ./pkg/manifests/template
ginkgo generate tpl

example output

Generating ginkgo test for Tpl in:
  tpl_test.go

It generates: ./pkg/manifests/template/tpl_test.go

# ./pkg/manifests/template/tpl_test.go
package template_test

import (
	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/gomega"

	"github.com/pluralsh/deployment-operator/pkg/manifests/template"
)

var _ = Describe("Tpl", func() {

})

From here you can begin adding specs (test) to your generated file
# ./pkg/manifests/template/tpl_test.go
var _ = Describe("Tpl", func() {

	Context("Example Test", func() {
		It("Should always Pass", func() {
			Expect(1).To(Equal(1))
		})
	})

    Context("Test Should Fail for example output", func() {
		It("Should always fail", func() {
			Expect(1).To(Equal(2))
		})
	})

})
Run the Suite with your New Test

I'm doing this here just for an example and to check that my tests are bing added to the Suite


make test
# ... other output

[GIN-debug] GET    /version                  --> github.com/pluralsh/deployment-operator/pkg/manifests/template.init.func1.1 (3 handlers)
Running Suite: Controller Suite - /Users/kjj/git/plrl/deployment-operator/pkg/manifests/template
================================================================================================
Random Seed: 1715288079

Will run 6 of 6 specs
# Warning: 'bases' is deprecated. Please use 'resources' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
••
------------------------------
• [FAILED] [0.000 seconds]
Tpl Test Should Fail for example output [It] Should always Fail
/Users/kjj/git/plrl/deployment-operator/pkg/manifests/template/tpl_test.go:17

  [FAILED] Expected
      <int>: 1
  to equal
      <int>: 2
  In [It] at: /Users/kjj/git/plrl/deployment-operator/pkg/manifests/template/tpl_test.go:18 @ 05/09/24 16:54:41.29
------------------------------
2024/05/09 16:54:41 render helm templates: enable dependency update= false dependencies= 0
Found unknown types unknown resource types: apiextensions.k8s.io/v1/CustomResourceDefinition,apiextensions.k8s.io/v1/CustomResourceDefinition, ignoring for now2024/05/09 16:54:41 Server exiting
•••

Summarizing 1 Failure:
  [FAIL] Tpl Test Should Fail for example output [It] Should always Fail
  /Users/kjj/git/plrl/deployment-operator/pkg/manifests/template/tpl_test.go:18

Ran 6 of 6 Specs in 2.810 seconds
FAIL! -- 5 Passed | 1 Failed | 0 Pending | 0 Skipped
--- FAIL: TestControllers (2.81s)
FAIL
FAIL    github.com/pluralsh/deployment-operator/pkg/manifests/template  3.421s
FAIL
make: *** [test] Error 1

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the deployments v1alpha1 API group +kubebuilder:object:generate=true +groupName=deployments.plural.sh
Package v1alpha1 contains API Schema definitions for the deployments v1alpha1 API group +kubebuilder:object:generate=true +groupName=deployments.plural.sh
cmd
agent command
agent-bootstrap command
agent-harness command
Command agent-harness runs a single agent run inside its pod and reports progress back to the console.
Command agent-harness runs a single agent run inside its pod and reports progress back to the console.
devbox-daemon command
devbox-daemon is PID 1 in every Plural DevBox sandbox (image ENTRYPOINT).
devbox-daemon is PID 1 in every Plural DevBox sandbox (image ENTRYPOINT).
devbox-disk-prep command
Command devbox-disk-prep runs as a privileged DaemonSet on devbox nodes.
Command devbox-disk-prep runs as a privileged DaemonSet on devbox nodes.
devbox-gateway command
devbox-gateway is the per-cluster DevBoxes gateway (sections 4.6 to 4.11 of the DevBoxes plan).
devbox-gateway is the per-cluster DevBoxes gateway (sections 4.6 to 4.11 of the DevBoxes plan).
harness command
mcpserver/agent command
internal
pkg
agentrun-harness/attachments
Package attachments downloads files attached to an agent run or its prompts and describes them to the coding agent.
Package attachments downloads files attached to an agent run or its prompts and describes them to the coding agent.
agentrun-harness/events
Package events relays the agent run status Console pushes to the mcpserver sidecar, which holds the deploy token and the websocket, to the harness's poll loops.
Package events relays the agent run status Console pushes to the mcpserver sidecar, which holds the deploy token and the websocket, to the harness's poll loops.
agentrun-harness/tool/acp
Package acp contains the provider-neutral Agent Client Protocol engine.
Package acp contains the provider-neutral Agent Client Protocol engine.
agentrun-harness/tool/pi
Package pi implements the Pi coding-agent runtime for the agent harness.
Package pi implements the Pi coding-agent runtime for the agent harness.
devbox/api/v1
Package devboxv1 holds the generated devbox.v1 gRPC contract (from proto/devbox/v1 in the repository root, regenerate with `make devbox-proto`) plus the metadata conventions shared by console, KAS, devbox-gateway and devbox-daemon.
Package devboxv1 holds the generated devbox.v1 gRPC contract (from proto/devbox/v1 in the repository root, regenerate with `make devbox-proto`) plus the metadata conventions shared by console, KAS, devbox-gateway and devbox-daemon.
devbox/daemon
Package daemon is devbox-daemon, PID 1 in every DevBox sandbox (section 4.2).
Package daemon is devbox-daemon, PID 1 in every DevBox sandbox (section 4.2).
devbox/daemon/acp
Package acp is the daemon's ACP client layer: a raw JSON-RPC connection to a harness over stdio, converters between ACP JSON and the devbox.v1 protos, the v1 -> v2 entity normalizer, subagent lineage extraction and the live entity store.
Package acp is the daemon's ACP client layer: a raw JSON-RPC connection to a harness over stdio, converters between ACP JSON and the devbox.v1 protos, the v1 -> v2 entity normalizer, subagent lineage extraction and the live entity store.
devbox/daemon/agents
Package agents is the daemon's ACP session service (DBX-41, DBX-48): one ACP connection per agent type, shared by that agent's threads; threads mapped onto ACP's session built-ins; the prompt lifecycle with the per-instance running-thread limit; permission and elicitation interactions; config options (models included); slash commands; subagent lineage; and the live entity store whose normalized, v2-shaped changes are appended to the daemon's event log, with settled entities written to the box's transcript.
Package agents is the daemon's ACP session service (DBX-41, DBX-48): one ACP connection per agent type, shared by that agent's threads; threads mapped onto ACP's session built-ins; the prompt lifecycle with the per-instance running-thread limit; permission and elicitation interactions; config options (models included); slash commands; subagent lineage; and the live entity store whose normalized, v2-shaped changes are appended to the daemon's event log, with settled entities written to the box's transcript.
devbox/daemon/authn
Package authn validates `devbox-request-token`, the JWT the gateway attaches to every Daemon call, against the JWKS delivered in Initialize.
Package authn validates `devbox-request-token`, the JWT the gateway attaches to every Daemon call, against the JWKS delivered in Initialize.
devbox/daemon/browser
Package browser runs the sandbox's visible Chromium (DBX-45): Xvfb, Chromium with a CDP port the agent's Playwright MCP drives, x11vnc on localhost bridged to the /browser/vnc WebSocket, and the /preview/:port/* reverse proxy.
Package browser runs the sandbox's visible Chromium (DBX-45): Xvfb, Chromium with a CDP port the agent's Playwright MCP drives, x11vnc on localhost bridged to the /browser/vnc WebSocket, and the /preview/:port/* reverse proxy.
devbox/daemon/creds
Package creds manages the credentials that must live in the sandbox (sections 4.9 and 4.11): cloud OIDC token files with SDK configuration, and the Codex subscription bundle on tmpfs with compare-and-swap write-back.
Package creds manages the credentials that must live in the sandbox (sections 4.9 and 4.11): cloud OIDC token files with SDK configuration, and the Codex subscription bundle on tmpfs with compare-and-swap write-back.
devbox/daemon/derr
Package derr builds gRPC errors carrying a devbox.v1.ErrorDetail, so callers can branch on the reason.
Package derr builds gRPC errors carrying a devbox.v1.ErrorDetail, so callers can branch on the reason.
devbox/daemon/eventlog
Package eventlog is the daemon's offset-addressed event log (section 4.6).
Package eventlog is the daemon's offset-addressed event log (section 4.6).
devbox/daemon/fakeacp
Package fakeacp is a scripted ACP v1 agent for tests.
Package fakeacp is a scripted ACP v1 agent for tests.
devbox/daemon/files
Package files serves the filesystem and changes RPCs (DBX-43): listing, stat, reads with a content hash, compare-and-swap writes, recursive watches, and git changes grouped by checkout.
Package files serves the filesystem and changes RPCs (DBX-43): listing, stat, reads with a content hash, compare-and-swap writes, recursive watches, and git changes grouped by checkout.
devbox/daemon/gitutil
Package gitutil wraps the git CLI for checkout inspection, status and diffs (DBX-43).
Package gitutil wraps the git CLI for checkout inspection, status and diffs (DBX-43).
devbox/daemon/harness
Package harness builds the launch configuration for each agent harness (DBX-46, DBX-57): the ACP command, environment pointing model traffic at the console AI proxy with a placeholder key (or at the owner's plan), CA trust, home instruction files and the per-harness model boot flags used when an adapter has no ACP model control.
Package harness builds the launch configuration for each agent harness (DBX-46, DBX-57): the ACP command, environment pointing model traffic at the console AI proxy with a placeholder key (or at the owner's plan), CA trust, home instruction files and the per-harness model boot flags used when an adapter has no ACP model control.
devbox/daemon/idle
Package idle is the daemon's suspend detector (DBX-47, section 4.3a).
Package idle is the daemon's suspend detector (DBX-47, section 4.3a).
devbox/daemon/internal/clock
Package clock abstracts time so the daemon's timers (idle detection, settling, credential rotation) can be driven by a fake clock in tests.
Package clock abstracts time so the daemon's timers (idle detection, settling, credential rotation) can be driven by a fake clock in tests.
devbox/daemon/internal/fsutil
Package fsutil holds small filesystem helpers shared by the daemon's packages.
Package fsutil holds small filesystem helpers shared by the daemon's packages.
devbox/daemon/internal/gittest
Package gittest creates throwaway git repositories for tests.
Package gittest creates throwaway git repositories for tests.
devbox/daemon/proc
Package proc runs and supervises the daemon's child processes and, when the daemon is PID 1, reaps orphaned zombies without racing exec.Cmd.Wait for the children the daemon started itself.
Package proc runs and supervises the daemon's child processes and, when the daemon is PID 1, reaps orphaned zombies without racing exec.Cmd.Wait for the children the daemon started itself.
devbox/daemon/prs
Package prs readies a checkout for a pull request: it writes the title, body and commit message from the changes the box holds, branches off the default branch if needed, commits and pushes.
Package prs readies a checkout for a pull request: it writes the title, body and commit message from the changes the box holds, branches off the default branch if needed, commits and pushes.
devbox/daemon/terminal
Package terminal runs PTY sessions for the workbench terminal pane and `plural devbox ssh` (DBX-42).
Package terminal runs PTY sessions for the workbench terminal pane and `plural devbox ssh` (DBX-42).
devbox/daemon/transcript
Package transcript is the box's durable transcript: every settled entity revision, kept on the workspace volume (~/.plural/transcripts) so it survives suspends, snapshots and daemon restarts, and served to the gateway by Daemon.GetTimeline.
Package transcript is the box's durable transcript: every settled entity revision, kept on the workspace volume (~/.plural/transcripts) so it survives suspends, snapshots and daemon restarts, and served to the gateway by Daemon.GetTimeline.
devbox/daemon/trust
Package trust builds the sandbox's CA bundle: the system roots plus the egress gateway's interception CA, written to the writable trust store that SSL_CERT_FILE, NODE_EXTRA_CA_CERTS, REQUESTS_CA_BUNDLE and GIT_SSL_CAINFO point at.
Package trust builds the sandbox's CA bundle: the system roots plus the egress gateway's interception CA, written to the writable trust store that SSL_CERT_FILE, NODE_EXTRA_CA_CERTS, REQUESTS_CA_BUNDLE and GIT_SSL_CAINFO point at.
devbox/daemon/workspace
Package workspace hydrates and maintains the multi-repo home directory (DBX-44, section 4.2b): skeleton files, repository clones with the naming rule, the home instruction file, Project.md's managed table and stubs, AddRepository, per-thread worktrees, and uploaded git bundles.
Package workspace hydrates and maintains the multi-repo home directory (DBX-44, section 4.2b): skeleton files, repository clones with the naming rule, the home instruction file, Project.md's managed table and stubs, AddRepository, per-thread worktrees, and uploaded git bundles.
devbox/gateway/actors
Package actors is the gateway's Substrate client (DBX-32): the actor lifecycle, egress policies, tags and worker drain state, on top of the vendored substrate.ateapi.v1 bindings in pkg/devbox/substrate/ateapi.
Package actors is the gateway's Substrate client (DBX-32): the actor lifecycle, egress policies, tags and worker drain state, on top of the vendored substrate.ateapi.v1 bindings in pkg/devbox/substrate/ateapi.
devbox/gateway/actors/actorstest
Package actorstest is an in-memory substrate.ateapi.v1.Control server for gateway tests.
Package actorstest is an in-memory substrate.ateapi.v1.Control server for gateway tests.
devbox/gateway/core
Package core is the devbox gateway proper (sections 4.6 to 4.6b): it serves devbox.v1.Gateway through the KAS tunnel, drives instance lifecycles on Substrate, forwards daemon events to console, proxies history reads to the box that holds the transcript, executes suspends and backstops, and resolves actors for the egress package.
Package core is the devbox gateway proper (sections 4.6 to 4.6b): it serves devbox.v1.Gateway through the KAS tunnel, drives instance lifecycles on Substrate, forwards daemon events to console, proxies history reads to the box that holds the transcript, executes suspends and backstops, and resolves actors for the egress package.
devbox/gateway/egress
Package egress is the egress, credentials and MCP half of devbox-gateway (sections 4.4, 4.5, 4.7, 4.8, 4.9, 4.10 and 4.11 of the DevBoxes plan).
Package egress is the egress, credentials and MCP half of devbox-gateway (sections 4.4, 4.5, 4.7, 4.8, 4.9, 4.10 and 4.11 of the DevBoxes plan).
devbox/gateway/egress/credproviderv1
Package credproviderv1 holds Go bindings for Agent Substrate's substrate.credprovider.v1 plugin API, generated from a verbatim copy of substrate's api/credprovider/v1/credprovider.proto.
Package credproviderv1 holds Go bindings for Agent Substrate's substrate.credprovider.v1 plugin API, generated from a verbatim copy of substrate's api/credprovider/v1/credprovider.proto.
devbox/gateway/egress/scmpath
Package scmpath ties SCM HTTP requests to the repository they act on, from the host, method and raw path only (the egress ext_proc sees headers, never bodies).
Package scmpath ties SCM HTTP requests to the repository they act on, from the host, method and raw path only (the egress ext_proc sees headers, never bodies).
devbox/gateway/prober
Package prober is the gateway half of the agent probe handoff (pkg/devbox/probe): it watches the operator's probe request ConfigMaps, runs each probe in an actor resumed from the revision's golden tag and writes the result back.
Package prober is the gateway half of the agent probe handoff (pkg/devbox/probe): it watches the operator's probe request ConfigMaps, runs each probe in an actor resumed from the revision's golden tag and writes the result back.
devbox/gateway/router
Package router reaches devbox daemons through Substrate's atenet-router: gRPC (devbox.v1.Daemon) and HTTP (terminal, VNC and preview WebSockets) over mTLS, with the target actor in the ate-target-actor header.
Package router reaches devbox daemons through Substrate's atenet-router: gRPC (devbox.v1.Daemon) and HTTP (terminal, VNC and preview WebSockets) over mTLS, with the target actor in the ate-target-actor header.
devbox/gateway/tunnel
Package tunnel connects the gateway to KAS (DBX-31): a gRPC connection over WebSocket to KAS's devbox listener, carrying Ingest calls up and a pool of devbox.v1.Tunnel reverse tunnels that KAS sends devbox.v1.Gateway calls down.
Package tunnel connects the gateway to KAS (DBX-31): a gRPC connection over WebSocket to KAS's devbox listener, carrying Ingest calls up and a pool of devbox.v1.Tunnel reverse tunnels that KAS sends devbox.v1.Gateway calls down.
devbox/probe
Package probe is the agent probe handoff between the deployment operator (internal/controller) and devbox-gateway (pkg/devbox/gateway/prober), section 4.2a of the DevBoxes plan.
Package probe is the agent probe handoff between the deployment operator (internal/controller) and devbox-gateway (pkg/devbox/gateway/prober), section 4.2a of the DevBoxes plan.
devbox/substrate
Package substrate is a thin client for the Agent Substrate control API (substrate.ateapi.v1.Control), used by the DevboxRunner controller and the devbox gateway.
Package substrate is a thin client for the Agent Substrate control API (substrate.ateapi.v1.Control), used by the DevboxRunner controller and the devbox gateway.
insightpriority
Package insightpriority evaluates the CustomInsightPriority scripts that override the built-in priority of failing objects in the cluster insights and the cluster health score.
Package insightpriority evaluates the CustomInsightPriority scripts that override the built-in priority of failing objects in the cluster insights and the cluster health score.
log
lua
python
Package python executes the user-provided Python used by Helm value templating.
Package python executes the user-provided Python used by Helm value templating.
scm

Jump to

Keyboard shortcuts

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