Skip to content

Commit

Permalink
fix: stop networkd and pods before leaving etcd on upgrade
Browse files Browse the repository at this point in the history
The change is essentially same as #3590, but applied to the upgrade path
which is very similar to the reset path.

We have to stop networkd (and remove the VIP/lease on the VIP) before we
leave and stop etcd. Plus we stop the kube-apiserver before the etcd is
stopped, so that we don't have unhealthy kube-apiserver.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
(cherry picked from commit 0825cf1)
  • Loading branch information
smira committed May 20, 2021
1 parent 1e9496b commit 70ee15b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@ func (*Sequencer) StageUpgrade(r runtime.Runtime, in *machineapi.UpgradeRequest)
case runtime.ModeContainer:
return nil
default:
phases = phases.AppendWhen(
!in.GetPreserve() && (r.Config().Machine().Type() != machine.TypeJoin),
"leave",
LeaveEtcd,
).Append(
phases = phases.Append(
"cleanup",
StopAllPods,
StopNetworkd,
).AppendWhen(
!in.GetPreserve() && (r.Config().Machine().Type() != machine.TypeJoin),
"leave",
LeaveEtcd,
).AppendList(
stopAllPhaselist(r),
).Append(
Expand All @@ -401,10 +401,6 @@ func (*Sequencer) Upgrade(r runtime.Runtime, in *machineapi.UpgradeRequest) []ru
phases = phases.Append(
"drain",
CordonAndDrainNode,
).AppendWhen(
!in.GetPreserve() && (r.Config().Machine().Type() != machine.TypeJoin),
"leave",
LeaveEtcd,
).AppendWhen(
!in.GetPreserve(),
"cleanup",
Expand All @@ -415,6 +411,10 @@ func (*Sequencer) Upgrade(r runtime.Runtime, in *machineapi.UpgradeRequest) []ru
"cleanup",
StopAllPods,
StopNetworkd,
).AppendWhen(
!in.GetPreserve() && (r.Config().Machine().Type() != machine.TypeJoin),
"leave",
LeaveEtcd,
).Append(
"stopServices",
StopServicesForUpgrade,
Expand Down

0 comments on commit 70ee15b

Please sign in to comment.