Documentation
¶
Overview ¶
Package config resolves the environment ate-setup installs into. It layers the developer's .ate-dev-env.sh (sourced through bash, so existing setups keep working), the ambient process environment, and command line flags into a single typed Config.
Index ¶
- Constants
- func RepoRoot() (string, error)
- type CloudSQLConfig
- type Config
- func (c *Config) EnsureClusterCredentials(ctx context.Context) error
- func (c *Config) KoEnv() []string
- func (c *Config) Manifest(parts ...string) string
- func (c *Config) Path(parts ...string) string
- func (c *Config) PostgresConnString() string
- func (c *Config) PostgresSchemaName() string
- func (c *Config) ScriptEnv() []string
- func (c *Config) Size10() bool
- func (c *Config) WaitTimeout(historical time.Duration) time.Duration
- type Options
Constants ¶
const ( RouterEnvoy = "envoy" RouterAgentgateway = "agentgateway" SandboxClassGvisor = "gvisor" SandboxClassMicrovm = "microvm" // Cluster size profiles. size0 is the shipped footprint; size10 assumes a // dedicated node for PostgreSQL and raises the store, its client pool, and // the podcertificate controller's API rate limits to match. ClusterSizeSize0 = "size0" ClusterSizeSize10 = "size10" )
Enumerated values for the install-shaping flags.
const ( CloudSQLIPTypePrivate = "private" CloudSQLIPTypePublic = "public" CloudSQLIPTypePSC = "psc" )
Cloud SQL Auth Proxy IP types, the values ATE_API_POSTGRES_CLOUDSQL_IP_TYPE accepts.
const DefaultPostgresConnectionString = "" /* 262-byte string literal not displayed */
DefaultPostgresConnectionString mirrors default_postgres_connection_string in the shell installer: the apiserver reaches PostgreSQL over mTLS using the podcertificate controller's projected servicedns trust bundle and its own podidentity credential bundle.
const DefaultPostgresSchema = "public"
DefaultPostgresSchema mirrors the shell installer's default for ATE_API_POSTGRES_SCHEMA, the PostgreSQL schema holding the Substrate tables.
const DefaultRolloutTimeout = 60 * time.Second
DefaultRolloutTimeout is the default wait timeout for workload rollouts.
const Size10PostgresPoolParams = "&pool_max_conns=64&pool_min_conns=4"
Size10PostgresPoolParams is appended to the default connection string on size10 clusters. pgxpool defaults MaxConns to max(4, runtime.NumCPU()), which under-uses the size10 server's raised max_connections; pinning the pool makes the client side open the sockets the server is provisioned for.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CloudSQLConfig ¶ added in v0.2.0
type CloudSQLConfig struct {
// Instance is the instance connection name, PROJECT:REGION:INSTANCE.
Instance string
// InstanceSet records whether ATE_API_POSTGRES_CLOUDSQL_INSTANCE was
// present in the environment at all, empty value included.
InstanceSet bool
// GSA is the Google service account the proxy authenticates as, and whose
// email (minus the .gserviceaccount.com suffix) is the IAM database user.
GSA string
// IAMAuth enables automatic IAM database authentication ("true" or
// "false"). Empty defaults to enabled.
IAMAuth string
// IPType selects which instance address the proxy dials: one of the
// CloudSQLIPType constants. Empty defaults to private.
IPType string
}
CloudSQLConfig is the operator's Cloud SQL intent, as expressed by the ATE_API_POSTGRES_CLOUDSQL_* variables.
Every field is empty-means-unspecified except Instance, which is three-way: a non-empty instance selects Cloud SQL, an explicitly empty one removes it, and an unset one (InstanceSet false) adopts whatever the target cluster already records. Without that distinction a redeploy from a shell that simply never exported the variable would tear the proxy sidecar out from under a working installation.
type Config ¶
type Config struct {
// Root is the repository root. All manifest paths are relative to it.
Root string
// Kind selects the local Kind install profile (ATE_INSTALL_KIND).
Kind bool
// Namespace is the namespace the control plane is installed into, from
// ATE_NAMESPACE. It defaults to the canonical installdefaults.SystemNamespace,
// so an install that does not set it is unaffected. The checked-in manifests
// under manifests/ate-install/ name that namespace literally, so the
// manifest-applying steps refuse any other value; see Env.RequireCanonicalNamespace.
Namespace string
// Kubeconfig and Context select the target cluster. Empty Context means
// "use the current context" (the KUBECTL_CONTEXT convention).
//
// Kubeconfig is a single file, handed to client-go as its explicit path. It
// falls back to $KUBECONFIG rather than staying empty so that ate-setup and
// the shell scripts it delegates to agree on the cluster — but only when
// that variable names one file. See loadKubeconfig.
Kubeconfig string
Context string
// GKE cluster coordinates, used to fetch credentials and to derive the
// service account JWT issuer.
ProjectID string
ClusterName string
ClusterLocation string
// ExpectedJWTIssuer is the service account token issuer ate-api-server
// trusts (EXPECTED_JWT_ISSUER). It overrides both the GKE derivation from
// the coordinates above and OpenID discovery, for clusters whose issuer
// follows neither form.
ExpectedJWTIssuer string
// BucketName is the snapshot bucket demos are templated with.
BucketName string
// KODockerRepo is where ko pushes images (KO_DOCKER_REPO).
KODockerRepo string
// KODefaultPlatforms constrains ko's build platforms.
KODefaultPlatforms string
// Images selects where container images come from. Its zero value builds
// them from source with ko, which is what a developer install does.
Images images.Source
// Router selects the atenet router dataplane.
Router string
// PostgresConnectionString is the apiserver's store connection string.
// Empty means use DefaultPostgresConnectionString.
PostgresConnectionString string
// PostgresSchema is the PostgreSQL schema for the Substrate tables
// (ATE_API_POSTGRES_SCHEMA). Empty means DefaultPostgresSchema.
PostgresSchema string
// PostgresPoolMaxConns sizes the apiserver's pgxpool
// (ATE_API_POSTGRES_POOL_MAX_CONNS). It is spliced into the DSN rather
// than passed separately, because that is the only place pgxpool reads it
// from. Empty leaves the pgxpool default in place.
PostgresPoolMaxConns string
// PostgresServerCAFile is a local PEM file holding the server CA of an
// external PostgreSQL (ATE_API_POSTGRES_SERVER_CA_FILE). Its contents are
// published as the postgres-server-ca Secret, which ate-api-server mounts
// at /run/postgres-server-ca/server-ca.pem for sslmode=verify-ca DSNs.
PostgresServerCAFile string
// CloudSQL points the apiserver at a Cloud SQL instance through the Auth
// Proxy sidecar instead of a directly reachable PostgreSQL.
CloudSQL CloudSQLConfig
// RolloutTimeout is the timeout duration for rollout status checks.
RolloutTimeout time.Duration
// PodcertWorkersPerSigner overrides WORKERS_PER_SIGNER on podcertificate-controller.
PodcertWorkersPerSigner int
// ClusterSize is the footprint profile (ATE_INSTALL_CLUSTER_SIZE): size0
// or size10.
ClusterSize string
// CordonControlPlane pins each control plane workload to its own node
// (ATE_INSTALL_CORDON_CONTROL_PLANE). It assumes a node pool labeled and
// tainted ate.dev/workloadType=ate-control-plane:NoSchedule with one node
// per pod plus a spare for rollout surges.
CordonControlPlane bool
// ExperimentalUseSDSMint enables per-SNI dynamic cert minting on atenet-egress.
ExperimentalUseSDSMint bool
// AdditionalEgressExtprocService is the optional NS/SVC:PORT external processor filter.
AdditionalEgressExtprocService string
// ExperimentalEgressCredentialInjection points the egress gateway's MITM-leg
// handler at a credential provider so a matching EgressPolicy rule injects its
// credential. CredentialProviderName/Address configure the provider.
ExperimentalEgressCredentialInjection bool
CredentialProviderName string
CredentialProviderAddress string
// AnthropicAPIKey is required only by the claude-code-multiplex demo.
AnthropicAPIKey string
// OtlpEndpoint is where the control plane ships telemetry
// (ATE_OTLP_ENDPOINT). Benchmark actors are pointed at it too.
OtlpEndpoint string
// BenchmarkActorMemory is the memory limit for benchmark actors
// (BENCHMARK_ACTOR_MEMORY). Empty leaves the workload default in place.
BenchmarkActorMemory string
// contains filtered or unexported fields
}
Config is the fully resolved installation environment. Fields sourced from the developer environment keep their shell names in the comments so the mapping back to .ate-dev-env.sh stays obvious.
func Load ¶
Load resolves the effective configuration. Precedence, lowest to highest: .ate-dev-env.sh, the process environment, then flags.
func (*Config) EnsureClusterCredentials ¶
EnsureClusterCredentials fetches GKE credentials when the configuration names a project but no explicit context.
This reproduces the prologue of the shell installer: a developer whose .ate-dev-env.sh sets PROJECT_ID gets their kubeconfig populated before anything talks to the cluster. Setting a context (or KUBECTL_CONTEXT) is taken as "I already have credentials" and skips the call, as it did there.
func (*Config) PostgresConnString ¶
PostgresConnString returns the configured connection string, falling back to the in-cluster default. On a size10 cluster the default also pins the client pool to what the bundled server is provisioned for; an explicit connection string is passed through untouched, since its database was sized by whoever wrote it.
func (*Config) PostgresSchemaName ¶
PostgresSchemaName returns the configured schema, falling back to the shell installer's default. ate-api-server rejects an empty value.
func (*Config) ScriptEnv ¶
ScriptEnv returns the environment for the shell scripts ate-setup still delegates to (the benchmark and micro-VM helpers).
Those scripts read the same variables the shell installer exported to them, so this reproduces that environment: .ate-dev-env.sh under the process environment, with the resolved configuration layered on top so that flags such as --context and --kind reach them.
func (*Config) Size10 ¶ added in v0.2.0
Size10 reports whether the size10 footprint profile is selected.
func (*Config) WaitTimeout ¶
WaitTimeout returns how long to wait for a workload whose historical timeout was historical.
The shell installer applied --rollout-timeout to the ate-system rollouts only; the podcertificate-controller wait and the CSI driver waits were fixed at 120s because they are the slow bootstrap paths — an image pull on a cold cluster, in the CSI case a driver being torn down and reinstalled. Honoring the flag everywhere would let its 60s default halve exactly those waits.
So the flag now reaches every wait, but only when someone asked for it. Left alone, each site keeps the timeout the scripts gave it.
type Options ¶
type Options struct {
Kind bool
Kubeconfig string
Context string
Router string
RolloutTimeout string
PodcertWorkersPerSigner int
ClusterSize string
CordonControlPlane bool
ExperimentalUseSDSMint bool
AdditionalEgressExtprocService string
ExperimentalEgressCredentialInjection bool
CredentialProviderName string
CredentialProviderAddress string
OtlpEndpoint string
// Image source selection.
ImageRepo string
ImageTag string
// NoDevEnv skips sourcing .ate-dev-env.sh even when it exists.
NoDevEnv bool
}
Options carries the raw flag values the root command collects, before defaulting and validation.