monitor

package
v1.75.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

func (m *Manager) AddMonitor(namespace, name, rendered string)

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

func (m *Manager) CheckResources(ctx context.Context, name string) error

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

func (m *Manager) HasMonitor(name string) bool

HasMonitor checks if the monitor exists

func (*Manager) PauseMonitor

func (m *Manager) PauseMonitor(name string)

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

func (m *Manager) RemoveMonitor(name string)

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

func (m *Manager) ResumeMonitor(name string)

ResumeMonitor decrements the pause counter for a release monitor. The monitor resumes checking resources when counter reaches zero.

func (*Manager) Stop

func (m *Manager) Stop()

Stop gracefully shuts down all monitors. Blocks until all monitor goroutines have exited.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL