Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
remove unneeded etcd upgrade steps (#2086)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Nisbet authored Sep 3, 2020
1 parent 13836e7 commit 6ab4829
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
12 changes: 3 additions & 9 deletions lib/update/cluster/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (s *PlanSuite) TestPlanWithRuntimeAppsUpdate(c *check.C) {
params.coreDNS("/bootstrap"),
params.masters(leadMaster, updates[0:1], gravityPackage, "id", "/coredns"),
params.nodes(updates[2:], leadMaster.Server, gravityPackage, "id", "/masters"),
params.etcd(leadMaster.Server, updates[0:1], updates[2:], *params.targetStep.etcd),
params.etcd(leadMaster.Server, updates[0:1], *params.targetStep.etcd),
params.config("/etcd"),
params.runtime(runtimeUpdates, "/config"),
params.migration("/runtime"),
Expand Down Expand Up @@ -393,7 +393,6 @@ func (s *PlanSuite) TestPlanWithIntermediateRuntimeUpdate(c *check.C) {
params.nodes(intermediateNodes, intermediateLeadMaster.Server, intermediateGravityPackage, "id2", "/masters"),
params.etcd(intermediateLeadMaster.Server,
intermediateOtherMasters,
intermediateNodes,
*params.steps[0].etcd),
params.config("/etcd"),
params.runtime(intermediateRuntimeUpdates, "/config"),
Expand All @@ -403,7 +402,7 @@ func (s *PlanSuite) TestPlanWithIntermediateRuntimeUpdate(c *check.C) {
params.coreDNS("/bootstrap"),
params.masters(leadMaster, otherMasters, gravityPackage, "id", "/coredns"),
params.nodes(nodes, leadMaster.Server, gravityPackage, "id", "/masters"),
params.etcd(leadMaster.Server, otherMasters, nodes, *params.targetStep.etcd),
params.etcd(leadMaster.Server, otherMasters, *params.targetStep.etcd),
params.config("/etcd"),
params.runtime(runtimeUpdates, "/config"),
),
Expand Down Expand Up @@ -1126,7 +1125,7 @@ func (r *params) bootstrapNodeVersioned(server storage.UpdateServer, version str
}
}

func (r params) etcd(leadMaster storage.Server, otherMasters, nodes []storage.UpdateServer, etcd etcdVersion) storage.OperationPhase {
func (r params) etcd(leadMaster storage.Server, otherMasters []storage.UpdateServer, etcd etcdVersion) storage.OperationPhase {
return storage.OperationPhase{
ID: "/etcd",
Description: fmt.Sprintf("Upgrade etcd %v to %v", etcd.installed, etcd.update),
Expand All @@ -1147,7 +1146,6 @@ func (r params) etcd(leadMaster storage.Server, otherMasters, nodes []storage.Up
r.etcdShutdownNode(leadMaster, true),
// FIXME: assumes len(otherMasters) == 1
r.etcdShutdownNode(otherMasters[0].Server, false),
r.etcdShutdownWorkerNode(nodes[0].Server),
},
},
{
Expand All @@ -1157,8 +1155,6 @@ func (r params) etcd(leadMaster storage.Server, otherMasters, nodes []storage.Up
r.etcdUpgradeNode(leadMaster),
// FIXME: assumes len(otherMasters) == 1
r.etcdUpgradeNode(otherMasters[0].Server),
// upgrade regular nodes
r.etcdUpgradeNode(nodes[0].Server),
},
},
{
Expand All @@ -1177,8 +1173,6 @@ func (r params) etcd(leadMaster storage.Server, otherMasters, nodes []storage.Up
r.etcdRestartLeaderNode(leadMaster),
// FIXME: assumes len(otherMasters) == 1
r.etcdRestartNode(otherMasters[0].Server),
// upgrade regular nodes
r.etcdRestartNode(nodes[0].Server),
r.etcdRestartGravity(leadMaster),
},
},
Expand Down
17 changes: 2 additions & 15 deletions lib/update/cluster/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,7 @@ func (r updateStep) addTo(root *builder.Phase, masters, nodes []storage.UpdateSe
root.AddParallel(r.etcdPhase(
leadMaster.Server,
serversToStorage(masters[1:]...),
serversToStorage(nodes...)),
)
))
}
// The "config" phase pulls new teleport master config packages used
// by gravity-sites on master nodes: it needs to run *after* system
Expand Down Expand Up @@ -584,7 +583,7 @@ func (r updateStep) configPhase(nodes []storage.Server) *builder.Phase {
return root
}

func (r updateStep) etcdPhase(leadMaster storage.Server, otherMasters []storage.Server, workers []storage.Server) *builder.Phase {
func (r updateStep) etcdPhase(leadMaster storage.Server, otherMasters []storage.Server) *builder.Phase {
description := fmt.Sprintf("Upgrade etcd %v to %v", r.etcd.installed, r.etcd.update)
if r.etcd.installed == "" {
description = fmt.Sprintf("Upgrade etcd to %v", r.etcd.update)
Expand Down Expand Up @@ -623,10 +622,6 @@ func (r updateStep) etcdPhase(leadMaster storage.Server, otherMasters []storage.
p := r.etcdShutdownNodePhase(server, false)
shutdownEtcd.AddWithDependency(builder.DependencyForServer(backupEtcd, server), p)
}
for _, server := range workers {
p := r.etcdShutdownNodePhase(server, false)
shutdownEtcd.AddParallel(p)
}

root.AddParallel(shutdownEtcd)

Expand All @@ -645,10 +640,6 @@ func (r updateStep) etcdPhase(leadMaster storage.Server, otherMasters []storage.
p := r.etcdUpgradePhase(server)
upgradeServers.AddWithDependency(builder.DependencyForServer(shutdownEtcd, server), p)
}
for _, server := range workers {
p := r.etcdUpgradePhase(server)
upgradeServers.AddWithDependency(builder.DependencyForServer(shutdownEtcd, server), p)
}
root.AddParallel(upgradeServers)

// Restore kubernetes data
Expand Down Expand Up @@ -676,10 +667,6 @@ func (r updateStep) etcdPhase(leadMaster storage.Server, otherMasters []storage.
p := r.etcdRestartPhase(server)
restartMasters.AddWithDependency(builder.DependencyForServer(upgradeServers, server), p)
}
for _, server := range workers {
p := r.etcdRestartPhase(server)
restartMasters.AddWithDependency(builder.DependencyForServer(upgradeServers, server), p)
}

// also restart gravity-site, so that elections get unbroken
restartMasters.AddParallelRaw(storage.OperationPhase{
Expand Down

0 comments on commit 6ab4829

Please sign in to comment.