Skip to content
Open
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
13 changes: 12 additions & 1 deletion backend/internal/deployment/kubedeployer/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,18 @@ func (c *Client) DeployNode(ctx context.Context, cluster *Cluster, node Node, ma
return fmt.Errorf("failed to get leader node IP: %v", err)
}

leaderIP = leaderNode.IP
if leaderNode.Healthy {
leaderIP = leaderNode.IP
} else {
// fallback to a healthy master if the leader is not healthy
for _, n := range cluster.Nodes {
if n.Type == NodeTypeMaster && n.Healthy {
leaderIP = n.IP
log.Debug().Str("node_name", n.Name).Str("node_ip", n.IP).Msg("Using alternative healthy master")
break
}
Comment on lines +101 to +106
Copy link
Contributor

@SalmaElsoly SalmaElsoly Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen if there was no alternative node? I think we should return an error in that case

}
}
}

if cluster.Token == "" {
Expand Down
Loading