Documentation
¶
Overview ¶
Package serverlessoperator is the configuration of the hatchet-serverless-operator binary: the file struct its environment is bound onto and the validation of the values that must agree with each other. The loader package turns a validated file into the binary's dependencies (pkg/config/loader).
Index ¶
Constants ¶
const ( // TokenExchangeStatic serves the single tenant HATCHET_CLIENT_TOKEN belongs to. TokenExchangeStatic = "static" // TokenExchangeLocal serves the tenants listed in the file SERVERLESS_OPERATOR_TOKEN_FILE // names, reloaded when it changes. TokenExchangeLocal = "local" )
Token exchange modes, the values of SERVERLESS_OPERATOR_TOKEN_EXCHANGE. Each mode reads its own variable and refuses the other mode's, so a deployment cannot carry a token it does not mean to use.
Variables ¶
This section is empty.
Functions ¶
func BindAllEnv ¶
BindAllEnv maps SERVERLESS_OPERATOR_* onto the config, with the engine's names for the encryption keyset and the SDK's HATCHET_CLIENT_TOKEN for the static token exchange.
Types ¶
type ConfigFile ¶
type ConfigFile struct {
DatabaseUrl string `mapstructure:"databaseUrl"`
Encryption server.EncryptionConfigFile `mapstructure:"encryption"`
// TokenExchange selects the tenant token source: TokenExchangeStatic reads ClientToken,
// TokenExchangeLocal reads TokenFile. The other mode's variable must be unset.
TokenExchange string `mapstructure:"tokenExchange"`
TokenFile string `mapstructure:"tokenFile"`
ClientToken string `mapstructure:"clientToken"`
OperatorName string `mapstructure:"operatorName" default:"serverless"`
DefaultSlots int32 `mapstructure:"defaultSlots" default:"10000"`
DurableSlots int32 `mapstructure:"durableSlots" default:"10000"`
// EndpointPartitionCount is the endpoint_partition_count a tenant's v1_serverless_tenant row is
// created with; see serverlessoperator.Config.EndpointPartitionCount for what it governs and
// when a change applies.
EndpointPartitionCount int32 `mapstructure:"endpointPartitionCount" default:"1"`
LeaseTTL time.Duration `mapstructure:"leaseTtl" default:"15s"`
HeartbeatInterval time.Duration `mapstructure:"heartbeatInterval" default:"5s"`
RebalanceInterval time.Duration `mapstructure:"rebalanceInterval" default:"5s"`
ShedHysteresis float64 `mapstructure:"shedHysteresis" default:"0.2"`
DrainTimeout time.Duration `mapstructure:"drainTimeout" default:"60s"`
RoutingRefreshInterval time.Duration `mapstructure:"routingRefreshInterval" default:"10s"`
HealthcheckTimeout time.Duration `mapstructure:"healthcheckTimeout" default:"10s"`
HealthcheckConcurrency int `mapstructure:"healthcheckConcurrency" default:"256"`
HealthcheckTenantConcurrency int `mapstructure:"healthcheckTenantConcurrency" default:"32"`
HealthcheckApplyTimeout time.Duration `mapstructure:"healthcheckApplyTimeout" default:"60s"`
MaxWorkflowsPerEndpoint int `mapstructure:"maxWorkflowsPerEndpoint" default:"200"`
MaxActionsPerEndpoint int `mapstructure:"maxActionsPerEndpoint" default:"500"`
MaintenanceConcurrency int `mapstructure:"maintenanceConcurrency" default:"8"`
LeaseMaxClaimPerTick int32 `mapstructure:"leaseMaxClaimPerTick" default:"1024"`
WSMaxFrameBytes int64 `mapstructure:"wsMaxFrameBytes" default:"4194304"`
WSPingInterval time.Duration `mapstructure:"wsPingInterval" default:"15s"`
// Relay resource limits.
WSMaxUpgradeHeaderBytes int64 `mapstructure:"wsMaxUpgradeHeaderBytes" default:"65536"`
WSMaxQueuedBytes int64 `mapstructure:"wsMaxQueuedBytes" default:"16777216"`
WSMaxStreams int `mapstructure:"wsMaxStreams" default:"16"`
WSMaxRunsPerStream int `mapstructure:"wsMaxRunsPerStream" default:"1024"`
// Outbound HTTP idle connection pool.
HTTPMaxIdleConns int `mapstructure:"httpMaxIdleConns" default:"256"`
HTTPMaxIdleConnsPerHost int `mapstructure:"httpMaxIdleConnsPerHost" default:"4"`
HTTPIdleConnTimeout time.Duration `mapstructure:"httpIdleConnTimeout" default:"90s"`
// InfraBlockedCIDRs is a comma-separated list of CIDRs added to safeclient's denylist.
InfraBlockedCIDRs string `mapstructure:"infraBlockedCidrs"`
AllowEmptyInfraCIDRs bool `mapstructure:"allowEmptyInfraCidrs"`
InsecureDestinations bool `mapstructure:"insecureDestinations"`
HealthPort int `mapstructure:"healthPort" default:"8080"`
Logger shared.LoggerConfigFile `mapstructure:"logger"`
OTel shared.OpenTelemetryConfigFile `mapstructure:"otel"`
}
ConfigFile is the binary's environment, bound by BindAllEnv. Durations accept Go syntax (5s).
func (*ConfigFile) CoreConfig ¶
func (cf *ConfigFile) CoreConfig() serverlessoperator.Config
CoreConfig maps the file onto the operator core's Config. The link name is the gRPC host's; the health port is the binary's own server.
func (*ConfigFile) InfraBlockedCIDRList ¶
func (cf *ConfigFile) InfraBlockedCIDRList() []string
InfraBlockedCIDRList splits the comma-separated InfraBlockedCIDRs, dropping blanks.
func (*ConfigFile) TokenExchangeMode ¶
func (cf *ConfigFile) TokenExchangeMode() string
TokenExchangeMode is the normalized token exchange mode.
func (*ConfigFile) Validate ¶
func (cf *ConfigFile) Validate() error
Validate checks the values that must be present or agree with each other: the database URL, the token exchange mode with its variable and without the other mode's, and the partition count bounds. Everything else has a default.