Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cli.Command{ Name: "expose", Usage: "expose local service", HideHelpCommand: true, Flags: []cli.Flag{ app.NameFlag, app.NamespaceFlag, app.KubeconfigFlag, &cli.StringSliceFlag{ Name: "port", Usage: "local port(s) to expose", Required: true, }, }, Action: func(c *cli.Context) error { client := app.MustClient(c) name := app.Name(c) namespace := app.Namespace(c) if namespace == "" { namespace = client.Namespace() } ports := c.StringSlice("port") tunnels := map[int]int{} for _, p := range ports { pair := strings.Split(p, ":") if len(pair) > 2 { return errors.New("invalid port mapping") } if len(pair) == 1 { pair = []string{pair[0], pair[0]} } source, err := strconv.Atoi(pair[0]) if err != nil { return err } target, err := strconv.Atoi(pair[1]) if err != nil { return err } tunnels[source] = target } return createTCPTunnel(c.Context, client, namespace, name, tunnels) }, }
Functions ¶
This section is empty.
Types ¶
type TunnelOptions ¶
type TunnelOptions struct { ServiceType corev1.ServiceType ServicePorts map[int]int }
Click to show internal directories.
Click to hide internal directories.