From 50dbf90466bb386f729fa49e6f2a10fdb88181e8 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Mon, 4 Dec 2023 10:37:09 +0100 Subject: [PATCH] Allow to specify RUBY_VERSION in example templates Signed-off-by: Petr "Stone" Hracek --- examples/rails-postgresql-persistent.json | 54 ++++++---------------- examples/rails-postgresql.json | 56 ++++++----------------- 2 files changed, 27 insertions(+), 83 deletions(-) diff --git a/examples/rails-postgresql-persistent.json b/examples/rails-postgresql-persistent.json index e536dbad..770a4669 100644 --- a/examples/rails-postgresql-persistent.json +++ b/examples/rails-postgresql-persistent.json @@ -112,7 +112,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "ruby:3.0-ubi8" + "name": "ruby:${RUBY_VERSION}" }, "env": [ { @@ -148,13 +148,14 @@ } }, { - "kind": "DeploymentConfig", + "kind": "Deployment", "apiVersion": "apps.openshift.io/v1", "metadata": { "name": "${NAME}", "annotations": { "description": "Defines how to deploy the application server", - "template.alpha.openshift.io/wait-for-ready": "true" + "template.alpha.openshift.io/wait-for-ready": "true", + "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"${NAME}:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]" } }, "spec": { @@ -172,24 +173,6 @@ } } }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "${NAME}" - ], - "from": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - } - }, - { - "type": "ConfigChange" - } - ], "replicas": 1, "selector": { "name": "${NAME}" @@ -355,32 +338,14 @@ "name": "${DATABASE_SERVICE_NAME}", "annotations": { "description": "Defines how to deploy the database", - "template.alpha.openshift.io/wait-for-ready": "true" + "template.alpha.openshift.io/wait-for-ready": "true", + "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:12-el8\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]" } }, "spec": { "strategy": { "type": "Recreate" }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "postgresql" - ], - "from": { - "kind": "ImageStreamTag", - "namespace": "${NAMESPACE}", - "name": "postgresql:10" - } - } - }, - { - "type": "ConfigChange" - } - ], "replicas": 1, "selector": { "name": "${DATABASE_SERVICE_NAME}" @@ -489,6 +454,13 @@ "description": "The OpenShift Namespace where the ImageStream resides.", "value": "openshift" }, + { + "name": "RUBY_VERSION", + "displayName": "Ruby Version", + "description": "Version of Ruby image to be used (3.0-ubi8 by default).", + "required": true, + "value": "3.0-ubi8" + }, { "name": "MEMORY_LIMIT", "displayName": "Memory Limit", diff --git a/examples/rails-postgresql.json b/examples/rails-postgresql.json index e49c6bac..0bf76953 100644 --- a/examples/rails-postgresql.json +++ b/examples/rails-postgresql.json @@ -112,7 +112,7 @@ "from": { "kind": "ImageStreamTag", "namespace": "${NAMESPACE}", - "name": "ruby:3.0-ubi8" + "name": "ruby:${RUBY_VERSION}" }, "env": [ { @@ -148,13 +148,14 @@ } }, { - "kind": "DeploymentConfig", + "kind": "Deployment", "apiVersion": "apps.openshift.io/v1", "metadata": { "name": "${NAME}", "annotations": { "description": "Defines how to deploy the application server", - "template.alpha.openshift.io/wait-for-ready": "true" + "template.alpha.openshift.io/wait-for-ready": "true", + "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"${NAME}:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]" } }, "spec": { @@ -172,24 +173,6 @@ } } }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "${NAME}" - ], - "from": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - } - }, - { - "type": "ConfigChange" - } - ], "replicas": 1, "selector": { "name": "${NAME}" @@ -332,38 +315,20 @@ } }, { - "kind": "DeploymentConfig", + "kind": "Deployment", "apiVersion": "apps.openshift.io/v1", "metadata": { "name": "${DATABASE_SERVICE_NAME}", "annotations": { "description": "Defines how to deploy the database", - "template.alpha.openshift.io/wait-for-ready": "true" + "template.alpha.openshift.io/wait-for-ready": "true", + "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:12-el8\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]" } }, "spec": { "strategy": { "type": "Recreate" }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "postgresql" - ], - "from": { - "kind": "ImageStreamTag", - "namespace": "${NAMESPACE}", - "name": "postgresql:10" - } - } - }, - { - "type": "ConfigChange" - } - ], "replicas": 1, "selector": { "name": "${DATABASE_SERVICE_NAME}" @@ -470,6 +435,13 @@ "description": "The OpenShift Namespace where the ImageStream resides.", "value": "openshift" }, + { + "name": "RUBY_VERSION", + "displayName": "Ruby Version", + "description": "Version of Ruby image to be used (3.0-ubi8 by default).", + "required": true, + "value": "3.0-ubi8" + }, { "name": "MEMORY_LIMIT", "displayName": "Memory Limit",