Skip to content

Commit

Permalink
Update to work with latest version of telepresence
Browse files Browse the repository at this point in the history
  • Loading branch information
ofpiyush committed Oct 28, 2018
1 parent a9ef9be commit 45f289e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions telepresence/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def parse_args(args=None) -> argparse.Namespace:
"'vpn-tcp': all local processes can route TCP "
"traffic to the remote cluster. Requires root.\n"
"'container': used with --docker-run.\n"
"'none': traffic routing is not handled by this process.\n"
"\n"
"Default is 'vpn-tcp', or 'container' when --docker-run is used.\n"
"\nFor more details see "
Expand Down
23 changes: 22 additions & 1 deletion telepresence/outbound/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from telepresence.outbound.container import SUDO_FOR_DOCKER, run_docker_command
from telepresence.outbound.local import launch_inject, launch_vpn
from telepresence.outbound.local import launch_inject, launch_vpn, launch_none
from telepresence.runner import Runner


Expand Down Expand Up @@ -91,6 +91,24 @@ def launch(runner_, remote_info, env, _socks_port, ssh, mount_dir):
return launch


def setup_none(runner: Runner, args):
if runner.chatty:
runner.show(
"Starting proxy with method 'none', which has the following "
"limitations: No network connections are made. "
"It assumes you're managing network independent of telepresence. "
"For a full list of method limitations see "
"https://telepresence.io/reference/methods.html"
)
command = args.run or ["bash", "--norc"]

def launch(runner_, _remote_info, env, _socks_port, _ssh, _mount_dir):
return launch_none(
runner_, command, env
)
return launch


def setup(runner: Runner, args):
if args.method == "inject-tcp":
return setup_inject(runner, args)
Expand All @@ -101,4 +119,7 @@ def setup(runner: Runner, args):
if args.method == "container":
return setup_container(runner, args)

if args.method == "none":
return setup_none(runner, args)

assert False, args.method
12 changes: 12 additions & 0 deletions telepresence/outbound/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,15 @@ def launch_vpn(
"Terminate local process", terminate_local_process, runner, process
)
return process


def launch_none(
runner: Runner,
command: List[str],
env_overrides: Dict[str, str]):
env = get_local_env(runner, env_overrides, False)
process = Popen(command, env=env)
runner.add_cleanup(
"Terminate local process", terminate_local_process, runner, process
)
return process

0 comments on commit 45f289e

Please sign in to comment.