Documentation
¶
Overview ¶
Package migrationplan publishes and re-derives the immutable manifest of one planned migration sequence.
The controller writes the plan and admission re-derives it from the same inputs, so the derivation lives here rather than in either of them: a plan nobody can reproduce is a plan nothing can check.
Index ¶
- Constants
- func Desired(migration *operatorv1alpha1.PtahMigration, ...) (*operatorv1alpha1.PtahMigrationPlan, error)
- func HistoryFingerprint(report dataplane.MigrationStatusReport) (string, error)
- func Name(planFingerprint string) (string, error)
- func Sequence(report dataplane.MigrationStatusReport) ([]operatorv1alpha1.PlannedMigration, error)
- func SequenceDigest(planned []operatorv1alpha1.PlannedMigration) (string, error)
- func SupportedContractVersion(version int32) bool
- type Binding
Constants ¶
const ( // ContractVersion versions migration plan publication separately from the // Kubernetes API version. It is the contract of a plan computed from an // OCI artifact; SourceContractVersion is the one of a plan computed from a // ConfigMap, which binds its source in place of the artifact digest and // the verification policy. ContractVersion int32 = fingerprint.CurrentPlanContractVersion SourceContractVersion int32 = fingerprint.SourcePlanContractVersion // LabelMigration names the PtahMigration a plan belongs to. LabelMigration = workload.LabelMigration // MaxMigrations is the longest sequence one plan may carry. It matches the // CRD's own bound, so a sequence the API would refuse is refused before it // is published rather than after. MaxMigrations = 256 )
Variables ¶
This section is empty.
Functions ¶
func Desired ¶
func Desired( migration *operatorv1alpha1.PtahMigration, spec operatorv1alpha1.PtahMigrationPlanSpec, ) (*operatorv1alpha1.PtahMigrationPlan, error)
Desired builds the object the controller publishes. Its metadata is exactly what admission expects, because admission builds the same object.
func HistoryFingerprint ¶
func HistoryFingerprint(report dataplane.MigrationStatusReport) (string, error)
HistoryFingerprint is the exact reading of the revision table a plan was computed against. It covers every migration the report accounted for, so a history that moved -- by anyone, for any reason -- produces a different fingerprint and invalidates the plan.
func Name ¶
Name is the plan's deterministic object name. Two publications of the same plan are the same object, so a controller that restarted mid-publication cannot leave a second copy of one decision.
func Sequence ¶
func Sequence(report dataplane.MigrationStatusReport) ([]operatorv1alpha1.PlannedMigration, error)
Sequence selects the migrations a plan executes, in the order the history document listed them. The order is the content: a plan that applies the same migrations in another order is a different plan.
func SequenceDigest ¶
func SequenceDigest(planned []operatorv1alpha1.PlannedMigration) (string, error)
SequenceDigest binds the plan's fingerprint to the exact sequence it carries.
The derivation itself lives in internal/workload, because the Apply Job has to carry the same digest and that package is below this one. One rule, two callers.
func SupportedContractVersion ¶ added in v0.2.7
SupportedContractVersion reports whether this manager publishes and reads migration plans of version.
Types ¶
type Binding ¶
type Binding struct {
MigrationUID types.UID
HistoryFingerprint string
SequenceDigest string
ArtifactDigest string
// Source is the ConfigMap source a version 2 plan binds in place of the
// artifact digest and the verification policy.
Source *fingerprint.PlanSource
CoordinationDigest string
TargetIdentityDigest string
// ShadowIdentityDigest is the shadow database a drift check replays
// into, and empty for a plan whose policy asks for no check.
ShadowIdentityDigest string
PolicyFingerprint string
VerificationPolicyUID types.UID
VerificationPolicyDigest string
ExecutionBindingID string
ControllerStateVersion int32
PtahVersion string
ExecutorImage string
RunnerProtocolVersion int32
}
Binding is everything a migration plan is decided from. A changed input produces a different plan rather than a changed one.
The manager that publishes the plan is not an input. Its image, its revision and the runner image built beside it are recorded on the plan and left out of here, so a manager release that changes only them finds the same fingerprint, the same plan name and the same approvals.
func (Binding) ContractVersion ¶ added in v0.2.7
ContractVersion is the plan contract this binding is published under.
func (Binding) Fingerprint ¶
Fingerprint is the plan's identity. An approval names it, and everything the plan was decided from is inside it.