Plumb in deployer
This commit is contained in:
parent
7285bea43f
commit
5847cab1c0
@ -52,6 +52,10 @@ def command(ctx, include, exclude, env_file, cluster, deploy_to):
|
|||||||
|
|
||||||
if ctx.parent.obj.debug:
|
if ctx.parent.obj.debug:
|
||||||
print(f"ctx.parent.obj: {ctx.parent.obj}")
|
print(f"ctx.parent.obj: {ctx.parent.obj}")
|
||||||
|
|
||||||
|
if deploy_to is None:
|
||||||
|
deploy_to = "compose"
|
||||||
|
|
||||||
ctx.obj = create_deploy_context(global_options2(ctx), stack, include, exclude, cluster, env_file, deploy_to)
|
ctx.obj = create_deploy_context(global_options2(ctx), stack, include, exclude, cluster, env_file, deploy_to)
|
||||||
# Subcommand is executed now, by the magic of click
|
# Subcommand is executed now, by the magic of click
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ from app.deployer import Deployer, DeployerException
|
|||||||
|
|
||||||
|
|
||||||
class DockerDeployer(Deployer):
|
class DockerDeployer(Deployer):
|
||||||
|
name: str = "compose"
|
||||||
|
|
||||||
def __init__(self, compose_files, compose_project_name, compose_env_file) -> None:
|
def __init__(self, compose_files, compose_project_name, compose_env_file) -> None:
|
||||||
self.docker = DockerClient(compose_files=compose_files, compose_project_name=compose_project_name,
|
self.docker = DockerClient(compose_files=compose_files, compose_project_name=compose_project_name,
|
||||||
compose_env_file=compose_env_file)
|
compose_env_file=compose_env_file)
|
||||||
|
@ -18,6 +18,8 @@ from app.deployer import Deployer
|
|||||||
|
|
||||||
|
|
||||||
class K8sDeployer(Deployer):
|
class K8sDeployer(Deployer):
|
||||||
|
name: str = "k8s"
|
||||||
|
|
||||||
def __init__(self, compose_files, compose_project_name, compose_env_file) -> None:
|
def __init__(self, compose_files, compose_project_name, compose_env_file) -> None:
|
||||||
config.load_kube_config()
|
config.load_kube_config()
|
||||||
self.client = client.CoreV1Api()
|
self.client = client.CoreV1Api()
|
||||||
|
@ -249,7 +249,7 @@ def init(ctx, config, output, map_ports_to_host):
|
|||||||
stack = global_options(ctx).stack
|
stack = global_options(ctx).stack
|
||||||
debug = global_options(ctx).debug
|
debug = global_options(ctx).debug
|
||||||
default_spec_file_content = call_stack_deploy_init(ctx.obj)
|
default_spec_file_content = call_stack_deploy_init(ctx.obj)
|
||||||
spec_file_content = {"stack": stack, "deploy-to": "compose"}
|
spec_file_content = {"stack": stack, "deploy-to": ctx.obj.deployer.name}
|
||||||
if default_spec_file_content:
|
if default_spec_file_content:
|
||||||
spec_file_content.update(default_spec_file_content)
|
spec_file_content.update(default_spec_file_content)
|
||||||
config_variables = _parse_config_variables(config)
|
config_variables = _parse_config_variables(config)
|
||||||
@ -271,6 +271,7 @@ def init(ctx, config, output, map_ports_to_host):
|
|||||||
for named_volume in named_volumes:
|
for named_volume in named_volumes:
|
||||||
volume_descriptors[named_volume] = f"./data/{named_volume}"
|
volume_descriptors[named_volume] = f"./data/{named_volume}"
|
||||||
spec_file_content["volumes"] = volume_descriptors
|
spec_file_content["volumes"] = volume_descriptors
|
||||||
|
print(f"DEBUG spec: {spec_file_content}")
|
||||||
|
|
||||||
with open(output, "w") as output_file:
|
with open(output, "w") as output_file:
|
||||||
yaml.dump(spec_file_content, output_file)
|
yaml.dump(spec_file_content, output_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user