Skip to content
Permalink
Browse files

Add --control-plane docs

Updates behaviour for --control-plane, where a new port is
only bound if the user-value for the flag has changed.

Thanks to @LucasRoesler for the hint.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information...
alexellis committed Sep 4, 2019
1 parent 09d1ec7 commit 5d9330c259b84d6957c6a5b291e5622263ec876d
Showing with 17 additions and 4 deletions.
  1. +7 −0 README.md
  2. +7 −3 cmd/server.go
  3. +3 −1 pkg/server/server.go
@@ -289,6 +289,13 @@ Exit-node:
while [ true ] ; do sleep 5 && inlets server --upstream=http://192.168.0.28:8080 ; done
```

## Bind a different port for the control-plane

You can bind two separate TCP ports for the user-facing port and the tunnel.

* `--port` - the port for users to connect to and for serving data, i.e. the *Data Plane*
* `--control-plane` - the port for the websocket to connect to i.e. the *Control Plane*

### Docker & Kubernetes application development

Docker images are published for `x86_64` and `armhf`
@@ -74,9 +74,13 @@ func runServer(cmd *cobra.Command, _ []string) error {
return errors.Wrap(err, "failed to get the 'port' value.")
}

controlPort, err := cmd.Flags().GetInt("control-port")
if err != nil {
return errors.Wrap(err, "failed to get the 'control-port' value.")
controlPort := port
if cmd.Flags().Changed("control-port") {
val, err := cmd.Flags().GetInt("control-port")
if err != nil {
return errors.Wrap(err, "failed to get the 'control-port' value.")
}
controlPort = val
}

disableWrapTransport, err := cmd.Flags().GetBool("disable-transport-wrapping")
@@ -43,7 +43,9 @@ func (s *Server) Serve() {
http.HandleFunc("/", s.proxy)
http.HandleFunc("/tunnel", s.tunnel)

log.Printf("Listening on :%d\n", s.Port)
log.Printf("Control Plane Listening on :%d\n", s.ControlPort)
log.Printf("Data Plane Listening on :%d\n", s.Port)

if err := http.ListenAndServe(fmt.Sprintf(":%d", s.Port), nil); err != nil {
log.Fatal(err)
}

0 comments on commit 5d9330c

Please sign in to comment.
You can’t perform that action at this time.