Documentation
¶
Index ¶
- type Storage
- func (s *Storage) ApplyConfigValues(settings addonutils.Values) error
- func (s *Storage) ApplyDefaultsConfigValues(settings addonutils.Values) addonutils.Values
- func (s *Storage) ApplyValuesPatch(patch addonutils.ValuesPatch) error
- func (s *Storage) GetConfigChecksum() string
- func (s *Storage) GetConfigValues() addonutils.Values
- func (s *Storage) GetValues() addonutils.Values
- func (s *Storage) GetValuesChecksum() string
- func (s *Storage) ValidateConfigValues(settings addonutils.Values) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage manages package values with layering, patching, and schema validation. It maintains both the user config (before merging) and the final result after all layers.
Thread Safety: Protected by mutex for concurrent access.
func NewStorage ¶
func NewStorage(name string, staticValues addonutils.Values, configBytes, valuesBytes []byte) (*Storage, error)
NewStorage creates a new values storage with the specified schemas and static values. It initializes the schema storage for validation and calculates initial result values.
Parameters:
- name: Package name (will be converted to values key format)
- staticValues: Pre-loaded static values from values.yaml
- configBytes: OpenAPI config schema (YAML bytes)
- valuesBytes: OpenAPI values schema (YAML bytes)
Returns error if schema initialization or initial value calculation fails.
func (*Storage) ApplyConfigValues ¶
func (s *Storage) ApplyConfigValues(settings addonutils.Values) error
ApplyConfigValues validates and saves user-defined config values. After saving, recalculates the result values with all layers merged.
func (*Storage) ApplyDefaultsConfigValues ¶
func (s *Storage) ApplyDefaultsConfigValues(settings addonutils.Values) addonutils.Values
ApplyDefaultsConfigValues returns a copy of the provided values with defaults from the config OpenAPI schema applied. Does not modify stored values.
func (*Storage) ApplyValuesPatch ¶
func (s *Storage) ApplyValuesPatch(patch addonutils.ValuesPatch) error
ApplyValuesPatch applies a JSON patch to the result values. Patches are accumulated and reapplied on each recalculation. Used by hooks to dynamically modify values at runtime.
func (*Storage) GetConfigChecksum ¶
GetConfigChecksum returns a checksum of only the user-defined config values. Unlike GetValuesChecksum, this excludes static values, schema defaults, and patches.
func (*Storage) GetConfigValues ¶
func (s *Storage) GetConfigValues() addonutils.Values
GetConfigValues returns only user-defined config values (from Application.spec.settings). Does not include static values, schema defaults, or patches.
func (*Storage) GetValues ¶
func (s *Storage) GetValues() addonutils.Values
GetValues returns the final merged values that hooks and templates see. This includes all layers: static values, schema defaults, user config, and patches.
func (*Storage) GetValuesChecksum ¶
GetValuesChecksum returns a checksum of the final merged values. Used to detect when values have changed (e.g., for triggering hook reruns).
func (*Storage) ValidateConfigValues ¶
func (s *Storage) ValidateConfigValues(settings addonutils.Values) error
ValidateConfigValues validates values against the config OpenAPI schema. Does not modify the stored values - use ApplyConfigValues to persist.