Repository navigation
fix: make DEFAULT_INTERNAL_REGISTRY configurable via env var - #1246
Conversation
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]>
|
/run-e2e |
E2E HyperShift Tests PassedCommit: The If you push new commits, the label will be removed and you'll need to comment |
huang195
left a comment
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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 }} |
There was a problem hiding this comment.
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.
Summary
DEFAULT_INTERNAL_REGISTRYconfigurable viaDEFAULT_REGISTRY_URLenvironment variable (Pydantic Settings)ui.backend.defaultRegistryUrlwith conditional env var injectionimage-registry.openshift-image-registry.svc:5000) inocp_values.yamlandocp_minimal_values.yamlCloses #1242
Changes
kagenti/backend/app/core/config.pydefault_registry_urlsetting with Kind defaultkagenti/backend/app/core/constants.pysettings.default_registry_urlinstead of hardcoded valuecharts/kagenti/values.yamlui.backend.defaultRegistryUrl(empty = use Python default)charts/kagenti/templates/ui.yamlDEFAULT_REGISTRY_URLenv vardeployments/envs/ocp_values.yamldeployments/envs/ocp_minimal_values.yamlkagenti/backend/tests/test_shipwright_shared.pyTest plan
test_shipwright_shared.py)registry.cr-system.svc.cluster.local:5000image-registry.openshift-image-registry.svc:5000Backward compatibility
No breaking changes. Without
DEFAULT_REGISTRY_URLenv var or Helm value, behavior is identical to before (Kind dev registry default).