Documentation
¶
Overview ¶
Package platform holds the process-local platform store: a single-slot, concurrency-safe holder of the platform module generated and built from the cluster-singleton Platform CR. It is written by the PlatformReconciler and read by the render path. It also owns Layout, the on-disk lifecycle of the generated module directories the store records (per-generation directories, staging swaps, retention, boot reset); the module content itself comes from the library's opm/helper/platformmodule generator.
The store records one Generated platform module per Platform CR generation: the module directory on the operator's own disk, the platform value the kernel built from it and the resolved catalog-skew policy (enhancement 0019 D6, D7). A render leases the record for its duration (Store.Lease) so the PlatformReconciler never prunes a module directory a render build is still reading from.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generated ¶
type Generated struct {
Generation int64
Dir string
Platform *platform.Platform
// Skew is the resolved Platform.spec.skewPolicy (Warn when unset), passed
// verbatim as RenderInput.Skew by every render of this generation
// (0019 D7/D18).
Skew kernel.SkewPolicy
}
Generated is the process-local record of the platform module the reconciler generated and built for one Platform CR generation: the generation, the module directory on the operator's own disk (a per-generation directory under the manager's --platform-dir), the source-carrying platform the kernel's shape-gated loader built from it and the skew policy the CR resolved to. The render path consumes it through Store.Lease; the module is never published, written to the cluster or served elsewhere (0019 D6).
type Layout ¶
type Layout struct {
Root string
}
Layout owns the on-disk lifecycle of generated platform modules under Root (the manager's --platform-dir): one directory per CR generation, written by staging plus rename so a module directory is either absent or complete, pruned to the current and every leased generation after each successful build, and emptied at manager start. The module content itself comes from the library's generator (opm/helper/platformmodule); the lifecycle is operator process policy, which is why it lives here beside the store that records the directories.
func (Layout) Dir ¶
Dir returns the directory a generation's module lives in, whether or not it exists.
func (Layout) Generations ¶
Generations lists the complete generation directories under Root, in ascending generation order. Staging and moved-aside entries are ignored.
func (Layout) Prune ¶
Prune removes every entry under Root except the generation directories listed in keep: superseded generations, staging leftovers and moved-aside copies. A missing Root is not an error.
func (Layout) Reset ¶
Reset empties Root entirely (the boot path: disk is ephemeral, the CR is the source of truth, and the initial reconcile regenerates) and makes sure Root exists afterwards.
func (Layout) Write ¶
Write materialises files as generation's module directory and returns its path. The files are written into a staging directory first and renamed into place, so no reader observes a partially written module: a failure at any point leaves the staging directory (cleaned by the next Prune or Reset) and never a generation directory. An existing directory for the same generation (a re-reconcile after a build failure, or a container restart on the same volume) is moved aside before the swap and removed after it.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds at most one generated platform, keyed on the Platform CR's .metadata.generation it was built for. Enhancement 0001 §8.3: one global Platform per cluster needs one slot, not the library's content-hash LRU.
The Store carries no kernel gate. The single process-wide library Kernel is safe for concurrent use across its method calls (library ADR-007): every verb (module acquisition, instance synthesis, on-disk acquisition, the platform build, the render) builds in a cue.Context of its own and retains nothing, so acquisitions, syntheses and renders of different objects overlap with no mutex.
func (*Store) Clear ¶
func (s *Store) Clear()
Clear drops the held record so the store reports no platform held. Called when the Platform CR is deleted. Leases outstanding on the dropped generation are kept: the renders holding them still read its directory.
func (*Store) Generated ¶
Generated returns the current generated-module record and true, or the zero record and false when none is held. Safe for concurrent callers. A render that will read the module directory takes Lease instead.
func (*Store) Generation ¶
Generation returns the .metadata.generation the held platform was built for, or 0 when no platform is held.
func (*Store) Lease ¶
Lease returns the current record and a release function, holding the record's generation leased until release is called; it returns ok false (a zero record and a no-op release) when no platform is held. The caller defers release immediately: a leased generation's module directory survives the PlatformReconciler's prune until every lease on it is released. Release is idempotent.
func (*Store) Leased ¶
Leased returns the generations at least one render currently holds a lease on, in ascending order. The PlatformReconciler adds them to the prune keep set.
func (*Store) SetGenerated ¶
SetGenerated records g as the current generated platform module, replacing any earlier record, and reports g.Generation from Generation. Leases on the replaced generation are unaffected: the render holding one finishes against the directory it started with.