components

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package components reads and mutates the platform-components HelmRelease in a Podplane cluster, which is the single source of truth for which Podplane component charts are enabled/installed and which are core.

Index

Constants

View Source
const (
	HelmReleaseName      = "platform-components"
	HelmReleaseNamespace = "platform-components"
)

Helm release coordinates for the platform-components release that is the runtime source of truth for which components are enabled.

Variables

This section is empty.

Functions

func RecommendedAddons

func RecommendedAddons() []string

RecommendedAddons returns addon components included by the recommended platform-components seed.

func SetEnabled

func SetEnabled(ctx context.Context, kubeContext, kubeconfig string, apps, crds []string, enabled bool) error

SetEnabled patches the platform-components HelmRelease so the given apps and CRDs have spec.values.platform.components.{apps,crds}.<name>.enabled set to the given value. Empty lists are no-ops. kubeContext and kubeconfig are optional; empty values use kubectl's defaults.

Types

type Config

type Config struct {
	Apps map[string]Entry
	CRDs map[string]Entry
}

Config is a snapshot of the platform-components Helm release values that determine which Podplane components are enabled in a cluster.

func Read

func Read(ctx context.Context, kubeContext, kubeconfig string) (*Config, error)

Read returns the platform-components Helm release values, merging chart defaults with any overrides applied by the platform-components HelmRelease. This is what makes `core: true` (declared as a chart default in podplane/components) visible to the CLI even though the HelmRelease only stores user overrides.

kubeContext and kubeconfig are optional; empty values use helm's defaults.

func (*Config) EnabledDependents

func (c *Config) EnabledDependents(name string) []string

EnabledDependents returns the names of currently enabled apps and CRDs whose dependsOn list contains name. Used by uninstall to refuse removing a component that other enabled components depend on.

func (*Config) Get

func (c *Config) Get(name string) (entry Entry, isApp bool, ok bool)

Get returns the entry for name. isApp is true when the entry is an app chart, false when it is a CRD chart. ok is false when name is not present.

func (*Config) Has

func (c *Config) Has(name string) bool

Has returns true when name exists in either Apps or CRDs.

func (*Config) HelmReleaseRefs added in v0.2.0

func (c *Config) HelmReleaseRefs(plan EnableSet) []health.HelmReleaseRef

HelmReleaseRefs builds runtime HelmRelease references for every app and CRD in an enable plan.

func (*Config) ResolveEnable

func (c *Config) ResolveEnable(name string) (EnableSet, error)

ResolveEnable walks dependsOn transitively to compute the apps and CRDs that must be flipped to enabled=true so that name can be installed.

The returned set excludes entries that are already enabled. If name itself is already enabled and all of its (transitive) dependencies are too, the returned set is empty.

ResolveEnable returns an error when name is not present in the cluster's platform-components values, or when any (transitive) dependency cannot be found there.

type EnableSet

type EnableSet struct {
	Apps []string
	CRDs []string
}

EnableSet is the set of apps and CRDs that must be enabled to install a component. Names are sorted alphabetically.

func (EnableSet) IsEmpty

func (s EnableSet) IsEmpty() bool

IsEmpty reports whether the set is empty.

type Entry

type Entry struct {
	Enabled   bool
	Namespace string
	Core      bool
	DependsOn []string
}

Entry describes one component (app or CRD chart) entry as read from the platform-components Helm release values.

type HelmError

type HelmError struct {
	Stage  string
	Err    error
	Stderr string
}

HelmError is returned when a helm invocation fails. It captures the stage (so callers can format helpful messages) and the helm stderr.

func (*HelmError) Error

func (e *HelmError) Error() string

Error implements the error interface.

func (*HelmError) Unwrap

func (e *HelmError) Unwrap() error

Unwrap returns the underlying exec error so callers can use errors.Is/As.

Jump to

Keyboard shortcuts

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