Skip to content

Commit

Permalink
fix: use a separate phase for the extensions installation
Browse files Browse the repository at this point in the history
Fixes: #505

This should make the UI more reliable.

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
Unix4ever committed Aug 20, 2024
1 parent cbfe7c9 commit d2387d9
Show file tree
Hide file tree
Showing 7 changed files with 427 additions and 416 deletions.
822 changes: 413 additions & 409 deletions client/api/omni/specs/omni.pb.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions client/api/omni/specs/omni.proto
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ message TalosUpgradeStatusSpec {
Done = 2;
Failed = 3;
Reverting = 4;
InstallingExtensions = 5;
}

// Current upgrade phase.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func talosUpgradePhaseString(phase specs.TalosUpgradeStatusSpec_Phase) string {
switch phase {
case specs.TalosUpgradeStatusSpec_Done:
c = color.GreenString
case specs.TalosUpgradeStatusSpec_Upgrading, specs.TalosUpgradeStatusSpec_Reverting:
case specs.TalosUpgradeStatusSpec_Upgrading, specs.TalosUpgradeStatusSpec_Reverting, specs.TalosUpgradeStatusSpec_InstallingExtensions:
c = color.HiYellowString
case specs.TalosUpgradeStatusSpec_Failed:
c = color.HiRedString
Expand Down
6 changes: 3 additions & 3 deletions cmd/integration-test/pkg/tests/talos.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@ func AssertTalosSchematicUpdateFlow(testCtx context.Context, client *client.Clie

// upgrade should start
rtestutils.AssertResources(ctx, t, client.Omni().State(), []resource.ID{clusterName}, func(r *omni.TalosUpgradeStatus, assert *assert.Assertions) {
assert.Equal(specs.TalosUpgradeStatusSpec_Upgrading, r.TypedSpec().Value.Phase, resourceDetails(r))
assert.NotEmpty(specs.TalosUpgradeStatusSpec_Upgrading, r.TypedSpec().Value.Step, resourceDetails(r))
assert.NotEmpty(specs.TalosUpgradeStatusSpec_Upgrading, r.TypedSpec().Value.Status, resourceDetails(r))
assert.Equal(specs.TalosUpgradeStatusSpec_InstallingExtensions, r.TypedSpec().Value.Phase, resourceDetails(r))
assert.NotEmpty(r.TypedSpec().Value.Step, resourceDetails(r))
assert.NotEmpty(r.TypedSpec().Value.Status, resourceDetails(r))
})

t.Log("upgrade is going")
Expand Down
1 change: 1 addition & 0 deletions frontend/src/api/omni/specs/omni.pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export enum TalosUpgradeStatusSpecPhase {
Done = 2,
Failed = 3,
Reverting = 4,
InstallingExtensions = 5,
}

export enum ControlPlaneStatusSpecConditionStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ included in the LICENSE file.
{{ talosUpgradeStatus.spec.last_upgrade_version }}
</span>
</template>
<template v-else>
<template v-else-if="talosUpgradeStatus.spec.phase === TalosUpgradeStatusSpecPhase.InstallingExtensions">
<span class="overview-box-title">
Installing Extensions
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,14 @@ func reconcileTalosUpdateStatus(ctx context.Context, r controller.ReaderWriter,
totalMachines := clusterMachines.Len()
pendingMachines := totalMachines - len(machinesToUpdate) + 1

if versionMismatch || schematicUpdates {
switch {
case !versionMismatch && schematicUpdates:
upgradeStatus.TypedSpec().Value.Phase = specs.TalosUpgradeStatusSpec_InstallingExtensions

fallthrough
case versionMismatch || schematicUpdates:
upgradeStatus.TypedSpec().Value.Status = fmt.Sprintf("updating machines %d/%d", pendingMachines, totalMachines)
} else {
default:
upgradeStatus.TypedSpec().Value.Phase = specs.TalosUpgradeStatusSpec_Reverting
upgradeStatus.TypedSpec().Value.Status = fmt.Sprintf("reverting update %d/%d", pendingMachines, totalMachines)
}
Expand Down

0 comments on commit d2387d9

Please sign in to comment.