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()
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)
def setUp(self): super().setUp() self.kubectl = KubectlOperator()
def setUp(self): self.kubectl = KubectlOperator()