Skip to content

Commit

Permalink
allow more than one kurun instances running simultaneously
Browse files Browse the repository at this point in the history
  • Loading branch information
pepov committed Apr 3, 2020
1 parent a0294ce commit 4a3222a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
.idea
6 changes: 4 additions & 2 deletions kurun.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var tlsSecret string
var podEnv []string
var namespace string
var labels []string
var localPort int

func getKubeConfig() (*rest.Config, error) {
// If an env variable is specified with the config locaiton, use that
Expand Down Expand Up @@ -422,7 +423,7 @@ var portForwardCmd = &cobra.Command{
kubectlArgs = []string{
"port-forward",
"deployment/" + deploymentName,
"8444:" + fmt.Sprint(inletsPort),
fmt.Sprint(localPort) + ":" + fmt.Sprint(inletsPort),
fmt.Sprintf("--namespace=%s", namespace),
}

Expand All @@ -444,7 +445,7 @@ var portForwardCmd = &cobra.Command{

upstream := args[0]

inletsCommand := exec.Command("inlets", "client", "--upstream", upstream, "--remote", "127.0.0.1:8444", "--token", token)
inletsCommand := exec.Command("inlets", "client", "--upstream", upstream, "--remote", "127.0.0.1:"+fmt.Sprint(localPort), "--token", token)
inletsCommand.Stderr = os.Stderr
inletsCommand.Stdout = os.Stdout

Expand All @@ -468,6 +469,7 @@ func main() {
portForwardCmd.PersistentFlags().StringVar(&serviceName, "servicename", "kurun", "Service name to set for the service")
portForwardCmd.PersistentFlags().StringSliceVarP(&labels, "label", "l", []string{}, "Pod labels to add")
portForwardCmd.PersistentFlags().StringVar(&tlsSecret, "tlssecret", "", "Use the certs for ghostunnel")
portForwardCmd.PersistentFlags().IntVar(&localPort, "localport", 8444, "Local port to use for port-forwarding")

rootCmd := &cobra.Command{Use: "kurun"}
rootCmd.PersistentFlags().StringVar(&namespace, "namespace", "default", "Namespace to use for the Pod/Service")
Expand Down

0 comments on commit 4a3222a

Please sign in to comment.