Skip to content

OKD-380: Add missing namespace to image trigger annotations#441

Merged
phracek merged 1 commit into
sclorg:masterfrom
pskrbasu:fix/image-trigger-namespace
Jun 23, 2026
Merged

OKD-380: Add missing namespace to image trigger annotations#441
phracek merged 1 commit into
sclorg:masterfrom
pskrbasu:fix/image-trigger-namespace

Conversation

@pskrbasu

@pskrbasu pskrbasu commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Problem

Deploying MySQL from the OKD 4.22 Software Catalog fails with:

spec.containers[0].image: Invalid value: " ": must not have leading or trailing whitespace

Reported in okd-project/okd#2337

Root Cause

When templates were migrated from DeploymentConfig to Deployment, the image.openshift.io/triggers annotation dropped the namespace field from the ImageStreamTag reference. Without it, the image trigger controller defaults to the Deployment's own namespace instead of openshift, so it can't find the ImageStream and the container image is never resolved.

Fix

  • Add "namespace":"${NAMESPACE}" to the trigger annotation's from object in both mysql-persistent and mysql-ephemeral templates
  • Remove a stray image.openshift.io/triggers annotation from the Service object in mysql-persistent-template.json — it was a copy-paste error that referenced ${MARIADB_VERSION} (Services don't have containers, so this annotation had no effect)

Impact

These template files are the upstream source for openshift/library (via make import) and ultimately openshift/cluster-samples-operator. An immediate fix was applied directly to the operator in openshift/cluster-samples-operator#701. This upstream fix ensures the bug doesn't recur on the next sync.

Summary by CodeRabbit

  • Chores
    • Updated example MySQL deployment templates (ephemeral and persistent) to explicitly reference image streams with namespace parameters, ensuring proper deployment triggers across different environments.
    • Removed redundant image stream annotation from the Service resource in the persistent template to streamline configuration.

The image.openshift.io/triggers annotation on database Deployments is
missing the namespace field in the ImageStreamTag reference. Without it,
the image trigger controller looks for ImageStreams in the user's namespace
instead of 'openshift', causing image resolution to fail.

Add "namespace":"${NAMESPACE}" to the trigger from object in both
mysql-persistent and mysql-ephemeral templates.

Also remove a stray image.openshift.io/triggers annotation from the Service
object in mysql-persistent-template.json — it was a copy-paste error that
referenced ${MARIADB_VERSION}. Services don't have containers.

Related: okd-project/okd#2337

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b172cea8-0c59-4741-aab8-87fb896660e7

📥 Commits

Reviewing files that changed from the base of the PR and between f2cad14 and f004113.

📒 Files selected for processing (2)
  • examples/mysql-ephemeral-template.json
  • examples/mysql-persistent-template.json

📝 Walkthrough

Walkthrough

Two OpenShift MySQL template JSON files are updated to correct image.openshift.io/triggers annotations. Both templates' Deployment resources gain an explicit namespace: ${NAMESPACE} field in their ImageStreamTag trigger reference. The persistent template also has the trigger annotation removed from the Service resource.

Changes

ImageStreamTag trigger annotation corrections

Layer / File(s) Summary
Fix image trigger annotations
examples/mysql-ephemeral-template.json, examples/mysql-persistent-template.json
Deployment image.openshift.io/triggers annotations updated to include namespace: ${NAMESPACE} in the ImageStreamTag from reference. Service annotation image.openshift.io/triggers removed from the persistent template.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 A namespace was missing, the trigger ran blind,
Two JSON templates left the rabbit behind.
Now ${NAMESPACE} is set, the stream tag is found,
And the Service lost clutter — clean, safe, and sound.
Hop hop, all is well in the container ground! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: adding a missing namespace parameter to image trigger annotations in the MySQL template files to fix deployment failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

Pull Request validation

Success

🟢 CI - All checks have passed
🟢 Review - Reviewed by a member
🟢 Approval - Changes were approved


Auto Merge

Failed

🔴 Pull Request has unsupported target branch master, expected branches are: ''

Success

🟢 Pull Request is not marked as draft and it's not blocked by dont-merge label
🟢 Pull Request meet requirements, title has correct form
🟢 Pull Request meet requirements, mergeable is true
🟢 Pull Request meet requirements, mergeable_state is clean


Triggered by Workflow Run

@pskrbasu

Copy link
Copy Markdown
Contributor Author

[test-openshift-pytest]

@phracek phracek 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

@phracek

phracek commented Jun 23, 2026

Copy link
Copy Markdown
Member

[test-openshift-pytest]

@phracek phracek merged commit fa8878f into sclorg:master Jun 23, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants