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
- func ReadInstallStatuses(ctx context.Context, kubeContext, kubeconfig string, items []InstallItem) (map[string]InstallStatus, error)
- func RecommendedAddons() []string
- func RequiredItemsReady(statuses map[string]InstallStatus, required []InstallItem) bool
- func SetEnabled(ctx context.Context, kubeContext, kubeconfig string, apps, crds []string, ...) error
- type Config
- type EnableSet
- type Entry
- type HelmError
- type InstallItem
- type InstallItemKind
- type InstallStatus
- type KubectlError
Constants ¶
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 ReadInstallStatuses ¶
func ReadInstallStatuses(ctx context.Context, kubeContext, kubeconfig string, items []InstallItem) (map[string]InstallStatus, error)
ReadInstallStatuses reads all Flux HelmRelease statuses once and returns the current status for the requested items. kubeContext and kubeconfig are optional; empty values use kubectl's defaults.
func RecommendedAddons ¶
func RecommendedAddons() []string
RecommendedAddons returns addon components included by the recommended platform-components seed.
func RequiredItemsReady ¶
func RequiredItemsReady(statuses map[string]InstallStatus, required []InstallItem) bool
RequiredItemsReady reports whether every named required item is Ready in the supplied status snapshot.
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 ¶
Config is a snapshot of the platform-components Helm release values that determine which Podplane components are enabled in a cluster.
func Read ¶
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 ¶
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 ¶
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) InstallItems ¶
func (c *Config) InstallItems(plan EnableSet) []InstallItem
InstallItems builds watch targets for every app and CRD in an enable plan.
func (*Config) ResolveEnable ¶
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 ¶
EnableSet is the set of apps and CRDs that must be enabled to install a component. Names are sorted alphabetically.
type Entry ¶
Entry describes one component (app or CRD chart) entry as read from the platform-components Helm release values.
type HelmError ¶
HelmError is returned when a helm invocation fails. It captures the stage (so callers can format helpful messages) and the helm stderr.
type InstallItem ¶
type InstallItem struct {
Name string
Namespace string
Kind InstallItemKind
}
InstallItem identifies one component HelmRelease that is expected to exist after enabling a component install plan.
type InstallItemKind ¶
type InstallItemKind string
InstallItemKind identifies whether an install status item is an app chart or a CRD chart managed by platform-components.
const ( // InstallItemApp is a component app HelmRelease. InstallItemApp InstallItemKind = "app" // InstallItemCRD is a component CRD HelmRelease. InstallItemCRD InstallItemKind = "crd" )
type InstallStatus ¶
type InstallStatus struct {
Item InstallItem
Exists bool
Ready bool
Status string
Message string
}
InstallStatus is the current observed status of one component HelmRelease.
type KubectlError ¶
KubectlError is returned when a kubectl invocation fails.
func (*KubectlError) Error ¶
func (e *KubectlError) Error() string
Error implements the error interface.
func (*KubectlError) Unwrap ¶
func (e *KubectlError) Unwrap() error
Unwrap returns the underlying exec error.