nelm

package
v1.78.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 49 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPackageNotHelm = errors.New("package not helm")

Functions

This section is empty.

Types

type MaintenanceState added in v1.77.0

type MaintenanceState string

MaintenanceState is the reconciliation mode requested for a package. The zero value (Managed) reconciles normally; it mirrors ModuleConfig maintenance.

const (
	// Managed reconciles the package's resources normally.
	Managed MaintenanceState = ""
	// NoResourceReconciliation stops reconciling the package's resources: the Helm
	// release is left untouched, resource monitoring is disabled, and resources are
	// labeled so they can be edited by hand.
	NoResourceReconciliation MaintenanceState = "NoResourceReconciliation"
)

type Package

type Package interface {
	GetName() string
	GetPath() string
	GetRuntimeValues() string
	GetValues() addonutils.Values
	// GetMaintenance reports the package's maintenance mode; the package itself
	// decides whether its resources must be reconciled.
	GetMaintenance() MaintenanceState
}

Package provides access to package data needed for Helm operations.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service manages Helm release lifecycle via nelm client. It provides upgrade, deletion, and rendering operations.

func NewService

func NewService(kubeClient *klient.Client, observations observations, metricStorage metricsstorage.Storage, logger *log.Logger) *Service

NewService creates a new nelm service for managing Helm releases. observations receive what the service observes while it renders, applies and deletes releases (observed.Store); metricStorage the helm phase of a run.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, namespace, name string) error

Delete uninstalls a Helm release by name. This removes all resources created by the release from the cluster.

Returns error if the release doesn't exist or deletion fails.

func (*Service) GetConversionWebhooks added in v1.78.0

func (s *Service) GetConversionWebhooks(ctx context.Context, namespace string, pkg Package) ([]manifest.Manifest, error)

GetConversionWebhooks returns the conversion webhooks for the given package. It renders only the templates that declare the kind (plus helpers), and falls back to the full chart if that reduced render fails.

func (*Service) HasConversionWebhook added in v1.78.0

func (s *Service) HasConversionWebhook(path string) (bool, error)

HasConversionWebhook reports whether the package's chart can render a ConversionWebhook, so callers skip the render for packages that ship none. It scans the chart's templates and subcharts for a literal `kind:` line, so a kind built dynamically (`kind: {{ $kind }}`) is not detected.

func (*Service) HasMonitor

func (s *Service) HasMonitor(name string) bool

HasMonitor checks if a release monitor exists for the given name.

func (*Service) PauseMonitor

func (s *Service) PauseMonitor(name string)

PauseMonitor pauses resource readiness checks for a release monitor. Requires an equal number of ResumeMonitor calls to unpause.

func (*Service) RemoveMonitor

func (s *Service) RemoveMonitor(name string)

RemoveMonitor stops and removes a release monitor. No-op if the monitor doesn't exist.

func (*Service) Render

func (s *Service) Render(ctx context.Context, namespace string, pkg Package) (string, error)

Render renders a Helm chart with the provided values and returns the manifests. This is useful for validating charts or previewing what will be installed.

Process:

  1. Verify the path contains a valid Helm chart
  2. Create temporary values file
  3. Render chart using nelm client
  4. Return rendered YAML manifests

Returns ErrPackageNotHelm if the path doesn't contain a valid Helm chart.

func (*Service) ResumeMonitor

func (s *Service) ResumeMonitor(name string)

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

func (*Service) StopMonitors

func (s *Service) StopMonitors()

StopMonitors gracefully shuts down all release monitors.

func (*Service) Upgrade

func (s *Service) Upgrade(ctx context.Context, namespace string, pkg Package, applying, drifted func()) error

Upgrade installs or upgrades a Helm release for a package.

Smart upgrade logic:

  • Renders chart and calculates manifest checksum
  • Checks if upgrade is needed (new install, status, checksum, missing resources)
  • Skips upgrade if nothing changed (optimization)
  • Starts resource monitoring after successful install/upgrade

Process:

  1. Verify package contains a Helm chart
  2. Create temporary values file from package values
  3. Render chart to get manifests
  4. Calculate manifest checksum
  5. Check if upgrade is needed
  6. Install/upgrade release if needed
  7. Start or verify resource monitoring

Maintenance (state == NoResourceReconciliation): once the release is marked as under maintenance the upgrade is skipped and resource monitoring is dropped, so config/hook changes are not reconciled and deleted resources are not restored. Resources are stamped with the maintenance label so the deckhouse admission policy stops guarding them against manual edits.

Returns ErrPackageNotHelm if the package doesn't contain a valid Helm chart.

applying, when not nil, is called once right before the release is installed or upgraded, and never when the render matches the deployed release: the caller reports the apply in flight (ManifestsApplied false with ApplyingManifests, as the status did when nelm sent progress).

drifted is the callback of the drift monitor this call (re)starts for the release: it is called whenever resources of this render are absent. The caller of the last Upgrade owns the monitor, so a new owner of the release (a switch) takes it over with its first Upgrade.

Directories

Path Synopsis
Package monitor provides resource monitoring for Helm releases deployed via nelm.
Package monitor provides resource monitoring for Helm releases deployed via nelm.

Jump to

Keyboard shortcuts

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