Documentation
¶
Overview ¶
Package cellprofile loads per-user CellProfile templates from $HOME/.kuke/profiles.d/*.yaml (or $KUKE_PROFILES_DIR) and materializes them into CellDocs that `kuke run -p` then drives along the same path as `-f`.
Index ¶
Constants ¶
const DefaultDirSuffix = ".kuke/profiles.d"
DefaultDirSuffix is appended to $HOME when KUKE_PROFILES_DIR is unset. Matches sbsh's `~/.sbsh/profiles.d` layout.
const EnvProfilesDir = "KUKE_PROFILES_DIR"
EnvProfilesDir is the env var that overrides the default user profiles directory. Picked up by ResolveDir; takes precedence over $HOME/.kuke/profiles.d.
const LabelProfile = "kukeon.io/profile"
LabelProfile is the cell label that records the CellProfile a cell was materialized from. Set on every cell produced by Materialize so operators can list all instances with `kuke get cells -l kukeon.io/profile=<name>`.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(dir string) ([]v1beta1.CellProfileDoc, error)
List returns every parseable CellProfile in dir, sorted by metadata.name. Used by both the `-p` autocomplete handler and the fallback name lookup in Load. Files that fail to parse are skipped silently — the operator finds out via Load when they actually try to use the broken profile.
func Load ¶
func Load(dir, name string) (*v1beta1.CellProfileDoc, error)
Load reads $dir/<name>.yaml (or its .yml sibling) and returns the parsed profile. When neither exists, it falls back to scanning every *.yaml / *.yml file in the directory and matching on metadata.name — the file basename is the convenient case but not authoritative, so two profiles can share a directory regardless of how they were named on disk.
Wraps errdefs.ErrProfileNotFound when the name does not resolve, including the directory in the error so the operator knows where to drop the file.
func Materialize ¶
func Materialize(profile *v1beta1.CellProfileDoc) (v1beta1.CellDoc, error)
Materialize converts a CellProfile into a CellDoc suitable for the same path `kuke run -f` drives. CellProfile is always a template: every call returns a cell named `<prefix>-<6hex>`, where prefix is spec.prefix when set and metadata.name otherwise. Singleton workloads belong on the Cell kind. The realm/space/stack triple is taken from the profile spec verbatim — callers layer --realm/--space/--stack flag overrides separately, mirroring the existing -f resolution. Every produced cell also carries the kukeon.io/profile=<metadata.name> label so the set of cells materialized from a profile is queryable via `kuke get cells -l`.
func ResolveDir ¶
ResolveDir returns the active profiles directory: $KUKE_PROFILES_DIR if set, otherwise $HOME/.kuke/profiles.d. The directory is not required to exist — callers either tolerate ENOENT (List) or surface ProfileNotFound (Load).
Types ¶
This section is empty.