From 7ebafce464ab2e4976d269ee332b0092b366e274 Mon Sep 17 00:00:00 2001 From: Pratik Shah Date: Fri, 13 Jan 2023 00:01:03 +0530 Subject: [PATCH] Added params for postgres oc (#1860) --- .../postgres-dep-config-blueprint.yaml | 2 +- pkg/app/postgresql-deploymentconfig.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/postgresql-deploymentconfig/postgres-dep-config-blueprint.yaml b/examples/postgresql-deploymentconfig/postgres-dep-config-blueprint.yaml index c07bb3c65e..1e99805707 100644 --- a/examples/postgresql-deploymentconfig/postgres-dep-config-blueprint.yaml +++ b/examples/postgresql-deploymentconfig/postgres-dep-config-blueprint.yaml @@ -61,7 +61,7 @@ actions: export PGUSER='postgres' export PGPASSWORD='{{ index .Phases.pgRestore.Secrets.pgSecret.Data "postgresql_admin_password" | toString }}' BACKUP_LOCATION={{ .ArtifactsIn.cloudObject.KeyValue.backupLocation }} - kando location pull --profile '{{ toJson .Profile }}' --path "${BACKUP_LOCATION}" - | gunzip -c -f | sed 's/"LOCALE"/"LC_COLLATE"/' | psql -q -U "${PGUSER}" + kando location pull --profile '{{ toJson .Profile }}' --path "${BACKUP_LOCATION}" - | gunzip -c -f | sed 's/LOCALE_PROVIDER = libc//' | sed 's/LOCALE/LC_COLLATE/' | psql -q -U "${PGUSER}" delete: inputArtifactNames: - cloudObject diff --git a/pkg/app/postgresql-deploymentconfig.go b/pkg/app/postgresql-deploymentconfig.go index ccf1a31d35..575491d5a4 100644 --- a/pkg/app/postgresql-deploymentconfig.go +++ b/pkg/app/postgresql-deploymentconfig.go @@ -46,6 +46,7 @@ type PostgreSQLDepConfig struct { namespace string opeshiftClient openshift.OSClient envVar map[string]string + params map[string]string storageType storage // dbTemplateVersion will most probably match with the OCP version dbTemplateVersion DBTemplate @@ -58,6 +59,10 @@ func NewPostgreSQLDepConfig(name string, templateVersion DBTemplate, storageType envVar: map[string]string{ "POSTGRESQL_ADMIN_PASSWORD": "secretpassword", }, + params: map[string]string{ + "POSTGRESQL_VERSION": "13-el8", + "POSTGRESQL_DATABASE": "postgres", + }, storageType: storageType, dbTemplateVersion: templateVersion, } @@ -83,7 +88,7 @@ func (pgres *PostgreSQLDepConfig) Install(ctx context.Context, namespace string) dbTemplate := getOpenShiftDBTemplate(postgresDepConfigName, pgres.dbTemplateVersion, pgres.storageType) - _, err := pgres.opeshiftClient.NewApp(ctx, pgres.namespace, dbTemplate, pgres.envVar, nil) + _, err := pgres.opeshiftClient.NewApp(ctx, pgres.namespace, dbTemplate, pgres.envVar, pgres.params) if err != nil { return errors.Wrapf(err, "Error installing application %s on openshift cluster", pgres.name) }