Documentation
¶
Overview ¶
Package app is the App kind's server side (ADR-0199, F113): the app-parts admission, which admits each declared part as a direct write of it would be admitted, and the App reconciler, which writes the parts, reports one status and prunes what a new spec drops. The reconciler also stamps an AppRevision per changed spec and records its rollout, its deadline and the history (ADR-0200, F114), records each write-back of a hand edit and writes nothing while spec.paused is set (ADR-0212, F115). The owner GC removes the tree on App delete (internal/gc).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdmission ¶
func NewAdmission(parts func(admission.StoreReader) []admission.Admission, r admission.StoreReader) admission.Admission
NewAdmission returns app-parts. parts builds the admissions a direct write passes over the reader it is given; app-parts gives it the view holding the App's other parts. It implements admission.NamespaceReading, true when a part admission it runs is.
Types ¶
type Deps ¶
type Deps struct {
Store store.Store
Purger gc.BucketPurger
Logger *slog.Logger
// Clock reads every time of the rollout record (ADR-0200); nil ⇒ clock.System().
Clock clock.Clock
// UpgradeTimeout is app.upgradeTimeout, the time from a stamp to its switch; 0 ⇒ 5m.
UpgradeTimeout time.Duration
// RevisionHistory is app.revisionHistory, the AppRevisions kept besides the current one; 0 ⇒ 10.
RevisionHistory int
// SupervisionPeriod is runtime.supervisionPeriod, the retry of a stopped pass or a blocked prune (ADR-0199
// Decision 6, as the Workflow materializer); 0 ⇒ controller.SupervisionPeriod.
SupervisionPeriod time.Duration
// Hold is the platform hold (ADR-0206 Decision 6); nil ⇒ never held. The deadline reads its ReleasedAt (ADR-0212
// Decision 6).
Hold interface {
Held() bool
ReleasedAt() time.Time
}
}
Deps are the reconciler's dependencies; Store and Purger are required.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler drives an App to its declared parts (controller.Reconciler). It keeps no state between passes: the rollout deadline is read from the AppRevision's status.startedAt.
func NewReconciler ¶
func NewReconciler(d Deps) (*Reconciler, error)
NewReconciler builds the App reconciler.
func (*Reconciler) MapPart ¶
func (r *Reconciler) MapPart(ctx context.Context, obj v1.Object) []controller.Request
MapPart is the controller.MapFunc of every section kind: it requeues each App whose controller reference or marker obj carries, and each App of obj's namespace with a ref entry naming obj (Decision 4).
func (*Reconciler) Reconcile ¶
func (r *Reconciler) Reconcile(ctx context.Context, req controller.Request) (controller.Result, error)
Reconcile stamps an AppRevision when the spec changed, checks that the App owns every part that exists, writes the parts that are absent or differ, recording each self-heal, reads each part's readiness, derives the rollout record, prunes the dropped objects it controls once the latest revision is current, writes the App's status, then each changed AppRevision status, and trims the history. A paused App gets only its Paused condition (ADR-0212).