Documentation
¶
Index ¶
Constants ¶
const ( // StageNotifyStart tells the components that need to know an upgrade is // beginning.. StageNotifyStart = "notify-start" // StageReplaceBinaries is the nesting-doll replacement of olaresd and // olares-cli on every machine.. StageReplaceBinaries = "replace-binaries" // StageImportImages loads the images this upgrade needs onto every // machine.. StageImportImages = "import-images" // StagePreUpgradeNode is the pre-upgrade script on every node.. StagePreUpgradeNode = "pre-upgrade-node" // StagePreUpgradeAdmin is the pre-upgrade work that only the control node // does: KubeSphere manifests, CRDs, prometheus rules — everything that // runs against the apiserver before the upgrade proper. It is where most // of what a release does before upgrading ends up. StagePreUpgradeAdmin = "pre-upgrade-admin" // StageUpgradeCluster is the cluster upgrade itself, which Kubernetes // carries out from the control node.. StageUpgradeCluster = "upgrade-cluster" // StagePostUpgradeNode is the post-upgrade script on every node.. StagePostUpgradeNode = "post-upgrade-node" // StagePostUpgradeAdmin is the post-upgrade script on the control node. StagePostUpgradeAdmin = "post-upgrade-admin" // StageRebootNodes restarts the machines that need it, after everything // else has been recorded. It comes last because the GPU driver upgrade // reboots the machines whose driver changed and has to do it after the // version has been flipped: the marker olares-cli writes before rebooting // is what makes olaresd report upgrading-and-rebooting rather than // briefly reporting success. StageRebootNodes = "reboot-nodes" // StageVerifyCluster waits for the system components to be up again, and // is after the reboot because that is the only place the answer means // anything. A machine whose GPU driver was just replaced runs its device // plugin against a driver the kernel has not loaded yet, so the plugin is // legitimately not ready until the reboot this stage follows. Asked before // it, the question fails on a cluster that is fine. StageVerifyCluster = "verify-cluster" // StageNotifyDone tells the components that the upgrade is over.. StageNotifyDone = "notify-done" )
Stage names. These are the points in the upgrade flow that tasks can be placed into, and there are only these: adding a task means choosing one of them, not inventing a place in a list.
Variables ¶
var UpgradeFlow = []Stage{ { Name: StageNotifyStart, Placement: PlacementAdmin, TimeoutSeconds: 5 * 60, Desc: "tell user-service and l4-gateway an upgrade is starting", }, { Name: StageReplaceBinaries, Placement: PlacementAllNodes, MaxParallel: 1, TimeoutSeconds: 30 * 60, Desc: "replace olaresd and olares-cli on each machine", }, { Name: StageImportImages, Placement: PlacementAllNodes, TimeoutSeconds: 30 * 60, Desc: "import the images this upgrade needs on each machine", }, { Name: StagePreUpgradeNode, Placement: PlacementAllNodes, MaxParallel: 1, TimeoutSeconds: 20 * 60, Desc: "pre-upgrade work each machine does to itself", }, { Name: StagePreUpgradeAdmin, Placement: PlacementAdmin, TimeoutSeconds: 30 * 60, Desc: "pre-upgrade work the control node does to the cluster", }, { Name: StageUpgradeCluster, Placement: PlacementAdmin, TimeoutSeconds: 90 * 60, Desc: "upgrade the Olares cluster", }, { Name: StagePostUpgradeNode, Placement: PlacementAllNodes, MaxParallel: 1, TimeoutSeconds: 45 * 60, Desc: "post-upgrade work each machine does to itself", }, { Name: StagePostUpgradeAdmin, Placement: PlacementAdmin, TimeoutSeconds: 45 * 60, Desc: "post-upgrade work the control node does to the cluster", }, { Name: StageRebootNodes, Placement: PlacementAllNodes, MaxParallel: 1, TimeoutSeconds: 20 * 60, AwaitRestart: true, Desc: "restart the machines whose upgrade requires it", }, { Name: StageVerifyCluster, Placement: PlacementAdmin, TimeoutSeconds: 30 * 60, Desc: "wait for the system components to be up again", }, { Name: StageNotifyDone, Placement: PlacementAdmin, TimeoutSeconds: 5 * 60, Desc: "tell l4-gateway the upgrade is over", }, }
UpgradeFlow is the upgrade, as a fixed sequence of stages.
It is written here once and does not vary by version. A release adds tasks to these stages; it does not add, reorder or rename them. That is the whole point of the abstraction: a flat task list that every contributor appends to has no shape anyone can reason about, and the shape is what says when work on one node has to finish before work on another begins.
Every boundary between two stages is a barrier: the next stage starts on no node until this one has finished on every node it was scheduled on. The timeouts are per node and deliberately generous: they are there to end a stage that has stopped making progress, not to hurry one along. Where a stage waits on the cluster rather than on itself, the bound is the task's own retry budget plus room — post-upgrade-admin waits sixty times at fifteen seconds for the system components, so anything under fifteen minutes would cut off a stage that was working.
Functions ¶
Types ¶
type MinimumVersionConstraints ¶
type MinimumVersionConstraints VersionConstraints
func (MinimumVersionConstraints) SatisfiedBy ¶
func (c MinimumVersionConstraints) SatisfiedBy(base *semver.Version) (bool, error)
type Module ¶
type Module struct {
common.KubeModule
TargetVersion *semver.Version
// Stage restricts this run to one stage of the flow. Empty runs every stage
// in order on this machine, which is what a single-node cluster does and
// what this module did before an upgrade could be scheduled across nodes.
Stage string
}
type Placement ¶
type Placement string
Placement is where a stage's tasks run. It is a property of the stage, never of a task: the same task placed in a different stage runs somewhere else, and nothing about the task changes.
const ( // PlacementAdmin runs on the control node alone. PlacementAdmin Placement = "admin" // PlacementWorkers runs on every compute node and not on the control node. PlacementWorkers Placement = "workers" // PlacementAllNodes runs on every node, compute nodes before the control // node. PlacementAllNodes Placement = "all-nodes" )
func (Placement) RunsOnWorkers ¶
RunsOnWorkers reports whether compute nodes take part in this stage.
type Plan ¶
type Plan struct {
// Version is the target this plan upgrades to. A node checks it before
// running anything: a plan is only meaningful to the binary that made it.
Version string `json:"version"`
Stages []PlanStage `json:"stages"`
}
A Plan is one version's upgrade laid out over the stages of the flow.
The stages are not derived from anything: they are UpgradeFlow, in order, every one of them, whether or not this version puts any tasks in them. What a version contributes is the task list inside each stage. So two releases produce plans with the same shape and different contents, and "which stages are there" has one answer for the whole system rather than one per release.
func TasksForStage ¶
TasksForStage resolves a stage name against the plan for target and returns the tasks in it.
What makes the answer the same one the control node scheduled is that both derived it from the same olares-cli version, which the orchestrator checks before it dispatches anything; see the daemon's checkWorkersCanUpgrade.
func (Plan) StageNames ¶
StageNames lists the stages in execution order.
type PlanStage ¶
type PlanStage struct {
Name string `json:"name"`
Placement Placement `json:"placement"`
MaxParallel int `json:"maxParallel,omitempty"`
TimeoutSeconds int `json:"timeoutSeconds,omitempty"`
AwaitRestart bool `json:"awaitRestart,omitempty"`
Desc string `json:"desc,omitempty"`
Tasks []string `json:"tasks"`
// contains filtered or unexported fields
}
PlanStage is one stage of the flow with the tasks this version put in it.
type PrecheckModule ¶
type PrecheckModule struct {
common.KubeModule
}
func (*PrecheckModule) Init ¶
func (m *PrecheckModule) Init()
type Stage ¶
type Stage struct {
Name string `json:"name"`
Placement Placement `json:"placement"`
// MaxParallel is how many nodes may be inside this stage at once. Zero
// means no limit.
//
// It is a count rather than a serial flag because the thing being
// expressed is how much of the cluster this stage may take away at a time,
// and that is not a yes-or-no on anything bigger than a couple of nodes.
// One is the strictest answer and the right one for work that costs the
// cluster something while it happens — replacing a container runtime,
// installing a GPU driver, rebooting — but on twenty nodes "one at a
// time" is an afternoon and "all at once" is an outage.
//
// A limit also changes what happens after a failure: a bounded stage stops
// giving the work to new nodes, because the reason it was bounded is that
// running it costs something. An unbounded one has already given it to
// everyone.
MaxParallel int `json:"maxParallel,omitempty"`
// TimeoutSeconds is how long one node may take over this stage. Zero
// leaves it to the daemon's default.
//
// It belongs to the flow rather than to olaresd because the flow is where
// the work is known. The daemon can only pick one number for every stage,
// and there is no such number: notify-start does nothing and
// upgrade-cluster upgrades every chart in the cluster and then waits for
// the pods. A bound loose enough for the second is not a bound at all for
// the first.
TimeoutSeconds int `json:"timeoutSeconds,omitempty"`
// AwaitRestart says the tasks here may take the machine down, so the
// stage is not over when olares-cli exits — it is over when every node
// that went down is back and Ready.
//
// Rebooting is the case: olares-cli issues the reboot and returns
// immediately, a moment before the machine stops answering. Without this
// the orchestrator reads that as the node being finished, and a stage
// limited to one node at a time reboots the next one while the previous
// is still coming up — which is exactly what MaxParallel was set to
// prevent.
AwaitRestart bool `json:"awaitRestart,omitempty"`
// Desc is what this point in the flow is for, shown to whoever is
// watching an upgrade rather than reading this file.
Desc string `json:"desc,omitempty"`
}
Stage is one point in the flow: a name, where its tasks run, and how.
func StageByName ¶
StageByName finds a stage of the flow.
type VersionConstraints ¶
type VersionSpec ¶
type VersionSpec struct {
Version string `json:"version"`
Major uint64 `json:"major"`
Minor uint64 `json:"minor"`
Patch uint64 `json:"patch"`
ReleaseType string `json:"releaseType"`
ReleaseNum int `json:"releaseNum"`
PreRelease bool `json:"prerelease"`
AddedBreakingChange bool `json:"addedBreakingChange"`
NeedRestart bool `json:"needRestart"`
MinimumUpgradableVersions MinimumVersionConstraints `json:"minimumUpgradableVersions"`
}
func CurrentVersionSpec ¶
func CurrentVersionSpec() (spec *VersionSpec, err error)
Source Files
¶
- 1_12_0_20250702.go
- 1_12_0_20250723.go
- 1_12_0_20250730.go
- 1_12_1.go
- 1_12_1_20250826.go
- 1_12_2.go
- 1_12_2_20250929.go
- 1_12_2_20251013.go
- 1_12_2_20251020.go
- 1_12_3_20251112.go
- 1_12_3_20251114.go
- 1_12_3_20251118.go
- 1_12_3_20251126.go
- 1_12_3_20251127.go
- 1_12_3_20251203.go
- 1_12_3_20251217.go
- 1_12_4.go
- 1_12_5_20260225.go
- 1_12_6.go
- 1_12_6_20260327.go
- 1_12_6_20260408.go
- 1_12_7.go
- 1_12_7_20260413.go
- 1_12_7_20260513.go
- 1_12_7_20260514.go
- 1_12_7_20260520.go
- 1_12_7_20260525.go
- 1_12_7_20260527.go
- 1_12_7_20260601.go
- 1_12_7_20260603.go
- 1_12_7_20260604.go
- 1_12_7_20260605.go
- 1_12_7_20260610.go
- 1_12_7_20260618.go
- 1_12_7_20260622.go
- 1_12_7_20260624.go
- 1_12_7_20260625.go
- 1_12_7_20260626.go
- 1_12_7_20260629.go
- 1_12_7_20260701.go
- 1_12_7_20260709.go
- 1_12_7_20260723.go
- 1_12_7_20260729.go
- 1_12_7_20260731.go
- 1_12_7_20260803.go
- 1_12_7_20260811.go
- 1_12_7_20260812.go
- 1_12_7_20260817.go
- 1_12_7_20260819.go
- 1_12_7_20260824.go
- 1_12_7_20260827.go
- 1_12_7_20260902.go
- 1_12_7_20260904.go
- 1_12_7_20260908.go
- 1_12_7_20260921.go
- 1_12_8_20261010.go
- 1_12_8_20261019.go
- 1_12_8_20261020.go
- 1_12_8_20261023.go
- 1_12_9.go
- 1_12_9_20261102.go
- 1_12_9_20261118.go
- apply_gpu_binding_crd.go
- base.go
- deenvy_edge_recreate.go
- envoy_allowlist.go
- extensions.go
- gpu_stages.go
- interfaces.go
- juicefs_xattr.go
- macvlan_dhcp.go
- macvlan_fixed_mac_upgrade.go
- macvlan_preflight.go
- migrate_gpu_bindings.go
- migrate_intel_dgpu_hami.go
- modules.go
- plan.go
- restart_nvidia_pods.go
- retag_legacy_amdgpu_image.go
- stage.go
- task_set.go
- version.go