lifecyclejournal

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package lifecyclejournal derives a resource's lifecycle journal from the status writes the controllers already make.

Each controller writes status in one place and holds the status before and after the write there. SchemaEntries and MigrationEntries turn that transition into the events it records, and Record adds them to the journal in the same write, so no transition site has to remember the journal and the journal costs no request of its own.

Index

Constants

View Source
const (
	MaxEntries = 64
	MaxAge     = 30 * 24 * time.Hour
)

The journal's bounds, which the plan nothing has carried out yet does not answer to: see Record. The API schema holds MaxEntries as well.

Variables

This section is empty.

Functions

func MigrationEntries

MigrationEntries is what a PtahMigration status write from before to after records, given the journal before the write. A plan is published by the write that first names it, as for a schema.

func Newest added in v0.2.11

Newest is the newest count entries of journal, or as many as it holds. A stored journal answers which entries a write wrote with the count Record returned for it.

func OutstandingPlan added in v0.2.10

func OutstandingPlan(journal *operatorv1alpha1.LifecycleJournal) (plan string, approved bool)

OutstandingPlan names the plan the journal's newest PlanPublished records when nothing has carried it out since, and says whether an approval of that plan was accepted. The name is empty when the journal holds no such plan.

A status write cannot answer this from status alone: the controller clears the plan it is waiting on while it refreshes, so a write that publishes a plan usually sees no plan before it.

func Record

Record adds entries to journal, applies the bounds, and returns the journal to store. A nil journal starts covering at now. A failed attempt with the same operation and reason as the newest entry folds into it.

It also returns how many of the newest entries of that journal the write wrote: the ones it added, and the newest one already there when a failed attempt folded into it. Nothing else moves, since the bounds only drop the oldest entries, so those are the last ones the journal holds. A write that stores the journal can then say which of the stored entries are its own: Newest reads them back from the object the write returned.

The age bound is measured from the newest entry rather than from now: an entry may be dated by the time its status carries, and the bound must not depend on which clock dated it. Record runs only in a status write that happens anyway, so it never causes a write itself.

The bounds keep the entry that published the plan nothing has carried out yet, and the newest approval of it. A plan can wait for a person longer than the bounds last, and those entries are the only record of what a later plan replaces. They add at most two entries past the age bound and none to the count.

func SchemaEntries

SchemaEntries is what a PtahSchema status write from before to after records. journal is the journal before the write, which tells a plan or an approval the resource already recorded from a new one: the controller clears and republishes the same plan while it refreshes.

A plan is published by the write that first names it. The plan an Apply ran stays in status until the proof that follows settles, and every write in between names it again; none of them publishes it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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