Documentation
¶
Overview ¶
Package monitor provides resource monitoring for Helm releases deployed via nelm. It periodically checks that all resources from a release manifest are present in the cluster, helping detect configuration drift or accidental deletions.
Index ¶
- Variables
- type AbsentCallback
- type Manager
- func (m *Manager) AddMonitor(namespace, name, rendered string)
- func (m *Manager) CheckResources(ctx context.Context, name string) error
- func (m *Manager) HasMonitor(name string) bool
- func (m *Manager) PauseMonitor(name string)
- func (m *Manager) RemoveMonitor(name string)
- func (m *Manager) ResumeMonitor(name string)
- func (m *Manager) Stop()
Constants ¶
This section is empty.
Variables ¶
var ErrAbsentManifest = errors.New("absent manifest")
ErrAbsentManifest is returned when one or more expected resources are missing from the cluster
Functions ¶
This section is empty.
Types ¶
type AbsentCallback ¶
type AbsentCallback func(name string)
AbsentCallback is invoked when absent resources are detected
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates multiple resource monitors for Helm releases. Thread-safe for concurrent access.
func New ¶
func New(cache runtimecache.Cache, nelm *nelm.Client, callback AbsentCallback, logger *log.Logger) *Manager
New creates a new monitor manager instance.
func (*Manager) AddMonitor ¶
AddMonitor creates and starts a new monitor for a Helm release. If a monitor already exists for this release, stop it and start a new one. The monitor will run in the background, checking resources every 4 minutes.
func (*Manager) CheckResources ¶
CheckResources performs an immediate check of resources for a specific release. Returns nil if monitor doesn't exist or all resources are present.
func (*Manager) HasMonitor ¶
HasMonitor checks if the monitor exists
func (*Manager) PauseMonitor ¶
PauseMonitor increments the pause counter for a release monitor. The monitor will skip resource checks while paused. Safe to call from multiple goroutines; requires equal Resume calls to unpause.
func (*Manager) RemoveMonitor ¶
RemoveMonitor stops and removes a monitor for a Helm release. If the monitor doesn't exist, the call is a no-op.
func (*Manager) ResumeMonitor ¶
ResumeMonitor decrements the pause counter for a release monitor. The monitor resumes checking resources when counter reaches zero.