From 17d63b4c9c8424ad739d4ca2522b5ce2394abed8 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Fri, 3 Nov 2023 20:03:42 -0600 Subject: [PATCH] Fix formatting --- app/deploy/k8s/deploy_k8s.py | 4 ++-- app/deploy/k8s/helpers.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/deploy/k8s/deploy_k8s.py b/app/deploy/k8s/deploy_k8s.py index a7ccf3bf..cfafddfa 100644 --- a/app/deploy/k8s/deploy_k8s.py +++ b/app/deploy/k8s/deploy_k8s.py @@ -47,7 +47,7 @@ class K8sDeployer(Deployer): def up(self, detach, services): # Create the kind cluster - create_cluster(self.kind_cluster_name) + create_cluster(self.kind_cluster_name, ) self.connect_api() # Ensure the referenced containers are copied into kind load_images_into_kind(self.kind_cluster_name, self.cluster_info.image_set) @@ -120,7 +120,7 @@ class K8sDeployerConfigGenerator(DeployerConfigGenerator): def generate(self, deployment_dir: Path): # Check the file isn't already there # Get the config file contents - content = generate_kind_config() + content = generate_kind_config(deployment_dir) config_file = deployment_dir.joinpath(self.config_file_name) # Write the file with open(config_file, "w") as output_file: diff --git a/app/deploy/k8s/helpers.py b/app/deploy/k8s/helpers.py index ccd32b3c..ae09c16f 100644 --- a/app/deploy/k8s/helpers.py +++ b/app/deploy/k8s/helpers.py @@ -130,10 +130,10 @@ def _generate_kind_mounts(parsed_pod_files): for mount_string in volumes: # Looks like: test-data:/data (volume_name, mount_path) = mount_string.split(":") - volume_definitions.append(f"- hostPath: \n containerPath:{mount_path}") + volume_definitions.append(f" - hostPath: \n containerPath:{mount_path}") return ( "" if len(volume_definitions) == 0 else ( - "extraMounts:\n" + " extraMounts:\n" f"{''.join(volume_definitions)}" ) ) @@ -152,10 +152,10 @@ def _generate_kind_port_mappings(parsed_pod_files): for port_string in ports: # TODO handle the complex cases # Looks like: 80 or something more complicated - port_definitions.append(f"- containerPort: {port_string}\n hostPort:{port_string}") + port_definitions.append(f" - containerPort: {port_string}\n hostPort:{port_string}") return ( "" if len(port_definitions) == 0 else ( - "extraPortMappings:\n" + " extraPortMappings:\n" f"{''.join(port_definitions)}" ) ) @@ -190,7 +190,7 @@ def generate_kind_config(deployment_dir: Path): "kind: Cluster\n" "apiVersion: kind.x-k8s.io/v1alpha4\n" "nodes:\n" - " - role: control-plane\n" + "- role: control-plane\n" f"{port_mappings_yml}\n" f"{mounts_yml}\n" )