From 2af6ffce776797fe9865b5493912da63d90c439e Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Thu, 22 Feb 2024 21:11:06 +0000 Subject: [PATCH] Tweaks for running the container registry in k8s (#760) Minor tweaks for running the container-registry in k8s. The big change is not requiring --image-registry. Reviewed-on: https://git.vdb.to/cerc-io/stack-orchestrator/pulls/760 Reviewed-by: David Boreham --- .../compose/docker-compose-container-registry.yml | 2 ++ stack_orchestrator/deploy/deployment_create.py | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/stack_orchestrator/data/compose/docker-compose-container-registry.yml b/stack_orchestrator/data/compose/docker-compose-container-registry.yml index 91d6d265..1e94aef2 100644 --- a/stack_orchestrator/data/compose/docker-compose-container-registry.yml +++ b/stack_orchestrator/data/compose/docker-compose-container-registry.yml @@ -5,9 +5,11 @@ services: environment: REGISTRY_LOG_LEVEL: ${REGISTRY_LOG_LEVEL} volumes: + - config:/config:ro - registry-data:/var/lib/registry ports: - "5000" volumes: + config: registry-data: diff --git a/stack_orchestrator/deploy/deployment_create.py b/stack_orchestrator/deploy/deployment_create.py index 87b6800d..8da93f7a 100644 --- a/stack_orchestrator/deploy/deployment_create.py +++ b/stack_orchestrator/deploy/deployment_create.py @@ -327,12 +327,14 @@ def init_operation(deploy_command_context, stack, deployer_type, config, default_spec_file_content = call_stack_deploy_init(deploy_command_context) spec_file_content = {"stack": stack, constants.deploy_to_key: deployer_type} if deployer_type == "k8s": - if kube_config is None: + if kube_config: + spec_file_content.update({constants.kube_config_key: kube_config}) + else: error_exit("--kube-config must be supplied with --deploy-to k8s") - if image_registry is None: - error_exit("--image-registry must be supplied with --deploy-to k8s") - spec_file_content.update({constants.kube_config_key: kube_config}) - spec_file_content.update({constants.image_registry_key: image_registry}) + if image_registry: + spec_file_content.update({constants.image_registry_key: image_registry}) + else: + print("WARNING: --image-registry not specified, only default container registries (eg, Docker Hub) will be available") else: # Check for --kube-config supplied for non-relevant deployer types if kube_config is not None: