Skip to content

feat: set DM_BASE_PATH so the viz-app serves under its Ingress sub-path#9

Merged
claude-im merged 1 commit into
mainfrom
abc-set-dm-base-path
Jun 9, 2026
Merged

feat: set DM_BASE_PATH so the viz-app serves under its Ingress sub-path#9
claude-im merged 1 commit into
mainfrom
abc-set-dm-base-path

Conversation

@alanbchristie

Copy link
Copy Markdown
Collaborator

What

When a DataVisualisation is deployed, the Ingress exposes the viz-app at a
per-instance sub-path (/<instance-id>). The app was served from /, so its
assets, client-side routes and /api/... calls resolved at the origin root
— which the path-based Ingress does not route to the Pod — and the page
rendered blank.

squonk2-viz-app now supports a DM_BASE_PATH env var
(InformaticsMatters/squonk2-viz-app#7). This change has the operator set it.

Change

build_environment appends DM_BASE_PATH = "/<instance-id>" whenever an
instance id is known, and omits it otherwise (the app then serves at /, as
before). The Ingress is unchanged — it already routes the /<name> sub-path to
the Pod.

if instance_id:
    env.append({"name": "DM_BASE_PATH", "value": f"/{instance_id}"})

Tests (TDD — written first, seen red before the change)

  • test_build_environment_sets_dm_base_path_from_instance_id/instance-111
  • test_build_environment_omits_dm_base_path_when_instance_id_absent → key absent

All 33 tests pass; black clean; pylint 10/10. (The pre-existing mypy-strict
complaint on the @kopf.on.create decorator is unrelated and present on main.)

Note

DM_BASE_PATH must match the URL prefix the Ingress serves (/<name>). This
relies on the CR name equalling the …/instance-id label value — confirmed as
the case for this deployment. Worth an end-to-end check on a real cluster once
the viz-app fix is released, since this is the first time both halves run
together.

🤖 Generated with Claude Code

The viz-app is exposed by the Ingress at a per-instance sub-path
('/<instance-id>') but, served from '/', its assets, client-side routes
and API calls resolved at the origin root and rendered a blank page.

squonk2-viz-app now honours DM_BASE_PATH (see squonk2-viz-app#7), so set
it to '/<instance-id>' whenever an instance id is known; omit it
otherwise (the app then serves at '/' as before). No Ingress change is
needed - it already routes the sub-path to the Pod.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude-im claude-im merged commit 02d9a69 into main Jun 9, 2026
2 checks passed
@claude-im claude-im deleted the abc-set-dm-base-path branch June 9, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants