Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.14] OCPBUGS-35912: Fix race to mark node Joined #860

Open
wants to merge 3 commits into
base: release-4.14
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,8 @@ func (i *installer) waitForMasterNodes(ctx context.Context, minMasterNodes int,
}
if err = i.updateReadyMasters(nodes, &readyMasters, inventoryHostsMap); err != nil {
i.log.WithError(err).Warnf("Failed to update ready with masters")
// Re-fetch inventory on next invocation
inventoryHostsMap = nil
return false
}
i.log.Infof("Found %d ready master nodes", len(readyMasters))
Expand Down Expand Up @@ -681,16 +683,18 @@ func (i *installer) updateReadyMasters(nodes *v1.NodeList, readyMasters *[]strin
ctx := utils.GenerateRequestContext()
log := utils.RequestIDLogger(ctx, i.log)
log.Infof("Found a new ready master node %s with id %s", node.Name, node.Status.NodeInfo.SystemUUID)
*readyMasters = append(*readyMasters, node.Name)

host, ok := common.HostMatchByNameOrIPAddress(node, inventoryHostsMap, knownIpAddresses)
if ok && (host.Host.Status == nil || *host.Host.Status != models.HostStatusInstalled) {
if err := i.inventoryClient.UpdateHostInstallProgress(ctx, host.Host.InfraEnvID.String(), host.Host.ID.String(), models.HostStageJoined, ""); err != nil {
log.Errorf("Failed to update node installation status, %s", err)
return err
}
}
*readyMasters = append(*readyMasters, node.Name)
if !ok {
return fmt.Errorf("Node %s is not in inventory hosts", node.Name)
}
ctx = utils.GenerateRequestContext()
if err := i.inventoryClient.UpdateHostInstallProgress(ctx, host.Host.InfraEnvID.String(), host.Host.ID.String(), models.HostStageJoined, ""); err != nil {
utils.RequestIDLogger(ctx, i.log).Errorf("Failed to update node installation status, %s", err)
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/inventory_client/inventory_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,15 @@ func CreateInventoryClientWithDelay(clusterId string, inventoryURL string, pullS
rehttp.RetryAny(
rehttp.RetryAll(
rehttp.RetryMaxRetries(minRetries),
rehttp.RetryStatusInterval(400, 404),
rehttp.RetryStatuses(404, 423, 425),
),
rehttp.RetryAll(
rehttp.RetryMaxRetries(maxRetries),
rehttp.RetryStatusInterval(405, 600),
rehttp.RetryStatuses(408, 429),
),
rehttp.RetryAll(
rehttp.RetryMaxRetries(maxRetries),
rehttp.RetryStatusInterval(500, 600),
),
rehttp.RetryAll(
rehttp.RetryMaxRetries(maxRetries),
Expand Down