Skip to content

fix: make DEFAULT_INTERNAL_REGISTRY configurable via env var - #1246

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:fix/configurable-default-registry-1242
Apr 15, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:fix/configurable-default-registry-1242

Conversation

@pdettori

Copy link
Copy Markdown
Member

Summary

  • Make DEFAULT_INTERNAL_REGISTRY configurable via DEFAULT_REGISTRY_URL environment variable (Pydantic Settings)
  • Wire through Helm chart as ui.backend.defaultRegistryUrl with conditional env var injection
  • Set OpenShift internal registry (image-registry.openshift-image-registry.svc:5000) in ocp_values.yaml and ocp_minimal_values.yaml

Closes #1242

Changes

File Change
kagenti/backend/app/core/config.py Add default_registry_url setting with Kind default
kagenti/backend/app/core/constants.py Use settings.default_registry_url instead of hardcoded value
charts/kagenti/values.yaml Add ui.backend.defaultRegistryUrl (empty = use Python default)
charts/kagenti/templates/ui.yaml Conditionally set DEFAULT_REGISTRY_URL env var
deployments/envs/ocp_values.yaml Set OpenShift internal registry
deployments/envs/ocp_minimal_values.yaml Set OpenShift internal registry
kagenti/backend/tests/test_shipwright_shared.py Add 3 tests for configurable registry

Test plan

  • Existing unit tests pass (36/36 in test_shipwright_shared.py)
  • New tests verify: default value, env var override, OCP registry strategy selection
  • Deploy to Kind cluster — verify source builds still use registry.cr-system.svc.cluster.local:5000
  • Deploy to OpenShift — verify source builds use image-registry.openshift-image-registry.svc:5000

Backward compatibility

No breaking changes. Without DEFAULT_REGISTRY_URL env var or Helm value, behavior is identical to before (Kind dev registry default).

The default internal registry URL was hardcoded to the Kind dev
registry (registry.cr-system.svc.cluster.local:5000), causing all
source-based agent/tool builds to fail on OpenShift when no
registryUrl was provided.

Add default_registry_url to Pydantic Settings so it can be
overridden via the DEFAULT_REGISTRY_URL environment variable.
Wire it through the Helm chart (ui.backend.defaultRegistryUrl)
and set the OpenShift internal registry in OCP value files.

Closes rossoctl#1242

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori

Copy link
Copy Markdown
Member Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Apr 14, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @pdettori
Commit: 765162cece3d2b177ddc7ef764dcea4f063d7a63
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Passed

Commit: 765162cece3d2b177ddc7ef764dcea4f063d7a63
Result: All tests passed
Workflow Run: View logs

The safe-to-test label indicates this commit has been approved for E2E testing.


If you push new commits, the label will be removed and you'll need to comment /run-e2e again.

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focused, well-scoped fix that makes DEFAULT_INTERNAL_REGISTRY configurable via Pydantic Settings + Helm, unblocking source-based builds on OpenShift. The approach follows existing patterns in constants.py (module-level settings.* access) and ui.yaml (conditional env var injection). Tests cover the default, the override, and the OCP strategy behavior. Backward compatible — no change without explicit configuration.

Che bel fix, Paolo! Clean, tested, and backward compatible. 🤌

Areas reviewed: Python, Helm/K8s, YAML
Commits: 1 commit, signed-off ✅
CI status: all 21 checks passing (including Deploy & Test and E2E HyperShift) ✅
Verdict: APPROVE


def test_openshift_registry_is_internal(self):
"""OpenShift internal registry should be detected as internal (svc.cluster.local absent but still in-cluster)."""
ocp_registry = "image-registry.openshift-image-registry.svc:5000"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The docstring says "should be detected as internal" but the assertion is SHIPWRIGHT_STRATEGY_SECURE. Slightly misleading — the OCP registry IS internal but doesn't match the insecure URL pattern. Maybe: "OpenShift internal registry uses secure strategy (proper TLS, unlike Kind's insecure dev registry)." Just a clarity tweak, mamma mia it confused me for a second 😄


def test_default_value_is_kind_registry(self):
"""Default value should be the Kind dev registry."""
assert DEFAULT_INTERNAL_REGISTRY == "registry.cr-system.svc.cluster.local:5000"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Bellissimo test trio! Testing the default via the constant, the env override via a fresh Settings() instance (avoiding module-level caching), and documenting the OCP strategy behavior. Perfetto.

value: "{{ .Values.ui.auth.enabled }}"
{{- if .Values.ui.backend.defaultRegistryUrl }}
- name: DEFAULT_REGISTRY_URL
value: {{ .Values.ui.backend.defaultRegistryUrl | quote }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Perfetto — conditional injection with {{- if }} means Kind deployments don't get a spurious env var. The Python default handles the Kind case, Helm only overrides for OCP. Clean separation of concerns.

@pdettori
pdettori merged commit 806d1d3 into rossoctl:main Apr 15, 2026
21 checks passed
@pdettori
pdettori deleted the fix/configurable-default-registry-1242 branch April 15, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Maintainer reviewed - safe to run E2E tests

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bug: DEFAULT_INTERNAL_REGISTRY is hardcoded to dev-only registry, breaks source builds on OpenShift

2 participants