Allow to disable kind cluster management for testing
Some checks failed
Lint Checks / Run linter (pull_request) Failing after 37s
Deploy Test / Run deploy test suite (pull_request) Has been cancelled
Webapp Test / Run webapp test suite (pull_request) Has been cancelled
Smoke Test / Run basic test suite (pull_request) Has been cancelled
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Has been cancelled
Some checks failed
Lint Checks / Run linter (pull_request) Failing after 37s
Deploy Test / Run deploy test suite (pull_request) Has been cancelled
Webapp Test / Run webapp test suite (pull_request) Has been cancelled
Smoke Test / Run basic test suite (pull_request) Has been cancelled
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Has been cancelled
This commit is contained in:
parent
6087e1cd31
commit
2c12107aab
@ -52,12 +52,14 @@ class K8sDeployer(Deployer):
|
|||||||
networking_api: client.NetworkingV1Api
|
networking_api: client.NetworkingV1Api
|
||||||
k8s_namespace: str = "default"
|
k8s_namespace: str = "default"
|
||||||
kind_cluster_name: str
|
kind_cluster_name: str
|
||||||
|
skip_cluster_management: bool
|
||||||
cluster_info: ClusterInfo
|
cluster_info: ClusterInfo
|
||||||
deployment_dir: Path
|
deployment_dir: Path
|
||||||
deployment_context: DeploymentContext
|
deployment_context: DeploymentContext
|
||||||
|
|
||||||
def __init__(self, type, deployment_context: DeploymentContext, compose_files, compose_project_name, compose_env_file) -> None:
|
def __init__(self, type, deployment_context: DeploymentContext, compose_files, compose_project_name, compose_env_file) -> None:
|
||||||
self.type = type
|
self.type = type
|
||||||
|
skip_cluster_management = False
|
||||||
# TODO: workaround pending refactoring above to cope with being created with a null deployment_context
|
# TODO: workaround pending refactoring above to cope with being created with a null deployment_context
|
||||||
if deployment_context is None:
|
if deployment_context is None:
|
||||||
return
|
return
|
||||||
@ -183,6 +185,7 @@ class K8sDeployer(Deployer):
|
|||||||
if len(host_parts) == 2:
|
if len(host_parts) == 2:
|
||||||
host_as_wild = f"*.{host_parts[1]}"
|
host_as_wild = f"*.{host_parts[1]}"
|
||||||
|
|
||||||
|
# TODO: resolve method deprecation below
|
||||||
now = datetime.utcnow().replace(tzinfo=timezone.utc)
|
now = datetime.utcnow().replace(tzinfo=timezone.utc)
|
||||||
fmt = "%Y-%m-%dT%H:%M:%S%z"
|
fmt = "%Y-%m-%dT%H:%M:%S%z"
|
||||||
|
|
||||||
@ -205,13 +208,13 @@ class K8sDeployer(Deployer):
|
|||||||
|
|
||||||
def up(self, detach, services):
|
def up(self, detach, services):
|
||||||
if not opts.o.dry_run:
|
if not opts.o.dry_run:
|
||||||
if self.is_kind():
|
if self.is_kind() and not self.skip_cluster_management:
|
||||||
# Create the kind cluster
|
# Create the kind cluster
|
||||||
create_cluster(self.kind_cluster_name, self.deployment_dir.joinpath(constants.kind_config_filename))
|
create_cluster(self.kind_cluster_name, self.deployment_dir.joinpath(constants.kind_config_filename))
|
||||||
# Ensure the referenced containers are copied into kind
|
# Ensure the referenced containers are copied into kind
|
||||||
load_images_into_kind(self.kind_cluster_name, self.cluster_info.image_set)
|
load_images_into_kind(self.kind_cluster_name, self.cluster_info.image_set)
|
||||||
self.connect_api()
|
self.connect_api()
|
||||||
if self.is_kind():
|
if self.is_kind() and not self.skip_cluster_management:
|
||||||
# Now configure an ingress controller (not installed by default in kind)
|
# Now configure an ingress controller (not installed by default in kind)
|
||||||
install_ingress_for_kind()
|
install_ingress_for_kind()
|
||||||
# Wait for ingress to start (deployment provisioning will fail unless this is done)
|
# Wait for ingress to start (deployment provisioning will fail unless this is done)
|
||||||
@ -358,7 +361,7 @@ class K8sDeployer(Deployer):
|
|||||||
if opts.o.debug:
|
if opts.o.debug:
|
||||||
print("No nodeport to delete")
|
print("No nodeport to delete")
|
||||||
|
|
||||||
if self.is_kind():
|
if self.is_kind() and not self.skip_cluster_management:
|
||||||
# Destroy the kind cluster
|
# Destroy the kind cluster
|
||||||
destroy_cluster(self.kind_cluster_name)
|
destroy_cluster(self.kind_cluster_name)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user