Documentation
¶
Overview ¶
Package config provides configuration types for the WorkflowExecution controller.
Configuration Structure (ADR-030):
- ExecutionConfig: PipelineRun execution settings (namespace, cooldown)
- (BackoffConfig removed in V1.0 per DD-RO-002 Phase 3)
- DataStorageConfig: Data Storage connectivity (BR-WE-005, ADR-030)
- ControllerConfig: Controller runtime settings (metrics, health probes, leader election)
All configuration values are validated via Config.Validate() before use.
See: docs/architecture/decisions/ADR-030-service-configuration-management.md
Index ¶
Constants ¶
const DefaultConfigPath = "/etc/workflowexecution/config.yaml"
DefaultConfigPath is the standard Kubernetes ConfigMap mount path for this service. ADR-030: All services MUST use /etc/{service}/config.yaml as the default.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnsibleConfig ¶
type AnsibleConfig struct {
APIURL string `yaml:"apiURL" validate:"required,url"`
TokenSecretRef *SecretKeyRef `yaml:"tokenSecretRef,omitempty"`
Insecure bool `yaml:"insecure,omitempty"`
OrganizationID int `yaml:"organizationID,omitempty"`
}
AnsibleConfig holds AWX/AAP connectivity settings (BR-WE-015). Optional: if nil, the ansible executor is not registered.
type Config ¶
type Config struct {
Execution ExecutionConfig `yaml:"execution" validate:"required"`
Ansible *AnsibleConfig `yaml:"ansible,omitempty"`
DataStorage sharedconfig.DataStorageConfig `yaml:"datastorage"`
Controller ControllerConfig `yaml:"controller" validate:"required"`
}
Config holds the complete configuration for the WorkflowExecution controller. Issue #99: BackoffConfig removed (DD-RO-002 Phase 3 -- RO handles all routing/backoff)
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default WorkflowExecution controller configuration.
Defaults align with: - DD-WE-001: 5-minute cooldown period - DD-WE-002: kubernaut-workflows namespace - DD-WE-004: 1-minute base cooldown, 10-minute max, 5 max failures - DD-005: :9090 metrics, :8081 health probes
func LoadFromFile ¶
LoadFromFile loads configuration from a YAML file with defaults. ADR-030: Service Configuration Management pattern. Graceful degradation: Falls back to defaults if file not found or invalid.
func (*Config) Validate ¶
Validate checks if the configuration is valid.
Validation Rules: - Execution namespace must not be empty - Cooldown periods must be positive - (Backoff validation removed in V1.0 per DD-RO-002 Phase 3) - Data Storage URL must not be empty
Returns error if validation fails. Validate validates the complete configuration using go-playground/validator (ADR-046).
Validation rules enforce business requirements and design decisions via struct tags: - BR-WE-003: Execution namespace must be set (`validate:"required"`) - BR-WE-007: Service account must be specified (`validate:"required"`) - DD-WE-001: Cooldown period must be positive (`validate:"gt=0"`) - (DD-WE-004: Backoff validation removed in V1.0 per DD-RO-002 Phase 3) - BR-WE-005, ADR-032: Audit configuration must be complete (`validate:"required,url"`) - DD-005: Controller observability settings must be present (`validate:"required"`)
See: docs/architecture/decisions/ADR-046-struct-validation-standard.md
Returns validator.ValidationErrors if validation fails.
type ControllerConfig ¶
type ControllerConfig struct {
// MetricsAddr is the address for Prometheus metrics endpoint
MetricsAddr string `yaml:"metricsAddr" validate:"required"`
// HealthProbeAddr is the address for health and readiness probes
HealthProbeAddr string `yaml:"healthProbeAddr" validate:"required"`
// LeaderElection enables leader election for multi-replica deployments
LeaderElection bool `yaml:"leaderElection"`
// LeaderElectionID is the unique ID for leader election
LeaderElectionID string `yaml:"leaderElectionId" validate:"required"`
}
ControllerConfig holds controller runtime settings.
Standard controller configuration following DD-005 (Observability Standards).
type ExecutionConfig ¶
type ExecutionConfig struct {
// Namespace where PipelineRuns are created (DD-WE-002)
Namespace string `yaml:"namespace" validate:"required"`
// CooldownPeriod prevents redundant sequential workflows (DD-WE-001)
CooldownPeriod time.Duration `yaml:"cooldownPeriod" validate:"required,gt=0"`
}
ExecutionConfig holds settings for PipelineRun / Job execution.
Business Requirements: - BR-WE-003: Execution namespace isolation (DD-WE-002) - DD-WE-001: Cooldown period for resource locking Note: ServiceAccount is per-workflow (DD-WE-005 v2.0), not in operator config.
type SecretKeyRef ¶
type SecretKeyRef struct {
Name string `yaml:"name" validate:"required"`
Namespace string `yaml:"namespace,omitempty"`
Key string `yaml:"key" validate:"required"`
}
SecretKeyRef references a key within a Kubernetes Secret.