コード例 #1
0
 def __init__(self,
              config=None,
              filepath=None,
              manager_path=None,
              dry_run=False):
     self.config = config
     self.filepath = filepath
     self.manager_path = manager_path
     self.dry_run = dry_run
     self.kubectl = KubectlOperator()
     self.helm = HelmOperator()
     self.docker = DockerOperator()
     self.compose = ComposeOperator()
コード例 #2
0
def port_forward(port, namespace, deployment_type, release_name):
    """If you deploy Polyaxon using ClusterIP, you can use this command
    to access the gateway through `localhost:port`.
    """
    from polyaxon.deploy.operators.kubectl import KubectlOperator

    if not port and deployment_type in [
            DeploymentTypes.MICRO_K8S,
            DeploymentTypes.MINIKUBE,
    ]:
        port = 31833
    port = port or 8000
    namespace = namespace or "polyaxon"
    release_name = release_name or "polyaxon"

    kubectl = KubectlOperator()
    args = [
        "port-forward",
        "-n",
        namespace,
        "svc/{}-polyaxon-gateway".format(release_name),
        "{}:80".format(port),
    ]

    try:
        _config = ClientConfigManager.get_config_or_default()
    except Exception as e:
        handle_cli_error(e, message="Polyaxon load configuration.")
        Printer.print_header(
            "You can reset your config by running: polyaxon config purge")
        sys.exit(1)

    _config.host = "http://localhost:{}".format(port)
    ClientConfigManager.set_config(_config)
    CliConfigManager.purge()
    AuthConfigManager.purge()
    UserConfigManager.purge()
    Printer.print_header("Client configuration is updated!")
    Printer.print_success("Polyaxon will be available at: {}".format(
        _config.host))
    stdout = kubectl.execute(args=args,
                             is_json=False,
                             stream=settings.CLIENT_CONFIG.debug)
    click.echo(stdout)
コード例 #3
0
 def setUp(self):
     super().setUp()
     self.kubectl = KubectlOperator()
コード例 #4
0
ファイル: test_kubectl.py プロジェクト: x10-utils/polyaxon
 def setUp(self):
     self.kubectl = KubectlOperator()