modules

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: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Path         string            // Path to package dir
	StaticValues addonutils.Values // Static values from values.yaml files

	Definition Definition // Module definition

	Digests    map[string]string // Package images digests(images_digests.json)
	Repository registry.Remote   // Package repository options

	ConfigSchema []byte // OpenAPI config schema (YAML)
	ValuesSchema []byte // OpenAPI values schema (YAML)

	Hooks []*addonhooks.ModuleHook // Discovered hooks

	SettingsCheck *kind.SettingsCheck

	Patcher           *objectpatch.ObjectPatcher
	ScheduleManager   schedulemanager.ScheduleManager
	KubeEventsManager kubeeventsmanager.KubeEventsManager

	GlobalValuesGetter GlobalValuesGetter
}

Config holds configuration for creating a new Module instance.

type Definition

type Definition struct {
	Name     string `json:"name" yaml:"name"`
	Version  string `json:"version" yaml:"version"`
	Stage    string `json:"stage" yaml:"stage"`
	Critical bool   `json:"critical,omitempty" yaml:"critical,omitempty"`
	Weight   uint32 `json:"weight,omitempty" yaml:"weight,omitempty"`

	Requirements   Requirements   `json:"requirements" yaml:"requirements"`
	DisableOptions DisableOptions `json:"disableOptions" yaml:"disableOptions"`
}

Definition represents module metadata.

type Dependency

type Dependency struct {
	Constraints *semver.Constraints `json:"constraints" yaml:"constraints"`
	Optional    bool                `json:"optional" yaml:"optional"`
}

type DisableOptions

type DisableOptions struct {
	Confirmation bool   `json:"confirmation" yaml:"confirmation"` // Whether confirmation is required to disable
	Message      string `json:"message" yaml:"message"`           // Message to display when disabling
}

DisableOptions configures application disablement behavior.

type GlobalValuesGetter

type GlobalValuesGetter func(prefix bool) addonutils.Values

type Info

type Info struct {
	Name       string            `json:"name" yaml:"name"`
	Definition Definition        `json:"definition" yaml:"definition"`
	Repository registry.Remote   `json:"repository" yaml:"repository"`
	Digests    map[string]string `json:"digests" yaml:"digests"`
	Values     addonutils.Values `json:"values,omitempty" yaml:"values,omitempty"`
	Hooks      []string          `json:"hooks,omitempty" yaml:"hooks,omitempty"`
}

type Module

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

Module represents a running instance of a package. It contains hooks, values storage, and configuration for execution.

Thread Safety: The Module itself is not thread-safe, but its hooks and values storage components use internal synchronization.

func NewModuleByConfig

func NewModuleByConfig(name string, cfg *Config, logger *log.Logger) (*Module, error)

NewModuleByConfig creates a new Module instance with the specified configuration. It initializes hook storage, adds all discovered hooks, and creates values storage.

Returns error if hook initialization or values storage creation fails.

func (*Module) ApplySettings

func (m *Module) ApplySettings(settings addonutils.Values) error

ApplySettings apply settings values

func (*Module) GetChecks

func (m *Module) GetChecks() schedule.Checks

GetChecks return scheduler checks, their determine if an app should be enabled/disabled

func (*Module) GetExtraNelmValues

func (m *Module) GetExtraNelmValues() string

GetExtraNelmValues returns runtime values in string format

func (*Module) GetHooks

func (m *Module) GetHooks() []*addonhooks.ModuleHook

GetHooks returns all hooks for this module in arbitrary order.

func (*Module) GetHooksByBinding

func (m *Module) GetHooksByBinding(binding shtypes.BindingType) []*addonhooks.ModuleHook

GetHooksByBinding returns all hooks for the specified binding type, sorted by order.

func (*Module) GetInfo

func (m *Module) GetInfo() Info

func (*Module) GetName

func (m *Module) GetName() string

GetName returns the full module identifier.

func (*Module) GetPath

func (m *Module) GetPath() string

GetPath returns path to the package dir

func (*Module) GetQueues

func (m *Module) GetQueues() []string

GetQueues returns package queues from all hooks

func (*Module) GetRuntimeValues

func (m *Module) GetRuntimeValues() RuntimeValues

GetRuntimeValues returns values that are not part of schema. Instance contains name and namespace of the running instance. Package contains package metadata (name, version, digests, registry).

func (*Module) GetSettingsChecksum

func (m *Module) GetSettingsChecksum() string

GetSettingsChecksum returns a checksum of the current config values. Used to detect if settings changed.

func (*Module) GetValues

func (m *Module) GetValues() addonutils.Values

GetValues returns values for rendering

func (*Module) GetValuesChecksum

func (m *Module) GetValuesChecksum() string

GetValuesChecksum returns a checksum of the current values. Used to detect if values changed after hook execution.

func (*Module) GetVersion

func (m *Module) GetVersion() string

GetVersion return the package version

func (*Module) InitializeHooks

func (m *Module) InitializeHooks()

InitializeHooks initializes hook controllers and bind them to Kubernetes events and schedules

func (*Module) RunHookByName

func (m *Module) RunHookByName(ctx context.Context, name string, bctx []bctx.BindingContext) error

RunHookByName executes a specific hook by name with the provided binding context. Returns nil if hook is not found (silent no-op).

func (*Module) RunHooksByBinding

func (m *Module) RunHooksByBinding(ctx context.Context, binding shtypes.BindingType) error

RunHooksByBinding executes all hooks for a specific binding type in order. It creates a binding context with snapshots for BeforeHelm/AfterHelm/AfterDeleteHelm hooks.

func (*Module) UnlockKubernetesMonitors

func (m *Module) UnlockKubernetesMonitors(hook string, monitors ...string)

UnlockKubernetesMonitors called after sync task is completed to unlock getting events

func (*Module) ValidateSettings

func (m *Module) ValidateSettings(ctx context.Context, settings addonutils.Values) (settingscheck.Result, error)

ValidateSettings validates settings against openAPI and call setting check if exists

type Requirements

type Requirements struct {
	Kubernetes *semver.Constraints   `json:"kubernetes" yaml:"kubernetes"`
	Deckhouse  *semver.Constraints   `json:"deckhouse" yaml:"deckhouse"`
	Modules    map[string]Dependency `json:"modules" yaml:"modules"`
}

Requirements specifies dependencies required by the module.

func (*Requirements) Checks

func (r *Requirements) Checks() schedule.Checks

type RuntimeValues

type RuntimeValues struct {
	Package addonutils.Values
}

RuntimeValues holds runtime values that are not part of schema. These values are passed to helm templates under .Runtime prefix.

Jump to

Keyboard shortcuts

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