Skip to content

Commit 6df8928

Browse files
fix: updated to allow node client to connect to remote cluster that doesn't have a LoadBalancer (#82)
Signed-off-by: Jeromy Cannon <[email protected]>
1 parent 402a22f commit 6df8928

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Kubernetes Namespace : solo
205205
* If it fails, ensure you have enough resources allocated for Docker and restart.
206206

207207
```
208-
$ solo network deploy --fst-chart-version 0.22.0
208+
$ solo network deploy
209209
210210
******************************* Solo *********************************************
211211
Version : 0.19.1
@@ -422,7 +422,7 @@ In a separate terminal, you may run `k9s` to view the pod status.
422422
* Deploy helm chart with Hedera network components
423423

424424
```
425-
$ solo network deploy --fst-chart-version 0.22.0
425+
$ solo network deploy
426426
427427
# output is similar to example-1
428428
```

src/core/account_manager.mjs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,12 @@ export class AccountManager {
162162
let localPort = constants.LOCAL_NODE_START_PORT
163163

164164
for (const serviceObject of serviceMap.values()) {
165-
if (!this.isLocalhost() && !serviceObject.loadBalancerIp) {
166-
throw new Error(
167-
`Expected service ${serviceObject.name} to have a loadBalancerIP set for basepath ${this.k8.kubeClient.basePath}`)
168-
}
169-
const host = this.isLocalhost() ? '127.0.0.1' : serviceObject.loadBalancerIp
165+
const usePortForward = !(serviceObject.loadBalancerIp)
166+
const host = usePortForward ? '127.0.0.1' : serviceObject.loadBalancerIp
170167
const port = serviceObject.grpcPort
171-
const targetPort = this.isLocalhost() ? localPort : port
168+
const targetPort = usePortForward ? localPort : port
172169

173-
if (this.isLocalhost()) {
170+
if (usePortForward) {
174171
this.portForwards.push(await this.k8.portForward(serviceObject.podName, localPort, port))
175172
}
176173

@@ -190,14 +187,6 @@ export class AccountManager {
190187
}
191188
}
192189

193-
/**
194-
* returns true if we detect that we are running against a local Kubernetes cluster
195-
* @returns boolean true if we are running against a local Kubernetes cluster, else false
196-
*/
197-
isLocalhost () {
198-
return this.k8.kubeClient.basePath.includes('127.0.0.1')
199-
}
200-
201190
/**
202191
* Gets a Map of the Hedera node services and the attributes needed
203192
* @param namespace the namespace of the fullstack network deployment

0 commit comments

Comments
 (0)