Documentation
¶
Overview ¶
Package steps holds the install and teardown operations that the shell installer implemented as bash functions. Each exported function corresponds to one of those and keeps its name in the [step] log line.
Index ¶
- Constants
- func ActorTemplateFromManifest(manifest []byte) (*ateapi.ActorTemplate, error)
- func CreateActorTemplate(ctx context.Context, client *ateclient.Client, template *ateapi.ActorTemplate) error
- func EnsureAtespace(ctx context.Context, client *ateclient.Client, atespace string) error
- func SystemOverlay(cfg *config.Config) string
- func ValidateCSIDriver(driver string) error
- func WaitActorTemplateGolden(ctx context.Context, client *ateclient.Client, ref resources.ActorTemplateRef, ...) error
- type BenchmarkOptions
- type Deleter
- type DeployOptions
- type Env
- func (e *Env) AteClient(ctx context.Context) (*ateclient.Client, error)
- func (e *Env) CheckCSIDriver(driver string) error
- func (e *Env) CreateAPIAuthenticationConfig(ctx context.Context) error
- func (e *Env) CreateAPIConfig(ctx context.Context) error
- func (e *Env) CreateAPIServerEnvVars(ctx context.Context) error
- func (e *Env) CreateActorIDCACertsSecret(ctx context.Context) error
- func (e *Env) CreateActorIDCAPoolSecret(ctx context.Context) error
- func (e *Env) CreateEgressMITMCAPoolSecret(ctx context.Context) error
- func (e *Env) CreateJWTAuthorityPoolSecret(ctx context.Context) error
- func (e *Env) CreatePodCertificateControllerCAs(ctx context.Context) error
- func (e *Env) DeleteAll(ctx context.Context, demos []Deleter) error
- func (e *Env) DeleteAteSystem(ctx context.Context) error
- func (e *Env) DeleteAtenet(ctx context.Context) error
- func (e *Env) DeleteBenchmarks(ctx context.Context, opts BenchmarkOptions) error
- func (e *Env) DeleteSubstrateDemo(ctx context.Context, refs []resources.ActorTemplateRef, atespaces []string) error
- func (e *Env) DeleteTrustBundles(ctx context.Context) error
- func (e *Env) DeployAteAPIServer(ctx context.Context) error
- func (e *Env) DeployAteController(ctx context.Context) error
- func (e *Env) DeployAteSystem(ctx context.Context, opts DeployOptions) error
- func (e *Env) DeployAtelet(ctx context.Context) error
- func (e *Env) DeployAtenet(ctx context.Context) error
- func (e *Env) DeployBenchmarks(ctx context.Context, opts BenchmarkOptions) error
- func (e *Env) DeployCRDs(ctx context.Context) error
- func (e *Env) DeployPodCertificateController(ctx context.Context) error
- func (e *Env) DeployPostgres(ctx context.Context) error
- func (e *Env) DeploySandboxConfig(ctx context.Context) error
- func (e *Env) EnsureAPIServerPrerequisites(ctx context.Context) error
- func (e *Env) EnsureAteSystemNamespace(ctx context.Context) error
- func (e *Env) EnsureCRDs(ctx context.Context) error
- func (e *Env) EnsureEgressMITMCAPoolSecret(ctx context.Context) error
- func (e *Env) EnsureEnvVarsSafeStandalone(ctx context.Context) error
- func (e *Env) EnsurePodCertificateCAs(ctx context.Context) error
- func (e *Env) Kustomize(overlay string) ([]byte, error)
- func (e *Env) Namespace() string
- func (e *Env) PublishReleaseBinaries(ctx context.Context, w io.Writer, outDir string) error
- func (e *Env) PublishReleaseImages(ctx context.Context, w io.Writer, opts PublishReleaseOptions) error
- func (e *Env) PublishWorkerImages(ctx context.Context, w io.Writer) error
- func (e *Env) RequireCanonicalNamespace(step string) error
- func (e *Env) RequireControlPlane(ctx context.Context) error
- func (e *Env) RequireKind(what string) error
- func (e *Env) ResolveAndApply(ctx context.Context, path string) error
- func (e *Env) ResolveAndApplyBytes(ctx context.Context, manifest []byte) error
- func (e *Env) ResolveManifest(ctx context.Context, path string) ([]byte, error)
- func (e *Env) ResolveManifestBytes(ctx context.Context, manifest []byte) ([]byte, error)
- func (e *Env) SetupCSI(ctx context.Context, driver string) error
- func (e *Env) SubstrateVersion() string
- func (e *Env) UpdateAPIServerEnvVars(ctx context.Context) error
- func (e *Env) WaitForPodCertificateTrustBundles(ctx context.Context) error
- type PublishReleaseOptions
- type TemplateRef
Constants ¶
const ( SecretActorIDJWTPool = "actor-id-jwt-pool" SecretActorIDCAPool = "actor-id-ca-pool" SecretActorIDCACerts = "actor-id-ca-certs" SecretServiceDNSCA = "service-dns-ca-pool" SecretPodIdentityCA = "pod-identity-ca-pool" SecretPostgresCA = "postgres-ca-pool" SecretEgressMITMCAPool = "egress-mitm-ca-pool" SecretAPIEnvVars = "ate-api-server-secret-envvars" SecretPostgresServerCA = "postgres-server-ca" ConfigMapAPIEnvVars = "ate-api-server-envvars" ConfigMapAPIAuthn = "ate-api-authentication" ConfigMapAPIConfig = "ate-api-config" )
Secret and ConfigMap names the control plane reads.
const ( NamespaceTimeout = 60 * time.Second // BootstrapTimeout covers the waits the scripts fixed at 120s rather than // deriving from --rollout-timeout: the podcertificate controller and the // CSI drivers. Pass it through Config.WaitTimeout, which lets the flag // raise it without its shorter default lowering it. BootstrapTimeout = 120 * time.Second // TrustBundleTimeout bounds the wait for the podcertificate controller's // first ClusterTrustBundles, shared across both bundles. The controller is // Ready before it has signed anything, so this covers its first pass over // the CA pools rather than a rollout. Config.WaitTimeout applies here too. TrustBundleTimeout = 300 * time.Second // DemoTimeout is longer because a cold cluster pays one-time costs on the // first ActorTemplate: downloading runsc, the first gVisor pod start, and // image pulls. DemoTimeout = 300 * time.Second )
Timeouts carried over from the --timeout values in the shell installer.
const ( // NamespaceAteSystem is the canonical control-plane namespace. It is the // default for Config.Namespace and the only value the checked-in manifests // under manifests/ate-install/ carry; steps address the installed control // plane through Env.Namespace rather than this constant. NamespaceAteSystem = "ate-system" NamespacePodCert = "podcertificate-controller-system" )
Well-known namespaces.
Variables ¶
This section is empty.
Functions ¶
func ActorTemplateFromManifest ¶
func ActorTemplateFromManifest(manifest []byte) (*ateapi.ActorTemplate, error)
ActorTemplateFromManifest parses a single protojson-shaped YAML or JSON document into an ActorTemplate, as `kubectl ate create actor-template` does. Parsing is strict: unknown fields are an error, so typos don't silently drop configuration.
func CreateActorTemplate ¶
func CreateActorTemplate(ctx context.Context, client *ateclient.Client, template *ateapi.ActorTemplate) error
CreateActorTemplate creates the template through the ate API. Actor templates are immutable (no update RPC), so an existing template is left in place: delete the demo and redeploy to change it.
func EnsureAtespace ¶
EnsureAtespace creates the atespace if it does not already exist. The store enforces that an ActorTemplate's atespace exists at create time.
func SystemOverlay ¶
SystemOverlay picks the kustomization for a full control plane install.
The choice is a product of two switches: kind vs GKE, and the atenet router dataplane. The plain GKE envoy install renders the base kustomization rather than the raw manifests/ate-install directory: the directory would also re-apply pod-certificate-controller.yaml (reverting the size10 flags and the WORKERS_PER_SIGNER value set earlier in the install), both atenet-egress variants, and the sandboxconfig files, all of which have their own apply steps.
func ValidateCSIDriver ¶
ValidateCSIDriver reports whether driver names something --setup-csi accepts.
This is the half of the check that needs neither configuration nor a cluster, so the commands run it while cobra is still validating arguments: a typo should not cost a credential fetch, let alone an install.
func WaitActorTemplateGolden ¶
func WaitActorTemplateGolden(ctx context.Context, client *ateclient.Client, ref resources.ActorTemplateRef, timeout time.Duration) error
WaitActorTemplateGolden blocks until the template's golden snapshot is built. It fails fast when the template reconciler reports an error, and returns immediately for a template that opted out of the golden snapshot.
Types ¶
type BenchmarkOptions ¶
type BenchmarkOptions struct {
// WorkerCount is the number of WorkerPool replicas.
WorkerCount int
// SandboxClass is the sandbox runtime: gvisor or microvm.
SandboxClass string
}
BenchmarkOptions shapes the benchmark WorkerPool.
func (BenchmarkOptions) Validate ¶
func (o BenchmarkOptions) Validate() error
Validate is a precondition on the exported benchmark methods. The commands check the same two settings first and report which channel supplied a bad value; these messages name the field, because a caller that reaches them built the options itself and has no channel to be sent to.
type Deleter ¶
Deleter is the demo teardown DeleteAll drives.
The demos live in their own packages, which import this one for Env, so the interface is declared here rather than imported from there.
type DeployOptions ¶
type DeployOptions struct {
// SetupCSI additionally installs the CSI driver (nfs, hostpath, both, none).
// Kind only. The hostpath driver is Kind only.
SetupCSI string
}
DeployOptions carries the per-invocation choices for DeployAteSystem.
func (DeployOptions) Validate ¶
func (o DeployOptions) Validate() error
Validate checks the options that can be checked without configuration or a cluster, so the command can reject them while cobra is still parsing.
type Env ¶
Env is the shared execution context for every step: resolved configuration plus the clients needed to act on the cluster.
func NewLocalEnv ¶ added in v1.0.0
NewLocalEnv returns an Env with no Kubernetes client, for the publish commands, which build images and binaries without a cluster. Kube is nil, so a step that uses it must not run under such an Env.
func (*Env) AteClient ¶
AteClient connects to the ate-api-server, port-forwarding if needed. It opts in to preview features if the install enables any.
func (*Env) CheckCSIDriver ¶
CheckCSIDriver is ValidateCSIDriver plus the part that needs the resolved configuration: the hostpath driver exists only for Kind.
DeployAteSystem calls it before it installs anything, so that `--setup-csi=hostpath` against a cluster that is not Kind is refused up front rather than after a full control-plane install.
func (*Env) CreateAPIAuthenticationConfig ¶
CreateAPIAuthenticationConfig writes the default ate-api-server authentication config, pointing it at the cluster's service account issuer.
func (*Env) CreateAPIConfig ¶
CreateAPIConfig writes the ate-api-server config file.
func (*Env) CreateAPIServerEnvVars ¶
CreateAPIServerEnvVars reconciles how ate-api-server reaches its PostgreSQL store: both DSNs and the schema into the ate-api-server-secret-envvars Secret, stable roles and Cloud SQL settings into the ConfigMap, and an external server CA into postgres-server-ca. The ConfigMap also carries the actor JWT issuer and the snapshot location.
ate-api-server.yaml pulls both in through optional envFrom sources and resolves the PostgreSQL connection, role, and schema flags from the result. It lists the secretRef last, so the Secret wins over a DSN a previous installer left in the ConfigMap.
It does not restart ate-api-server. A deploy stamps the new digest into the Deployment it applies; UpdateAPIServerEnvVars patches it for a run that applies no Deployment.
func (*Env) CreateActorIDCACertsSecret ¶
CreateActorIDCACertsSecret derives a certificate-only trust bundle from the actor-identity CA pool.
The egress gateway verifies actor client certificates and so needs the root, but actor-id-ca-pool also holds the CA signing key. This publishes just the root.
func (*Env) CreateActorIDCAPoolSecret ¶
CreateActorIDCAPoolSecret generates the actor-identity CA pool. External relying parties trust this root, so it uses ECDSA P-256, which is more broadly accepted than Ed25519.
func (*Env) CreateEgressMITMCAPoolSecret ¶
CreateEgressMITMCAPoolSecret generates the egress MITM CA pool.
func (*Env) CreateJWTAuthorityPoolSecret ¶
CreateJWTAuthorityPoolSecret generates the actor-identity JWT signing pool. An existing pool is kept, and its "jwks" key is brought in step with it. This is the make-jwt-pool call create_jwt_authority_pool_secret shelled out to kubectl-ate for.
func (*Env) CreatePodCertificateControllerCAs ¶
CreatePodCertificateControllerCAs generates the signer pools the podcertificate controller issues from.
func (*Env) DeleteAll ¶
DeleteAll removes every demo, then the microvm SandboxConfig, then the control plane.
func (*Env) DeleteAteSystem ¶
DeleteAteSystem removes the control plane.
PostgreSQL, the agentgateway ConfigMap, the bundled credential provider, fake-workersync, and the CRDs are deleted explicitly because they are not part of every rendered bundle: which of them the install created depends on the router, credential provider, and data plane that were selected, and teardown must not depend on remembering that. The provider goes first so that a later failure cannot leave its ClusterRole and binding behind. The cluster-scoped trust bundles go last, once the controllers that publish them are gone.
func (*Env) DeleteAtenet ¶
DeleteAtenet removes the atenet dataplane and the bundled credential provider, deleting the provider first so that a later failure cannot leave its ClusterRole and binding behind. The provider's policy ConfigMap stays: it holds the operator's allow-list.
func (*Env) DeleteBenchmarks ¶
func (e *Env) DeleteBenchmarks(ctx context.Context, opts BenchmarkOptions) error
DeleteBenchmarks removes the locust stack and the benchmark workloads.
func (*Env) DeleteSubstrateDemo ¶
func (e *Env) DeleteSubstrateDemo(ctx context.Context, refs []resources.ActorTemplateRef, atespaces []string) error
DeleteSubstrateDemo removes a substrate demo's control-plane resources: every actor created from the given templates, then the templates (which server-side also removes their golden actors and snapshots), then the atespaces. A cluster without a reachable ate-api-server is not an error -- there is nothing to clean up.
func (*Env) DeleteTrustBundles ¶
DeleteTrustBundles deletes the ClusterTrustBundles in substrateTrustBundles. They are cluster-scoped, so deleting the namespaces of the controllers that publish them leaves them behind.
A bundle is deleted only when both its name and its signer match. Anyone allowed to attest for one of these signers may publish a bundle under a different name, so the signer alone does not show that Substrate created it.
func (*Env) DeployAteAPIServer ¶
DeployAteAPIServer redeploys ate-api-server and ate-idp-server.
func (*Env) DeployAteController ¶
DeployAteController redeploys only ate-controller.
func (*Env) DeployAteSystem ¶
func (e *Env) DeployAteSystem(ctx context.Context, opts DeployOptions) error
DeployAteSystem installs the whole control plane: CRDs, RBAC, the podcertificate controller, the store, ateapi, the controller, atenet, and atelet.
func (*Env) DeployAtelet ¶
DeployAtelet redeploys only the atelet DaemonSet.
func (*Env) DeployAtenet ¶
DeployAtenet redeploys the atenet dataplane: router and egress.
func (*Env) DeployBenchmarks ¶
func (e *Env) DeployBenchmarks(ctx context.Context, opts BenchmarkOptions) error
DeployBenchmarks installs the benchmark workloads and the locust load test stack.
func (*Env) DeployCRDs ¶
DeployCRDs applies the generated CRDs and RBAC, waiting for them to reach Established condition.
func (*Env) DeployPodCertificateController ¶
DeployPodCertificateController creates any missing signer CA pools, applies the podcertificate controller, and waits until it is rolling and has published its trust bundles.
size10 clusters render the podcert-size10 overlay instead of the base file. It appends --kube-api-qps=100 / --kube-api-burst=200 so the controller keeps up with the request volume the size10 postgres profile enables. An overlay rather than a post-apply patch, so that no later apply of the base file can reconcile the flags away; the base kustomization leaves the file out for the same reason.
--podcert-workers-per-signer is set on the rendered objects for the same reason: one apply means one rollout, and the rollout wait sees the pod that will actually serve.
func (*Env) DeployPostgres ¶
DeployPostgres deploys the experimental single-replica PostgreSQL StatefulSet on its own.
func (*Env) DeploySandboxConfig ¶
DeploySandboxConfig applies the SandboxConfig admission policy, then the default gVisor SandboxConfig.
func (*Env) EnsureAPIServerPrerequisites ¶
EnsureAPIServerPrerequisites creates the secrets and config ate-api-server needs, skipping anything already present. The PostgreSQL settings and an explicitly requested log level are rewritten every time.
func (*Env) EnsureAteSystemNamespace ¶
EnsureAteSystemNamespace creates the control-plane namespace and waits for it to go Active. Every deploy path starts here so that RBAC, ConfigMaps, and workloads have somewhere to land.
The canonical namespace comes from the checked-in manifest, which carries labels of its own and stays the source of truth for it. Any other namespace is created plainly, because that manifest names ate-system literally.
func (*Env) EnsureCRDs ¶
EnsureCRDs creates the generated CRDs that are missing. Existing CRDs and RBAC change only through DeployCRDs, so a component redeploy cannot move them.
func (*Env) EnsureEgressMITMCAPoolSecret ¶
EnsureEgressMITMCAPoolSecret creates the egress MITM CA pool secret. Both dataplanes need it: the agentgateway-egress overlay mounts the same Secret the envoy egress does.
func (*Env) EnsureEnvVarsSafeStandalone ¶
EnsureEnvVarsSafeStandalone guards `ate-setup create api-server-env-vars` on a cluster installed before the DSN moved from the ConfigMap to the Secret. Rewriting the environment alone would prune the ConfigMap key and leave the running Deployment without a DSN on its next restart. A full deploy is safe because it updates the Deployment in the same run.
func (*Env) EnsurePodCertificateCAs ¶
EnsurePodCertificateCAs creates the podcertificate signer pools if any is missing.
func (*Env) Namespace ¶
Namespace is the namespace the control plane is installed into. It is Config.Namespace, which defaults to NamespaceAteSystem.
func (*Env) PublishReleaseBinaries ¶ added in v1.0.0
PublishReleaseBinaries builds kubectl-ate for every releaseBinaryPlatforms entry into outDir, statically (CGO_ENABLED=0) and stamped with the release version, commit, and commit time, and writes beside each binary a .sha256 file that `shasum -a 256 -c` checks. It writes the paths it produced to w. The version has to be a release tag, and the checkout has to have a commit, since a binary without one reports the wrong version.
func (*Env) PublishReleaseImages ¶
func (e *Env) PublishReleaseImages(ctx context.Context, w io.Writer, opts PublishReleaseOptions) error
PublishReleaseImages builds and pushes every image a release publishes, the ko images in images.ReleaseComponents and the images.ReleaseDockerfileImages built with docker buildx, all tagged with the build version, and writes their pushed references to w. The version has to be a release tag.
If the registry already holds every image for the tag on every platform, nothing is built unless opts.Overwrite is set, so rerunning a release never replaces published digests by accident. An incomplete set, left by a failed run, is rebuilt in full. After pushing, every tag is checked to name the digest just pushed, on every platform.
func (*Env) PublishWorkerImages ¶
PublishWorkerImages builds and pushes the worker images for this build and writes their pushed references to w, one "<binary>: <ref>" line per image, after every build has finished so the refs sit together below ko's build output. A WorkerPool moves to this build by pointing its workerImage at the ref.
func (*Env) RequireCanonicalNamespace ¶
RequireCanonicalNamespace refuses a relocated install for the steps that apply the checked-in manifests. Those manifests name ate-system literally, so proceeding would put the workloads there while this tool created their secrets and ConfigMaps somewhere else — an install that comes up far enough to look healthy and then fails on a missing envFrom source.
func (*Env) RequireControlPlane ¶
RequireControlPlane refuses workload installs before they create resources that only ate-controller can reconcile into Deployments.
func (*Env) RequireKind ¶
RequireKind fails a step that only makes sense on a local Kind cluster.
func (*Env) ResolveAndApply ¶
ResolveAndApply resolves the images in a manifest path and applies the result. This is the run_ko apply of the shell scripts, split into its two real steps.
func (*Env) ResolveAndApplyBytes ¶
ResolveAndApplyBytes resolves an in-memory manifest and applies the result.
func (*Env) ResolveManifest ¶
ResolveManifest turns the ko:// references in a manifest path into pullable image references.
func (*Env) ResolveManifestBytes ¶
ResolveManifestBytes resolves an in-memory manifest, such as kustomize output. Every manifest that deploys a substrate component passes through here, so this is also where each component gets its --preview argument.
func (*Env) SetupCSI ¶
SetupCSI installs the hostpath and NFS CSI drivers used by external volume demos. The hostpath driver is Kind only: it is patched for the single-node Kind layout and reaches into the node container over docker.
func (*Env) SubstrateVersion ¶
SubstrateVersion returns the build version, the same one ko stamps into the binaries.
With --image-repo nothing is built, so `git describe` would report the checkout rather than the images being installed. The image tag is the version in that case. VERSION still wins over both.
func (*Env) UpdateAPIServerEnvVars ¶
UpdateAPIServerEnvVars is CreateAPIServerEnvVars for an install that is not being redeployed: it also stamps the new digest on the running Deployment, which rolls ate-api-server onto the new values.
type PublishReleaseOptions ¶ added in v1.0.0
type PublishReleaseOptions struct {
// Overwrite rebuilds and replaces images the registry already holds for
// the tag. Without it, a complete set is left alone.
Overwrite bool
}
PublishReleaseOptions are the publish release-images settings.
type TemplateRef ¶
type TemplateRef struct {
// Atespace the object lives in. The demos name each atespace after the
// k8s namespace holding its worker pool, so this field also addresses
// the namespaced objects a demo waits on, such as pool Deployments.
Atespace string
Name string
}
TemplateRef identifies a demo's ActorTemplate. Actors are deleted by matching against it because the demo manifests own the template, not the actors that were created from it.