Skip to content

fix: updated to allow node client to connect to remote cluster that doesn't have a LoadBalancer #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ Kubernetes Namespace : solo
* If it fails, ensure you have enough resources allocated for Docker and restart.

```
$ solo network deploy --fst-chart-version 0.22.0
$ solo network deploy
******************************* Solo *********************************************
Version : 0.19.1
Expand Down Expand Up @@ -422,7 +422,7 @@ In a separate terminal, you may run `k9s` to view the pod status.
* Deploy helm chart with Hedera network components

```
$ solo network deploy --fst-chart-version 0.22.0
$ solo network deploy
# output is similar to example-1
```
Expand Down
19 changes: 4 additions & 15 deletions src/core/account_manager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,12 @@ export class AccountManager {
let localPort = constants.LOCAL_NODE_START_PORT

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

if (this.isLocalhost()) {
if (usePortForward) {
this.portForwards.push(await this.k8.portForward(serviceObject.podName, localPort, port))
}

Expand All @@ -190,14 +187,6 @@ export class AccountManager {
}
}

/**
* returns true if we detect that we are running against a local Kubernetes cluster
* @returns boolean true if we are running against a local Kubernetes cluster, else false
*/
isLocalhost () {
return this.k8.kubeClient.basePath.includes('127.0.0.1')
}

/**
* Gets a Map of the Hedera node services and the attributes needed
* @param namespace the namespace of the fullstack network deployment
Expand Down