From 7e2ece4cc7695102d043fb5b17d48539581e3804 Mon Sep 17 00:00:00 2001 From: Puskar Basu Date: Mon, 22 Jun 2026 16:18:52 +0530 Subject: [PATCH] Fix database template image triggers to include namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When database templates were migrated from DeploymentConfig to Deployment (openshift/library commit f865a9e2), the image.openshift.io/triggers annotation dropped the namespace field from the ImageStreamTag reference. Without an explicit namespace, the image trigger controller defaults to the Deployment's own namespace instead of 'openshift', causing image resolution to fail. The container image stays as ' ' (a single space), which Kubernetes rejects with: spec.containers[0].image: Invalid value: " ": must not have leading or trailing whitespace. Fix: Add "namespace":"${NAMESPACE}" to the trigger annotation's from object in all 12 affected OKD database templates. The NAMESPACE parameter already exists in every template (default: 'openshift'). Additional fixes: - dancer-mysql-example: Add missing image trigger annotation and MYSQL_VERSION parameter to the database Deployment - mysql-persistent: Remove stray image.openshift.io/triggers annotation from the Service object (copy-paste error referencing MARIADB_VERSION) Only okd-x86_64 assets are changed — OCP templates are not affected. Fixes: https://github.com/okd-project/okd/issues/2337 Co-Authored-By: Claude Opus 4.6 --- .../cakephp/templates/cakephp-mysql-example.json | 4 ++-- .../cakephp/templates/cakephp-mysql-persistent.json | 4 ++-- .../okd-x86_64/dancer/templates/dancer-mysql-example.json | 8 ++++++++ .../dancer/templates/dancer-mysql-persistent.json | 4 ++-- .../okd-x86_64/mariadb/templates/mariadb-ephemeral.json | 4 ++-- .../okd-x86_64/mariadb/templates/mariadb-persistent.json | 4 ++-- .../okd-x86_64/mysql/templates/mysql-ephemeral.json | 4 ++-- .../okd-x86_64/mysql/templates/mysql-persistent.json | 5 ++--- .../postgresql/templates/postgresql-ephemeral.json | 4 ++-- .../postgresql/templates/postgresql-persistent.json | 4 ++-- .../okd-x86_64/redis/templates/redis-ephemeral.json | 4 ++-- .../okd-x86_64/redis/templates/redis-persistent.json | 4 ++-- 12 files changed, 30 insertions(+), 23 deletions(-) diff --git a/assets/operator/okd-x86_64/cakephp/templates/cakephp-mysql-example.json b/assets/operator/okd-x86_64/cakephp/templates/cakephp-mysql-example.json index dd2c6aac5..cea87f769 100755 --- a/assets/operator/okd-x86_64/cakephp/templates/cakephp-mysql-example.json +++ b/assets/operator/okd-x86_64/cakephp/templates/cakephp-mysql-example.json @@ -298,7 +298,7 @@ "metadata": { "annotations": { "description": "Defines how to deploy the database", - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mysql:${MYSQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"mysql:${MYSQL_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -540,4 +540,4 @@ "app": "cakephp-mysql-example", "template": "cakephp-mysql-example" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/cakephp/templates/cakephp-mysql-persistent.json b/assets/operator/okd-x86_64/cakephp/templates/cakephp-mysql-persistent.json index 17dc52fc1..08da3fdf8 100755 --- a/assets/operator/okd-x86_64/cakephp/templates/cakephp-mysql-persistent.json +++ b/assets/operator/okd-x86_64/cakephp/templates/cakephp-mysql-persistent.json @@ -369,7 +369,7 @@ "metadata": { "annotations": { "description": "Defines how to deploy the database", - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mysql:${MYSQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"mysql:${MYSQL_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -620,4 +620,4 @@ "app": "cakephp-mysql-persistent", "template": "cakephp-mysql-persistent" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/dancer/templates/dancer-mysql-example.json b/assets/operator/okd-x86_64/dancer/templates/dancer-mysql-example.json index b71db5074..d83d17d47 100755 --- a/assets/operator/okd-x86_64/dancer/templates/dancer-mysql-example.json +++ b/assets/operator/okd-x86_64/dancer/templates/dancer-mysql-example.json @@ -271,6 +271,7 @@ "metadata": { "annotations": { "description": "Defines how to deploy the database", + "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mysql:${MYSQL_VERSION}\",\"namespace\":\"${NAMESPACE}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -477,6 +478,13 @@ "displayName": "Custom CPAN Mirror URL", "description": "The custom CPAN mirror URL" }, + { + "name": "MYSQL_VERSION", + "displayName": "Version of MySQL Image", + "description": "Version of MySQL image to be used (8.0-el8, 8.0-el9, or latest).", + "value": "8.0-el8", + "required": true + }, { "name": "MYSQL_DEFAULT_AUTHENTICATION_PLUGIN", "displayName": "MySQL authentication plugin", diff --git a/assets/operator/okd-x86_64/dancer/templates/dancer-mysql-persistent.json b/assets/operator/okd-x86_64/dancer/templates/dancer-mysql-persistent.json index e5696d624..f410e8ad5 100755 --- a/assets/operator/okd-x86_64/dancer/templates/dancer-mysql-persistent.json +++ b/assets/operator/okd-x86_64/dancer/templates/dancer-mysql-persistent.json @@ -288,7 +288,7 @@ "metadata": { "annotations": { "description": "Defines how to deploy the database", - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mysql:${MYSQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"mysql:${MYSQL_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -524,4 +524,4 @@ "app": "dancer-mysql-persistent", "template": "dancer-mysql-persistent" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/mariadb/templates/mariadb-ephemeral.json b/assets/operator/okd-x86_64/mariadb/templates/mariadb-ephemeral.json index cefe291f0..b3c382533 100755 --- a/assets/operator/okd-x86_64/mariadb/templates/mariadb-ephemeral.json +++ b/assets/operator/okd-x86_64/mariadb/templates/mariadb-ephemeral.json @@ -62,7 +62,7 @@ "kind": "Deployment", "metadata": { "annotations": { - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mariadb:${MARIADB_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"mariadb:${MARIADB_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -246,4 +246,4 @@ "app.openshift.io/runtime": "mariadb", "template": "mariadb-ephemeral-template" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/mariadb/templates/mariadb-persistent.json b/assets/operator/okd-x86_64/mariadb/templates/mariadb-persistent.json index 41e7957ce..847eab5e4 100755 --- a/assets/operator/okd-x86_64/mariadb/templates/mariadb-persistent.json +++ b/assets/operator/okd-x86_64/mariadb/templates/mariadb-persistent.json @@ -79,7 +79,7 @@ "kind": "Deployment", "metadata": { "annotations": { - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mariadb:${MARIADB_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"mariadb:${MARIADB_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -270,4 +270,4 @@ "app.openshift.io/runtime": "mariadb", "template": "mariadb-persistent-template" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/mysql/templates/mysql-ephemeral.json b/assets/operator/okd-x86_64/mysql/templates/mysql-ephemeral.json index f1536a599..e8eb64dbf 100755 --- a/assets/operator/okd-x86_64/mysql/templates/mysql-ephemeral.json +++ b/assets/operator/okd-x86_64/mysql/templates/mysql-ephemeral.json @@ -70,7 +70,7 @@ "kind": "Deployment", "metadata": { "annotations": { - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mysql:${MYSQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"mysql:${MYSQL_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -264,4 +264,4 @@ "app.openshift.io/runtime": "mysql-database", "template": "mysql-ephemeral-template" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/mysql/templates/mysql-persistent.json b/assets/operator/okd-x86_64/mysql/templates/mysql-persistent.json index f71eb0c09..90e46e33b 100755 --- a/assets/operator/okd-x86_64/mysql/templates/mysql-persistent.json +++ b/assets/operator/okd-x86_64/mysql/templates/mysql-persistent.json @@ -41,7 +41,6 @@ "kind": "Service", "metadata": { "annotations": { - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mysql:${MARIADB_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.openshift.io/expose-uri": "mysql://{.spec.clusterIP}:{.spec.ports[?(.name==\"mysql\")].port}" }, "name": "${DATABASE_SERVICE_NAME}" @@ -80,7 +79,7 @@ "kind": "Deployment", "metadata": { "annotations": { - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mysql:${MYSQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"mysql:${MYSQL_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -271,4 +270,4 @@ "app.openshift.io/runtime": "mysql-database", "template": "mysql-persistent-template" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/postgresql/templates/postgresql-ephemeral.json b/assets/operator/okd-x86_64/postgresql/templates/postgresql-ephemeral.json index eea6b8c87..b039d093e 100755 --- a/assets/operator/okd-x86_64/postgresql/templates/postgresql-ephemeral.json +++ b/assets/operator/okd-x86_64/postgresql/templates/postgresql-ephemeral.json @@ -68,7 +68,7 @@ "kind": "Deployment", "metadata": { "annotations": { - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:${POSTGRESQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"postgresql:${POSTGRESQL_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -239,4 +239,4 @@ "labels": { "template": "postgresql-ephemeral-template" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/postgresql/templates/postgresql-persistent.json b/assets/operator/okd-x86_64/postgresql/templates/postgresql-persistent.json index 812bdb971..e7a079e77 100755 --- a/assets/operator/okd-x86_64/postgresql/templates/postgresql-persistent.json +++ b/assets/operator/okd-x86_64/postgresql/templates/postgresql-persistent.json @@ -85,7 +85,7 @@ "kind": "Deployment", "metadata": { "annotations": { - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:${POSTGRESQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"postgresql:${POSTGRESQL_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -263,4 +263,4 @@ "labels": { "template": "postgresql-persistent-template" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/redis/templates/redis-ephemeral.json b/assets/operator/okd-x86_64/redis/templates/redis-ephemeral.json index 0d5ea8208..dd596bac8 100755 --- a/assets/operator/okd-x86_64/redis/templates/redis-ephemeral.json +++ b/assets/operator/okd-x86_64/redis/templates/redis-ephemeral.json @@ -64,7 +64,7 @@ "kind": "Deployment", "metadata": { "annotations": { - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"redis:${REDIS_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"redis:${REDIS_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -202,4 +202,4 @@ "labels": { "template": "redis-ephemeral-template" } -} \ No newline at end of file +} diff --git a/assets/operator/okd-x86_64/redis/templates/redis-persistent.json b/assets/operator/okd-x86_64/redis/templates/redis-persistent.json index 98936616d..481724f60 100755 --- a/assets/operator/okd-x86_64/redis/templates/redis-persistent.json +++ b/assets/operator/okd-x86_64/redis/templates/redis-persistent.json @@ -81,7 +81,7 @@ "kind": "Deployment", "metadata": { "annotations": { - "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"redis:${REDIS_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]", + "image.openshift.io/triggers": "[{\"from\": {\"kind\": \"ImageStreamTag\", \"name\": \"redis:${REDIS_VERSION}\", \"namespace\": \"${NAMESPACE}\"}, \"fieldPath\": \"spec.template.spec.containers[0].image\"}]", "template.alpha.openshift.io/wait-for-ready": "true" }, "name": "${DATABASE_SERVICE_NAME}" @@ -226,4 +226,4 @@ "labels": { "template": "redis-persistent-template" } -} \ No newline at end of file +}