Skip to content
This repository was archived by the owner on Nov 12, 2026. It is now read-only.

🐛 Handle Empty imageRegistry in Image Reference Construction - #126

Merged
pdettori merged 2 commits into
rossoctl:mainfrom
cwiklik:fix-image-reference
Nov 4, 2025
Merged

pdettori merged 2 commits into
rossoctl:mainfrom
cwiklik:fix-image-reference

Conversation

@cwiklik

@cwiklik cwiklik commented Nov 3, 2025

Copy link
Copy Markdown
Collaborator

Summary

Fixes the operator bug where empty imageRegistry values cause invalid image references like /my_app:latest, preventing deployment of local container images.

Problem

When deploying Components with local images (e.g., images loaded into kind), the operator always constructs image references using the pattern:

goimage = fmt.Sprintf("%s/%s:%s", imageRegistry, imageName, imageTag)

This creates invalid references like /my_app:latest when imageRegistry is empty, causing Kubernetes to reject the image with InvalidImageName errors.

Related issue(s)

Related to rossoctl/rossoctl#364
Fixes #125

@cwiklik
cwiklik requested a review from pdettori November 3, 2025 16:04
@mrsabath
mrsabath requested a review from Copilot November 4, 2025 13:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds conditional logic to handle image name formatting based on whether an image registry is specified. The change allows the Kubernetes deployer to support both external registry images (with full registry path) and local images (without registry prefix).

  • Adds conditional check for ImageRegistry field to determine image name format
  • External registry images use the format registry/image:tag
  • Local images use the simplified format image:tag
Comments suppressed due to low confidence (1)

platform-operator/internal/deployer/kubernetes/kubernetes.go:1

  • The ImageRegistry field is marked as +kubebuilder:validation:Required in the API schema (line 398 of component_types.go), but this change treats it as optional by checking if it's empty. This creates an inconsistency between the API validation and runtime behavior. Either remove the Required validation attribute to allow empty strings, or update the logic to handle the required field appropriately. Consider using the omitempty JSON tag and removing the Required validation if the field should be optional.
/*

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Jarek Cwiklik <[email protected]>

@pdettori pdettori 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.

/lgtm

@pdettori
pdettori merged commit 82e5753 into rossoctl:main Nov 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Operator creates invalid image reference when imageRegistry is empty

3 participants