Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions deploy/ecs/render_task_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def render_template(template_path: Path, output_path: Path, variables: dict[str,
configure_staging_opensearch(rendered, variables)
configure_production_opensearch(rendered, variables)
qstash_base_url: str = variables.get("QSTASH_BASE_URL", "")
is_staging: bool = variables.get("DEPLOYMENT_ENVIRONMENT") == "staging"
if qstash_base_url or is_staging:
deployment_environment: str = variables.get("DEPLOYMENT_ENVIRONMENT", "")
if qstash_base_url or deployment_environment in ("staging", "prod"):
if not isinstance(rendered, dict):
raise ValueError("Task definition must be an object")
containers: object = rendered.get("containerDefinitions")
Expand All @@ -246,8 +246,10 @@ def render_template(template_path: Path, output_path: Path, variables: dict[str,
raise ValueError("Task container must contain environment entries")
if qstash_base_url:
environment.append({"name": "QSTASH_BASE_URL", "value": qstash_base_url})
if is_staging and container.get("name") == "api":
if deployment_environment == "staging" and container.get("name") == "api":
environment.append({"name": "DB_POOL_RECYCLE", "value": "-1"})
if deployment_environment == "prod":
environment.append({"name": "KNOWHERE_INDEXING_MAXIMUM_UNIT_CHARACTERS", "value": "1048576"})
validate_rendered_definition(rendered)
output_path.parent.mkdir(parents=True, exist_ok=True)
output_path.write_text(json.dumps(rendered, indent=2) + "\n", encoding="utf-8")
Expand Down
3 changes: 3 additions & 0 deletions deploy/ecs/test_render_task_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ def test_staging_templates_preserve_expected_staging_configuration(

for name, value in expected_environment.items():
assert environment_values[name] == value
assert "KNOWHERE_INDEXING_MAXIMUM_UNIT_CHARACTERS" not in environment_values


def test_staging_worker_preserves_evidence_selected_capacity(tmp_path: Path) -> None:
Expand Down Expand Up @@ -377,6 +378,7 @@ def test_production_cli_renders_the_backend_read_by_the_release(
environment = {item["name"]: item["value"] for item in container["environment"]}
secrets = {item["name"]: item["valueFrom"] for item in container["secrets"]}
assert environment["KNOWHERE_LEXICAL_BACKEND"] == backend
assert environment["KNOWHERE_INDEXING_MAXIMUM_UNIT_CHARACTERS"] == "1048576"
assert environment["KNOWHERE_OPENSEARCH_URL"] == PRODUCTION_OPENSEARCH["PROD_OPENSEARCH_URL"]
assert environment["KNOWHERE_OPENSEARCH_INDEX_PREFIX"] == "knowhere-prod-lexical-v1"
assert (environment["KNOWHERE_OPENSEARCH_OPEN_INDEX_LIMIT"], environment["KNOWHERE_OPENSEARCH_IDLE_HIGH_WATERMARK"],
Expand All @@ -399,6 +401,7 @@ def test_production_cli_without_opensearch_keeps_the_postgresql_default(
environment = {item["name"]: item["value"] for item in container["environment"]}
secrets = {item["name"]: item["valueFrom"] for item in container["secrets"]}
assert "KNOWHERE_LEXICAL_BACKEND" not in environment
assert environment["KNOWHERE_INDEXING_MAXIMUM_UNIT_CHARACTERS"] == "1048576"
assert "KNOWHERE_PROD_NATIVE_TLS" not in secrets


Expand Down
Loading