Skip to content

Commit

Permalink
Merge pull request #4 from openebs/port-forwarding-etfw
Browse files Browse the repository at this point in the history
fix: handle port forwarding on etfw gracefully
  • Loading branch information
blaisedias authored Jul 5, 2024
2 parents 39ecf8b + 399909a commit dbb3adc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions common/k8s_portforward/port-forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,20 @@ func PortForwardService(svcName string, namespace string, port int) (string, err
}

func TryPortForwardNode(address string, port int) string {
// On some deployments port forwarding is not enabled
enabled := false
val, defined := os.LookupEnv("e2e_port_forwarding_enabled")
if defined {
switch val {
case "True", "true", "Yes", "yes", "y", "Y", "1":
enabled = true
default:
enabled = false
}
}
if !enabled {
return fmt.Sprintf("%s:%d", address, port)
}
addrPort, err := PortForwardNode(address, port)
if err != nil {
log.Log.Info(fmt.Sprintf("TryPortForwardNode: falling back to %s:%v", address, port))
Expand Down

0 comments on commit dbb3adc

Please sign in to comment.