Minor fixes for deploying with k8s and podman.

This commit is contained in:
Thomas E Lackey 2024-01-29 14:42:01 -06:00
parent b7f215d9bf
commit 1b3a4d740d
2 changed files with 29 additions and 17 deletions

View File

@ -104,6 +104,9 @@ def process_container(stack: str,
build_command = os.path.join(container_build_dir, build_command = os.path.join(container_build_dir,
"default-build.sh") + f" {default_container_tag} {repo_dir_or_build_dir}" "default-build.sh") + f" {default_container_tag} {repo_dir_or_build_dir}"
if not dry_run: if not dry_run:
# No PATH at all causes failures with podman.
if "PATH" not in container_build_env:
container_build_env["PATH"] = os.environ["PATH"]
if verbose: if verbose:
print(f"Executing: {build_command} with environment: {container_build_env}") print(f"Executing: {build_command} with environment: {container_build_env}")
build_result = subprocess.run(build_command, shell=True, env=container_build_env) build_result = subprocess.run(build_command, shell=True, env=container_build_env)

View File

@ -135,6 +135,7 @@ class K8sDeployer(Deployer):
if not self.is_kind(): if not self.is_kind():
ingress: client.V1Ingress = self.cluster_info.get_ingress() ingress: client.V1Ingress = self.cluster_info.get_ingress()
if ingress:
if opts.o.debug: if opts.o.debug:
print(f"Sending this ingress: {ingress}") print(f"Sending this ingress: {ingress}")
ingress_resp = self.networking_api.create_namespaced_ingress( ingress_resp = self.networking_api.create_namespaced_ingress(
@ -144,6 +145,10 @@ class K8sDeployer(Deployer):
if opts.o.debug: if opts.o.debug:
print("Ingress created:") print("Ingress created:")
print(f"{ingress_resp}") print(f"{ingress_resp}")
else:
if opts.o.debug:
print(f"No ingress configured")
def down(self, timeout, volumes): def down(self, timeout, volumes):
self.connect_api() self.connect_api()
@ -198,6 +203,7 @@ class K8sDeployer(Deployer):
if not self.is_kind(): if not self.is_kind():
ingress: client.V1Ingress = self.cluster_info.get_ingress() ingress: client.V1Ingress = self.cluster_info.get_ingress()
if ingress:
if opts.o.debug: if opts.o.debug:
print(f"Deleting this ingress: {ingress}") print(f"Deleting this ingress: {ingress}")
try: try:
@ -206,6 +212,9 @@ class K8sDeployer(Deployer):
) )
except client.exceptions.ApiException as e: except client.exceptions.ApiException as e:
_check_delete_exception(e) _check_delete_exception(e)
else:
if opts.o.debug:
print(f"No ingress to delete")
if self.is_kind(): if self.is_kind():
# Destroy the kind cluster # Destroy the kind cluster