refactor: getFirstMasterNode sorts nodes by name asc

This commit is contained in:
biersoeckli
2026-01-08 16:08:56 +01:00
parent 82077d3b96
commit e8069e874a
2 changed files with 4 additions and 3 deletions

View File

@@ -43,9 +43,10 @@ class ClusterService {
})();
}
async getMasterNode(): Promise<NodeInfoModel> {
async getFirstMasterNode(): Promise<NodeInfoModel> {
const nodes = await this.getNodeInfo();
return nodes.find(node => node.isMasterNode)!;
nodes.sort((a, b) => a.name.localeCompare(b.name));
return nodes.find(node => node.isMasterNode)!; // even on HA Cluster, only one node is returned
}
async setNodeStatus(nodeName: string, schedulable: boolean) {

View File

@@ -174,7 +174,7 @@ class RegistryService {
const deploymentName = 'registry';
const masterNode = await clusterService.getMasterNode();
const masterNode = await clusterService.getFirstMasterNode();
if (useLocalStorage && !masterNode) {
throw new ServiceException("Cannot deploy registry with local storage, because could not evaluate master node.");
}