From c00ff8e2b87df0a853d2879ef4e24c95e8c365f9 Mon Sep 17 00:00:00 2001 From: Petr Kubat Date: Thu, 16 Nov 2017 11:04:40 +0100 Subject: [PATCH 1/6] templates: use pg_isready as liveness probe Resolves: #195 --- examples/postgresql-ephemeral-template.json | 8 ++++---- examples/postgresql-persistent-template.json | 8 ++++---- examples/replica/postgresql_replica.json | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/postgresql-ephemeral-template.json b/examples/postgresql-ephemeral-template.json index 849c9d83..17588a53 100644 --- a/examples/postgresql-ephemeral-template.json +++ b/examples/postgresql-ephemeral-template.json @@ -127,11 +127,11 @@ } }, "livenessProbe": { + "exec": { + "command": [ "/bin/sh", "-i", "-c", "pg_isready -h 127.0.0.1 -p 5432" ] + }, "timeoutSeconds": 1, - "initialDelaySeconds": 30, - "tcpSocket": { - "port": 5432 - } + "initialDelaySeconds": 30 }, "env": [ { diff --git a/examples/postgresql-persistent-template.json b/examples/postgresql-persistent-template.json index b622baa0..0f0fc070 100644 --- a/examples/postgresql-persistent-template.json +++ b/examples/postgresql-persistent-template.json @@ -144,11 +144,11 @@ } }, "livenessProbe": { + "exec": { + "command": [ "/bin/sh", "-i", "-c", "pg_isready -h 127.0.0.1 -p 5432" ] + }, "timeoutSeconds": 1, - "initialDelaySeconds": 30, - "tcpSocket": { - "port": 5432 - } + "initialDelaySeconds": 30 }, "env": [ { diff --git a/examples/replica/postgresql_replica.json b/examples/replica/postgresql_replica.json index 008e3571..9af3c42d 100644 --- a/examples/replica/postgresql_replica.json +++ b/examples/replica/postgresql_replica.json @@ -211,11 +211,11 @@ } }, "livenessProbe": { + "exec": { + "command": [ "/bin/sh", "-i", "-c", "pg_isready -h 127.0.0.1 -p 5432" ] + }, "timeoutSeconds": 1, - "initialDelaySeconds": 30, - "tcpSocket": { - "port": 5432 - } + "initialDelaySeconds": 30 }, "env": [ { @@ -322,11 +322,11 @@ } }, "livenessProbe": { + "exec": { + "command": [ "/bin/sh", "-i", "-c", "pg_isready -h 127.0.0.1 -p 5432" ] + }, "timeoutSeconds": 1, - "initialDelaySeconds": 30, - "tcpSocket": { - "port": 5432 - } + "initialDelaySeconds": 30 }, "env": [ { From 37cff380348f61fac9dbcac3d8bebe12f0c94e6b Mon Sep 17 00:00:00 2001 From: Petr Kubat Date: Tue, 21 Nov 2017 12:21:48 +0100 Subject: [PATCH 2/6] templates: Use 9.6 as the default version --- examples/postgresql-ephemeral-template.json | 8 ++++---- examples/postgresql-persistent-template.json | 8 ++++---- examples/replica/postgresql_replica.json | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/postgresql-ephemeral-template.json b/examples/postgresql-ephemeral-template.json index 17588a53..5ff29ba4 100644 --- a/examples/postgresql-ephemeral-template.json +++ b/examples/postgresql-ephemeral-template.json @@ -5,7 +5,7 @@ "name": "postgresql-ephemeral", "annotations": { "openshift.io/display-name": "PostgreSQL (Ephemeral)", - "description": "PostgreSQL database service, without persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/blob/master/9.5.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing", + "description": "PostgreSQL database service, without persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing", "iconClass": "icon-postgresql", "tags": "database,postgresql", "template.openshift.io/long-description": "This template provides a standalone PostgreSQL server with a database created. The database is not stored on persistent storage, so any restart of the service will result in all data being lost. The database name, username, and password are chosen via parameters when provisioning this service.", @@ -14,7 +14,7 @@ "template.openshift.io/support-url": "https://access.redhat.com" } }, - "message": "The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.\n\n Username: ${POSTGRESQL_USER}\n Password: ${POSTGRESQL_PASSWORD}\n Database Name: ${POSTGRESQL_DATABASE}\n Connection URL: postgresql://${DATABASE_SERVICE_NAME}:5432/\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/blob/master/9.5.", + "message": "The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.\n\n Username: ${POSTGRESQL_USER}\n Password: ${POSTGRESQL_PASSWORD}\n Database Name: ${POSTGRESQL_DATABASE}\n Connection URL: postgresql://${DATABASE_SERVICE_NAME}:5432/\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.", "labels": { "template": "postgresql-ephemeral-template" }, @@ -245,8 +245,8 @@ { "name": "POSTGRESQL_VERSION", "displayName": "Version of PostgreSQL Image", - "description": "Version of PostgreSQL image to be used (9.2, 9.4, 9.5 or latest).", - "value": "9.5", + "description": "Version of PostgreSQL image to be used (9.4, 9.5, 9.6 or latest).", + "value": "9.6", "required": true } ] diff --git a/examples/postgresql-persistent-template.json b/examples/postgresql-persistent-template.json index 0f0fc070..b524e369 100644 --- a/examples/postgresql-persistent-template.json +++ b/examples/postgresql-persistent-template.json @@ -5,7 +5,7 @@ "name": "postgresql-persistent", "annotations": { "openshift.io/display-name": "PostgreSQL (Persistent)", - "description": "PostgreSQL database service, with persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/blob/master/9.5.\n\nNOTE: Scaling to more than one replica is not supported. You must have persistent volumes available in your cluster to use this template.", + "description": "PostgreSQL database service, with persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.\n\nNOTE: Scaling to more than one replica is not supported. You must have persistent volumes available in your cluster to use this template.", "iconClass": "icon-postgresql", "tags": "database,postgresql", "template.openshift.io/long-description": "This template provides a standalone PostgreSQL server with a database created. The database is stored on persistent storage. The database name, username, and password are chosen via parameters when provisioning this service.", @@ -14,7 +14,7 @@ "template.openshift.io/support-url": "https://access.redhat.com" } }, - "message": "The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.\n\n Username: ${POSTGRESQL_USER}\n Password: ${POSTGRESQL_PASSWORD}\n Database Name: ${POSTGRESQL_DATABASE}\n Connection URL: postgresql://${DATABASE_SERVICE_NAME}:5432/\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/blob/master/9.5.", + "message": "The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.\n\n Username: ${POSTGRESQL_USER}\n Password: ${POSTGRESQL_PASSWORD}\n Database Name: ${POSTGRESQL_DATABASE}\n Connection URL: postgresql://${DATABASE_SERVICE_NAME}:5432/\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.", "labels": { "template": "postgresql-persistent-template" }, @@ -269,8 +269,8 @@ { "name": "POSTGRESQL_VERSION", "displayName": "Version of PostgreSQL Image", - "description": "Version of PostgreSQL image to be used (9.2, 9.4, 9.5 or latest).", - "value": "9.5", + "description": "Version of PostgreSQL image to be used (9.4, 9.5, 9.6 or latest).", + "value": "9.6", "required": true } ] diff --git a/examples/replica/postgresql_replica.json b/examples/replica/postgresql_replica.json index 9af3c42d..eb9bf4f6 100644 --- a/examples/replica/postgresql_replica.json +++ b/examples/replica/postgresql_replica.json @@ -71,7 +71,7 @@ "name": "IMAGESTREAMTAG", "displayName": "ImageStreamTag", "description": "The OpenShift ImageStreamTag to use for PostgreSQL.", - "value": "postgresql:9.5" + "value": "postgresql:9.6" }, { "name": "NAMESPACE", From ec1a0b4e3c734a6ebdab1f85252727870cf50916 Mon Sep 17 00:00:00 2001 From: Petr Kubat Date: Mon, 4 Dec 2017 15:13:48 +0100 Subject: [PATCH 3/6] tests: use local namespace instead of openshift --- common | 2 +- test/run-openshift | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/common b/common index 1de313c6..7ffcd4f9 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 1de313c67ebac09fb375dd77f7fb9b0e62f52774 +Subproject commit 7ffcd4f9496b376bc07ec321ac8bf374caeb19f0 diff --git a/test/run-openshift b/test/run-openshift index 89c1750d..57e173be 100755 --- a/test/run-openshift +++ b/test/run-openshift @@ -12,6 +12,9 @@ source "$THISDIR"/test-lib-openshift.sh set -exo nounset +test -n "${IMAGE_NAME-}" || false 'make sure $IMAGE_NAME is defined' +test -n "${VERSION-}" || false 'make sure $VERSION is defined' + function check_postgresql_os_service_connection() { local util_image_name=$1 ; shift local service_name=$1 ; shift @@ -69,9 +72,10 @@ function test_postgresql_template() { local service_name=${image_name_no_namespace} ct_os_new_project - ct_os_upload_image "${image_name}" + ct_os_upload_image "${image_name}" "postgresql:$VERSION" - ct_os_deploy_template_image ${THISDIR}/postgresql-ephemeral-template.json \ + ct_os_deploy_template_image "$THISDIR/postgresql-ephemeral-template.json" \ + NAMESPACE="$(oc project -q)" \ DATABASE_SERVICE_NAME="${service_name}" \ POSTGRESQL_USER=testu \ POSTGRESQL_PASSWORD=testp \ @@ -84,5 +88,5 @@ function test_postgresql_template() { } ct_os_cluster_up -test_postgresql_pure_image ${IMAGE_NAME} -test_postgresql_template ${IMAGE_NAME} +test_postgresql_pure_image "${IMAGE_NAME}" +test_postgresql_template "${IMAGE_NAME}" From cc5dd193a03880e968c4727a40cc813076a96ead Mon Sep 17 00:00:00 2001 From: Petr Kubat Date: Mon, 4 Dec 2017 16:12:32 +0100 Subject: [PATCH 4/6] tests: set the image version for the template --- test/run-openshift | 1 + 1 file changed, 1 insertion(+) diff --git a/test/run-openshift b/test/run-openshift index 57e173be..2815cec3 100755 --- a/test/run-openshift +++ b/test/run-openshift @@ -76,6 +76,7 @@ function test_postgresql_template() { ct_os_deploy_template_image "$THISDIR/postgresql-ephemeral-template.json" \ NAMESPACE="$(oc project -q)" \ + POSTGRESQL_VERSION="$VERSION" \ DATABASE_SERVICE_NAME="${service_name}" \ POSTGRESQL_USER=testu \ POSTGRESQL_PASSWORD=testp \ From 979b709f00201b2ee3358c75d1a9dca0a9aba7b3 Mon Sep 17 00:00:00 2001 From: Petr Kubat Date: Tue, 5 Dec 2017 14:23:55 +0100 Subject: [PATCH 5/6] tests: explicitly state tag during pure image test --- test/run-openshift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/run-openshift b/test/run-openshift index 2815cec3..651f59b4 100755 --- a/test/run-openshift +++ b/test/run-openshift @@ -55,8 +55,10 @@ function test_postgresql_pure_image() { ct_os_new_project ct_os_upload_image "${image_name}" + # Create a specific imagestream tag for the image so that oc cannot use anything else + ct_os_upload_image "${image_name}" "$image_name_no_namespace:testing" - ct_os_deploy_pure_image "${image_name}" \ + ct_os_deploy_pure_image "$image_name_no_namespace:testing" \ --name "${service_name}" \ --env POSTGRESQL_ADMIN_PASSWORD=test From 2da5f7b2d388242516f2e4d1015ca6533892f89c Mon Sep 17 00:00:00 2001 From: Petr Kubat Date: Thu, 7 Dec 2017 10:53:46 +0100 Subject: [PATCH 6/6] Update to latest commons --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 7ffcd4f9..fd9b209b 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 7ffcd4f9496b376bc07ec321ac8bf374caeb19f0 +Subproject commit fd9b209b31143366654cd9b9c8e8b87c9a71a29e