Skip to content
Open
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
3 changes: 3 additions & 0 deletions operator/crd/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ spec:
type: object
additionalProperties:
type: string
image:
description: "Container image to use for this IntegrationRoute. Overrides the cluster-wide default integration image set in the controller configuration."
type: string
routeConfigMap:
description: "Name of a ConfigMap containing integration route definitions. The ConfigMap should be in the same namespace as the IntegrationRoute resource"
type: string
Expand Down
2 changes: 1 addition & 1 deletion webapp/core/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def _new_deployment(parent):
},
"replicas": parent["spec"]["replicas"],
"template": _create_pod_template(
parent, labels, cfg.INTEGRATION_CONTAINER_IMAGE
parent, labels, parent["spec"].get("image", cfg.INTEGRATION_CONTAINER_IMAGE)
),
},
}
Expand Down
26 changes: 26 additions & 0 deletions webapp/core/test/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,3 +603,29 @@ def check_volume_mounts_absent(deployment: Mapping, name: str):
def get_container(deployment: Mapping) -> Mapping:
pod_template = deployment["spec"]["template"]
return pod_template["spec"]["containers"][0]


def test_per_route_image_override(full_route):
"""When spec.image is set, the deployment should use that image instead of the default."""
custom_image = "registry.example.com/my-app:1.0"
full_route["parent"]["spec"]["image"] = custom_image

result = sync(full_route)

deployment = result["children"][0]
container = deployment["spec"]["template"]["spec"]["containers"][0]
assert container["image"] == custom_image


def test_per_route_image_default_when_absent(full_route):
"""When spec.image is not set, the deployment should use the global default."""
# Ensure no image field
full_route["parent"]["spec"].pop("image", None)

result = sync(full_route)

deployment = result["children"][0]
container = deployment["spec"]["template"]["spec"]["containers"][0]
# Should use the default from config (INTEGRATION_CONTAINER_IMAGE)
import config as cfg
assert container["image"] == cfg.INTEGRATION_CONTAINER_IMAGE
Loading