Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance struct {
Name string
Namespace string
Definition apps.Definition
Settings map[string]interface{}
}
type Operator ¶
type Operator struct {
// contains filtered or unexported fields
}
func New ¶
func New(moduleManager moduleManager, dc dependency.Container, logger *log.Logger) (*Operator, error)
New creates and initializes a new Operator instance with all subsystems.
Initialization order is important:
- Queue and schedule services (independent)
- NELM service (requires its own client and cache)
- Object patcher (for hook-driven resource modifications)
- Kubernetes events manager (watches cluster resources)
- Package manager (depends on all above services)
- Event handler (coordinates everything, starts immediately)
Each Kubernetes integration gets its own client with specific rate limits:
- Object patcher: Higher QPS for batch patching operations
- Kube events: Standard QPS for resource watching
- NELM monitor: Tuned QPS for Helm resource monitoring
The event handler starts immediately to begin processing events.
func (*Operator) Dump ¶
Dump returns a YAML snapshot of all packages and their current state.
Includes for each package:
- Status: Current phase (Pending/Loaded/Running)
- State: Scheduler state (enabled/disabled with reason)
- Info: Instance name and namespace, current package configuration values and hooks
Used for debugging and introspection of operator internal state. Skips packages that have been removed from the manager.
func (*Operator) Remove ¶
Remove uninstalls a package and cleans up all associated resources.
Cleanup sequence:
- Disable package hooks and stop monitoring (taskdisable)
- Clean up custom queues created by package hooks
- Uninstall package resources (taskuninstall)
- Remove package's main queue
func (*Operator) Stop ¶
func (o *Operator) Stop()
Stop performs graceful shutdown of all operator subsystems.
Shutdown order ensures safe termination:
- Stop NELM monitors (cleanup resource monitoring)
- Pause Kubernetes event handling (no new resource events)
- Stop schedule manager (no new cron triggers)
- Stop event handler (no new task generation)
- Stop queue service (no new task processing)
This order prevents new work from entering the system while allowing in-flight operations to complete gracefully where possible.
func (*Operator) Update ¶
Update installs a new package or updates an existing package's configuration.
For new packages (Pending phase):
- Install package from repository (download and extract)
- Load package hooks and configuration into memory
- Register with scheduler for enable/disable lifecycle management
For existing packages:
- If settings changed, apply new settings and trigger hook re-execution
Cancels any in-flight tasks from previous Update calls via context renewal.