diff --git a/stack_orchestrator/deploy/deployment_create.py b/stack_orchestrator/deploy/deployment_create.py index 725bf21f..b03b12ca 100644 --- a/stack_orchestrator/deploy/deployment_create.py +++ b/stack_orchestrator/deploy/deployment_create.py @@ -272,7 +272,19 @@ def call_stack_deploy_start(deployment_context): create additional k8s resources (Services, etc.) in the deployment namespace. The namespace can be derived as f"laconic-{deployment_context.id}". """ - python_file_paths = _commands_plugin_paths(deployment_context.stack.name) + try: + python_file_paths = _commands_plugin_paths(deployment_context.stack.name) + except SystemExit: + # Stack path may not resolve from current cwd (e.g. during restart + # when cwd isn't the repo root). get_parsed_stack_config calls + # error_exit (sys.exit) when the stack directory doesn't exist. + # Most stacks don't have deploy hooks, so this is non-fatal. + if opts.o.debug: + print( + f"Could not resolve plugin paths for stack" + f" {deployment_context.stack.name}, skipping hooks" + ) + return for python_file_path in python_file_paths: if python_file_path.exists(): spec = util.spec_from_file_location("commands", python_file_path) diff --git a/stack_orchestrator/deploy/k8s/cluster_info.py b/stack_orchestrator/deploy/k8s/cluster_info.py index 6890b430..5289e814 100644 --- a/stack_orchestrator/deploy/k8s/cluster_info.py +++ b/stack_orchestrator/deploy/k8s/cluster_info.py @@ -696,9 +696,15 @@ class ClusterInfo: return name def _pod_has_pvcs(self, parsed_pod_file: Any) -> bool: - """Check if a parsed compose file declares named volumes (PVCs).""" + """Check if a parsed compose file declares volumes that become PVCs. + + Excludes volumes that are ConfigMaps (declared in spec.configmaps), + since those don't require Recreate strategy. + """ volumes = parsed_pod_file.get("volumes", {}) - return len(volumes) > 0 + configmaps = set(self.spec.get_configmaps().keys()) + pvc_volumes = [v for v in volumes if v not in configmaps] + return len(pvc_volumes) > 0 def _build_common_pod_metadata(self, services: dict) -> tuple: """Build shared annotations, labels, affinity, tolerations for pods.