Skip to content

Commit

Permalink
Apply feedback from code review. Handle rebase conflict.
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekStrickland committed Apr 6, 2022
1 parent a7fe3fa commit 480b973
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
3 changes: 1 addition & 2 deletions nomad/node_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,8 @@ func (n *Node) GetClientAllocs(args *structs.NodeSpecificRequest,

// UpdateAlloc is used to update the client status of an allocation
func (n *Node) UpdateAlloc(args *structs.AllocUpdateRequest, reply *structs.GenericResponse) error {
var err error
// Ensure the connection was initiated by another client if TLS is used.
err = validateTLSCertificateLevel(n.srv, n.ctx, tlsCertificateLevelClient)
err := validateTLSCertificateLevel(n.srv, n.ctx, tlsCertificateLevelClient)
if err != nil {
return err
}
Expand Down
18 changes: 14 additions & 4 deletions scheduler/reconcile_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,22 @@ func (a allocSet) filterByTainted(taintedNodes map[string]*structs.Node, support

// Only compute reconnected for unknown, running, and failed since they need to go through the reconnect logic.
if supportsDisconnectedClients &&
alloc.ClientStatus != structs.AllocClientStatusPending &&
alloc.ClientStatus != structs.AllocClientStatusComplete &&
alloc.ClientStatus != structs.AllocClientStatusLost {
(alloc.ClientStatus == structs.AllocClientStatusUnknown ||
alloc.ClientStatus == structs.AllocClientStatusRunning ||
alloc.ClientStatus == structs.AllocClientStatusFailed) {
reconnected, expired = alloc.Reconnected()
}

// Failed reconnected allocs need to be added to reconnecting so that they
// can be handled as a failed reconnect.
if supportsDisconnectedClients &&
reconnected &&
alloc.DesiredStatus == structs.AllocDesiredStatusRun &&
alloc.ClientStatus == structs.AllocClientStatusFailed {
reconnecting[alloc.ID] = alloc
continue
}

// Terminal allocs, if not reconnected, are always untainted as they
// should never be migrated.
if alloc.TerminalStatus() && !reconnected {
Expand All @@ -255,7 +265,7 @@ func (a allocSet) filterByTainted(taintedNodes map[string]*structs.Node, support
continue
}

// Ignore unknown allocs
// Ignore unknown allocs that we want to reconnect eventually.
if supportsDisconnectedClients &&
alloc.ClientStatus == structs.AllocClientStatusUnknown &&
alloc.DesiredStatus == structs.AllocDesiredStatusRun {
Expand Down

0 comments on commit 480b973

Please sign in to comment.