Documentation
¶
Overview ¶
Package config loads and validates reconD workload configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Log is optional and controls reconD's process-level logging output.
Log Log `yaml:"log"`
// DeploymentRetry is optional and provides default retry behavior for every
// workload in this config. Workload-level deployment_retry fields override it.
DeploymentRetry DeploymentRetry `yaml:"deployment_retry"`
// Workloads is the required list of container workloads reconD should watch
// and reconcile. Configure one entry for each independently deployed
// service.
Workloads []Workload `yaml:"workloads"`
}
type DeploymentRetry ¶ added in v0.4.2
type DeploymentRetry struct {
// MaxRetryForwardDeployment is the total number of forward deployment
// attempts before rollback is considered. Defaults to 1.
MaxRetryForwardDeployment int `yaml:"max_retry_forward_deployment"`
// MaxRetryRollback is the total number of rollback attempts before the
// desired deployment is marked terminally failed. Defaults to 1.
MaxRetryRollback int `yaml:"max_retry_rollback"`
// InitialInterval is the first delay before retrying. Defaults to 1s.
InitialInterval Duration `yaml:"initial_interval"`
// MaxInterval caps exponential backoff delays. Defaults to 30s.
MaxInterval Duration `yaml:"max_interval"`
// Multiplier controls exponential backoff growth. Defaults to 2.
Multiplier float64 `yaml:"multiplier"`
}
type GitProvider ¶
type GitProvider struct {
// Owner is required and names the GitHub owner or organization containing
// the deployment metadata repository.
Owner string `yaml:"owner"`
// Repo is required and names the GitHub repository containing deployment
// metadata for this workload.
Repo string `yaml:"repo"`
// Token is optional and is used to authenticate GitHub API requests for
// private repositories. If omitted, reconD reads GITHUB_TOKEN from the
// process environment.
Token string `yaml:"token"`
}
type HealthCheck ¶
type HealthCheck struct {
// Type is optional. Leave it empty or set it to "none" to skip health
// checks; set it to "http" or "tcp" to poll URL after deployment.
Type HealthCheckType `yaml:"type"`
// URL is required when Type is "http" or "tcp" and ignored otherwise. Use
// an HTTP URL for HTTP checks or a tcp://host:port URL for TCP checks.
URL string `yaml:"url"`
// Retries is optional and defaults to 12. It controls how many health check
// attempts reconD makes before treating the deployment as unhealthy.
Retries int `yaml:"retries"`
// Interval is optional and defaults to 10s. It controls how long reconD waits
// between health check attempts.
Interval Duration `yaml:"interval"`
// Timeout is optional and defaults to 5s. It controls the per-attempt timeout
// for HTTP requests and TCP connections.
Timeout Duration `yaml:"timeout"`
}
type HealthCheckType ¶
type HealthCheckType string
const ( HealthCheckNone HealthCheckType = "none" HealthCheckHTTP HealthCheckType = "http" HealthCheckTCP HealthCheckType = "tcp" HealthCheckCommand HealthCheckType = "command" )
type Log ¶ added in v0.4.0
type Log struct {
// Format is optional and controls the log handler format. Set it to "text"
// for local development; any other value uses structured JSON output.
Format string `yaml:"format"`
// Level is optional and controls the minimum log level. Supported values are
// "debug", "info", "warn", and "error"; empty defaults to "info".
Level string `yaml:"level"`
}
type Strategy ¶
type Strategy struct {
// Type is optional. Leave it empty or set it to "none" to run no strategy;
// set it to "env_file" to write deployment metadata into an env file before
// DeployCommand runs.
Type StrategyType `yaml:"type"`
// EnvFilePath is required when Type is "env_file" and ignored otherwise. It
// points to the env file reconD should create or update.
EnvFilePath string `yaml:"env_file_path"`
// ImageTagKey is optional for the "env_file" strategy and defaults to
// "IMAGE_TAG". It is the key reconD writes with the selected image tag.
ImageTagKey string `yaml:"image_tag_key"`
}
type StrategyType ¶
type StrategyType string
const ( StrategyNone StrategyType = "none" StrategyEnvFile StrategyType = "env_file" )
type Workload ¶
type Workload struct {
// Name is required and identifies this workload in logs, notifications, and
// persisted deployment state.
Name string `yaml:"name"`
// ReleasePrefix is optional and scopes GitHub release selection by tag
// prefix. For example, "api-prod" matches release tags like
// "api-prod-sha-10a3e42". Leave it empty only when this repository publishes
// one deployable artifact stream or when the newest valid metadata release is
// always the desired workload.
ReleasePrefix string `yaml:"release_prefix"`
// ContainerName is required and must match the Docker container reconD
// inspects to determine the workload's current runtime state.
ContainerName string `yaml:"container_name"`
// NotificationURL is optional. When set, reconD sends deployment events to
// this Slack webhook URL; when empty, notifications are disabled.
NotificationURL string `yaml:"notification_url"`
// DeployCommand is required. reconD runs it with /bin/sh after applying the
// deployment strategy, passing workload and image metadata in WORKLOAD_*
// environment variables.
DeployCommand string `yaml:"deploy_command"`
// CheckInterval is optional and controls how often reconD checks for new
// deployment metadata. Values may be Go duration strings like "60s" or a
// number of seconds; values below 10s default to 60s.
CheckInterval Duration `yaml:"check_interval"`
// GitProvider is required and tells reconD which repository to read
// deployment metadata from.
GitProvider GitProvider `yaml:"git_provider"`
// HealthCheck is optional. When configured, reconD waits for the workload to
// become healthy after deploy and rollback commands; a failed check triggers
// rollback when previous state is available.
HealthCheck HealthCheck `yaml:"health_check"`
// Strategy is optional. Use it when deployment metadata must be written
// somewhere before DeployCommand runs, such as updating an env file with the
// image tag.
Strategy Strategy `yaml:"strategy"`
// DeploymentRetry bounds automatic deployment and rollback attempts for one
// desired deployment identity.
DeploymentRetry DeploymentRetry `yaml:"deployment_retry"`
// Labels is optional and scopes Docker image pruning to images with these
// labels after a successful deployment.
Labels map[string]string `yaml:"labels"`
}
Workload is a standalone unit of deployment (e.g., a container) reconD can watch and reconcile
Click to show internal directories.
Click to hide internal directories.