Differential D4718 Diff 23667 integration_tests/python_modules/dagster-k8s-test-infra/dagster_k8s_test_infra/helm.py
Changeset View
Changeset View
Standalone View
Standalone View
integration_tests/python_modules/dagster-k8s-test-infra/dagster_k8s_test_infra/helm.py
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
@pytest.fixture(scope="session") | @pytest.fixture(scope="session") | ||||
def helm_namespace( | def helm_namespace( | ||||
cluster_provider, request | cluster_provider, request | ||||
): # pylint: disable=unused-argument, redefined-outer-name | ): # pylint: disable=unused-argument, redefined-outer-name | ||||
yield _helm_namespace_helper(helm_chart, request) | yield _helm_namespace_helper(helm_chart, request) | ||||
@pytest.fixture(scope="session") | |||||
def helm_namespace_for_k8s_run_launcher( | |||||
cluster_provider, request | |||||
): # pylint: disable=unused-argument, redefined-outer-name | |||||
yield _helm_namespace_helper(helm_chart_for_k8s_run_launcher, request) | |||||
@contextmanager | @contextmanager | ||||
def test_namespace(should_cleanup=True): | def test_namespace(should_cleanup=True): | ||||
# Will be something like dagster-test-3fcd70 to avoid ns collisions in shared test environment | # Will be something like dagster-test-3fcd70 to avoid ns collisions in shared test environment | ||||
namespace = get_test_namespace() | namespace = get_test_namespace() | ||||
print("--- \033[32m:k8s: Creating test namespace %s\033[0m" % namespace) | print("--- \033[32m:k8s: Creating test namespace %s\033[0m" % namespace) | ||||
kube_api = kubernetes.client.CoreV1Api() | kube_api = kubernetes.client.CoreV1Api() | ||||
▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | helm_config = { | ||||
"postgresqlUser": "test", | "postgresqlUser": "test", | ||||
} | } | ||||
with _helm_chart_helper(namespace, should_cleanup, helm_config): | with _helm_chart_helper(namespace, should_cleanup, helm_config): | ||||
yield | yield | ||||
@contextmanager | @contextmanager | ||||
def helm_chart_for_k8s_run_launcher(namespace, docker_image, should_cleanup=True): | |||||
check.str_param(namespace, "namespace") | |||||
check.str_param(docker_image, "docker_image") | |||||
check.bool_param(should_cleanup, "should_cleanup") | |||||
repository, tag = docker_image.split(":") | |||||
pull_policy = image_pull_policy() | |||||
helm_config = { | |||||
"dagit": { | |||||
"image": {"repository": repository, "tag": tag, "pullPolicy": pull_policy}, | |||||
"env": {"TEST_SET_ENV_VAR": "test_dagit_env_var"}, | |||||
"env_config_maps": [TEST_CONFIGMAP_NAME], | |||||
"env_secrets": [TEST_SECRET_NAME], | |||||
"livenessProbe": { | |||||
"tcpSocket": {"port": "http"}, | |||||
"periodSeconds": 20, | |||||
"failureThreshold": 3, | |||||
}, | |||||
"startupProbe": { | |||||
"tcpSocket": {"port": "http"}, | |||||
"failureThreshold": 6, | |||||
"periodSeconds": 10, | |||||
}, | |||||
}, | |||||
"celery": {"enabled": "false"}, | |||||
"scheduler": {"k8sEnabled": "true", "schedulerNamespace": namespace}, | |||||
"serviceAccount": {"name": "dagit-admin"}, | |||||
"postgresqlPassword": "test", | |||||
"postgresqlDatabase": "test", | |||||
"postgresqlUser": "test", | |||||
} | |||||
with _helm_chart_helper(namespace, should_cleanup, helm_config): | |||||
yield | |||||
@contextmanager | |||||
def helm_chart_for_user_deployments(namespace, docker_image, should_cleanup=True): | def helm_chart_for_user_deployments(namespace, docker_image, should_cleanup=True): | ||||
check.str_param(namespace, "namespace") | check.str_param(namespace, "namespace") | ||||
check.str_param(docker_image, "docker_image") | check.str_param(docker_image, "docker_image") | ||||
check.bool_param(should_cleanup, "should_cleanup") | check.bool_param(should_cleanup, "should_cleanup") | ||||
repository, tag = docker_image.split(":") | repository, tag = docker_image.split(":") | ||||
pull_policy = image_pull_policy() | pull_policy = image_pull_policy() | ||||
helm_config = { | helm_config = { | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |