Skip to content

Commit 119434e

Browse files
[release-line-0.3.21] Limit cometbft load balancer ports to only those actually used (#1191)
backport from #1190 [static] Signed-off-by: Moritz Kiefer <[email protected]> Co-authored-by: Moritz Kiefer <[email protected]>
1 parent e7fbc1d commit 119434e

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

cluster/pulumi/common-sv/src/synchronizer/cometBftNodeConfigs.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class CometBftNodeConfigs {
3535
privateKey: staticConf.privateKey,
3636
identifier: this.nodeIdentifier,
3737
externalAddress: this.p2pExternalAddress(staticConf.nodeIndex),
38-
istioPort: this.istioExternalPort(staticConf.nodeIndex),
38+
istioPort: istioCometbftExternalPort(this._domainMigrationId, staticConf.nodeIndex),
3939
retainBlocks: staticConf.retainBlocks,
4040
validator: staticConf.validator,
4141
};
@@ -80,13 +80,13 @@ export class CometBftNodeConfigs {
8080
}
8181

8282
private p2pExternalAddress(nodeIndex: number): string {
83-
return `${CLUSTER_HOSTNAME}:${this.istioExternalPort(nodeIndex)}`;
84-
}
85-
86-
private istioExternalPort(nodeIndex: number) {
87-
// TODO(#10482) Revisit port scheme
88-
return nodeIndex >= 10
89-
? Number(`26${this._domainMigrationId}${nodeIndex}`)
90-
: Number(`26${this._domainMigrationId}${nodeIndex}6`);
83+
return `${CLUSTER_HOSTNAME}:${istioCometbftExternalPort(this._domainMigrationId, nodeIndex)}`;
9184
}
9285
}
86+
87+
export const istioCometbftExternalPort = (migrationId: number, nodeIndex: number): number => {
88+
// TODO(DACH-NY/canton-network-node#10482) Revisit port scheme
89+
return nodeIndex >= 10
90+
? Number(`26${migrationId}${nodeIndex}`)
91+
: Number(`26${migrationId}${nodeIndex}6`);
92+
};

cluster/pulumi/infra/src/istio.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import * as k8s from '@pulumi/kubernetes';
22
import * as pulumi from '@pulumi/pulumi';
33
import { local } from '@pulumi/command';
4+
import { dsoSize, istioCometbftExternalPort } from 'splice-pulumi-common-sv';
45
import { PodMonitor, ServiceMonitor } from 'splice-pulumi-common/src/metrics';
56

67
import {
78
activeVersion,
89
DecentralizedSynchronizerUpgradeConfig,
10+
DeploySvRunbook,
911
ExactNamespace,
1012
getDnsNames,
1113
HELM_MAX_HISTORY_SIZE,
@@ -158,13 +160,18 @@ function configureInternalGatewayService(
158160
) {
159161
const externalIPRanges = loadIPRanges();
160162
// see notes when installing a CometBft node in the full deployment
161-
const cometBftIngressPorts = Array.from(
162-
Array(DecentralizedSynchronizerUpgradeConfig.highestMigrationId + 1).keys()
163-
).flatMap((domain: number) => {
164-
return Array.from(Array(10).keys()).map(node => {
165-
return ingressPort(`cometbft-${domain}-${node}-gw`, Number(`26${domain}${node}6`));
163+
const cometBftIngressPorts = DecentralizedSynchronizerUpgradeConfig.runningMigrations()
164+
.map(migrationInfo => migrationInfo.id)
165+
.flatMap((domain: number) => {
166+
return (DeploySvRunbook ? [0] : [])
167+
.concat(Array.from(Array(dsoSize).keys()).map(n => n + 1))
168+
.map(node => {
169+
return ingressPort(
170+
`cometbft-${domain}-${node}-gw`,
171+
istioCometbftExternalPort(domain, node)
172+
);
173+
});
166174
});
167-
});
168175
return configureGatewayService(
169176
ingressNs,
170177
ingressIp,

0 commit comments

Comments
 (0)