Skip to content

Commit

Permalink
olm-additions
Browse files Browse the repository at this point in the history
Signed-off-by: jackyalbo <jacky.albo@gmail.com>
  • Loading branch information
jackyalbo committed Dec 25, 2023
1 parent 6f5509d commit cb71627
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ gen-olm: gen

gen-odf-package: cli
rm -rf $(MANIFESTS)
MANIFESTS="$(MANIFESTS)" CSV_NAME="$(csv-name)" SKIP_RANGE="$(skip-range)" REPLACES="$(replaces)" CORE_IMAGE="$(core-image)" DB_IMAGE="$(db-image)" OPERATOR_IMAGE="$(operator-image)" COSI_SIDECAR_IMAGE="$(cosi-sidecar-image)" OBC_CRD="$(obc-crd)" build/gen-odf-package.sh
MANIFESTS="$(MANIFESTS)" CSV_NAME="$(csv-name)" SKIP_RANGE="$(skip-range)" REPLACES="$(replaces)" CORE_IMAGE="$(core-image)" DB_IMAGE="$(db-image)" OPERATOR_IMAGE="$(operator-image)" COSI_SIDECAR_IMAGE="$(cosi-sidecar-image)" OBC_CRD="$(obc-crd)" PSQL_12_IMAGE="$(psql-12-image)" build/gen-odf-package.sh
@echo "✅ gen-odf-package"
.PHONY: gen-odf-package

Expand Down
5 changes: 4 additions & 1 deletion build/gen-odf-package.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

if [ "${MANIFESTS}" == "" ] || [ "${CSV_NAME}" == "" ] || [ "${CORE_IMAGE}" == "" ] || [ "${DB_IMAGE}" == "" ] || [ "${OPERATOR_IMAGE}" == "" ] || [ "${COSI_SIDECAR_IMAGE}" == "" ]
if [ "${MANIFESTS}" == "" ] || [ "${CSV_NAME}" == "" ] || [ "${CORE_IMAGE}" == "" ] || [ "${PSQL_12_IMAGE}" == "" ] || [ "${DB_IMAGE}" == "" ] || [ "${OPERATOR_IMAGE}" == "" ] || [ "${COSI_SIDECAR_IMAGE}" == "" ]
then
echo "gen-odf-package.sh: not all required envs were supplied"
exit 1
Expand All @@ -16,6 +16,7 @@ echo "--obc-crd=${OBC_CRD}"
--replaces "${REPLACES}" \
--noobaa-image ${CORE_IMAGE} \
--db-image ${DB_IMAGE} \
--psql-12-image ${PSQL_12_IMAGE} \
--operator-image ${OPERATOR_IMAGE} \
--cosi-sidecar-image ${COSI_SIDECAR_IMAGE} \
--obc-crd=${OBC_CRD}
Expand All @@ -34,6 +35,8 @@ cat >> ${temp_csv} << EOF
name: noobaa-core
- image: ${DB_IMAGE}
name: noobaa-db
- image: ${PSQL_12_IMAGE}
name: noobaa-psql-12
- image: ${OPERATOR_IMAGE}
name: noobaa-operator
EOF
Expand Down
15 changes: 7 additions & 8 deletions pkg/bundle/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3650,7 +3650,7 @@ data:
shared_preload_libraries = 'pg_stat_statements'
`

const Sha256_deploy_internal_configmap_postgres_initdb_yaml = "41bc439713ca794d6b9e1d020c7462449281f860d45e3a1ece8cef13655bb3d9"
const Sha256_deploy_internal_configmap_postgres_initdb_yaml = "9ce7163b6de6bf58c2804ca6be2efc69fef7c90951fa549d17fa08a3a2684fc8"

const File_deploy_internal_configmap_postgres_initdb_yaml = `apiVersion: v1
kind: ConfigMap
Expand Down Expand Up @@ -3712,7 +3712,7 @@ data:
upgradedb.sh: |
set -e
PGDATA=$HOME/data/userdata
PGDATA_new=$HOME/data/userdata-new
PGDATA_12=$HOME/data/userdata-12
THRESHOLD=33
USE=$(df -h --output=pcent "/$HOME/data" | tail -n 1 | tr -d '[:space:]%')
# Check if the used space is more than the threshold
Expand All @@ -3721,23 +3721,22 @@ data:
exit 1
fi
echo "Info: Free space $USE% is below $THRESHOLD% threshold. Starting upgrade!"
if [ ! -d $PGDATA_new ]; then
mv $PGDATA $PGDATA_new
if [ ! -d $PGDATA_12 ]; then
mv $PGDATA $PGDATA_12
fi
sed -i -e 's/^\(postgres:[^:]\):[0-9]*:[0-9]*:/\1:10001:0:/' /etc/passwd
su postgres -c "bash -x /usr/bin/run-postgresql" &
until pg_isready; do sleep 1; done;
psql -U postgres < /$HOME/data/dump.sql
rm /$HOME/data/dump.sql
rm -rf $PGDATA_new
exit 0
revertdb.sh: |
PGDATA=$HOME/data/userdata
PGDATA_new=$HOME/data/userdata-new
if [ -d $PGDATA_new ]; then
PGDATA_12=$HOME/data/userdata-12
if [ -d $PGDATA_12 ]; then
rm -rf $PGDATA
mv $PGDATA_new $PGDATA
mv $PGDATA_12 $PGDATA
fi
exit 0
`
Expand Down
4 changes: 4 additions & 0 deletions pkg/olm/olm.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ func GenerateCSV(opConf *operator.Conf, csvParams *generateCSVParams) *operv1.Cl
Name: "NOOBAA_DB_IMAGE",
Value: options.DBImage,
},
corev1.EnvVar{
Name: "NOOBAA_PSQL_12_IMAGE",
Value: options.Psql12Image,
},
corev1.EnvVar{
Name: "ENABLE_NOOBAA_ADMISSION",
Value: "true",
Expand Down
8 changes: 8 additions & 0 deletions pkg/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ var DBImage = "centos/mongodb-36-centos7"
// currently it can not be overridden.
var DBPostgresImage = "quay.io/sclorg/postgresql-15-c9s"

// Psql12Image is the default postgres12 db image url
// currently it can not be overridden.
var Psql12Image = "quay.io/sclorg/postgresql-15-c9s"

// DBMongoImage is the default mongo db image url
// this is used during migration to solve issues where mongo STS referencing to postgres image
var DBMongoImage = "centos/mongodb-36-centos7"
Expand Down Expand Up @@ -226,6 +230,10 @@ func init() {
&DBImage, "db-image",
DBImage, "The database container image",
)
FlagSet.StringVar(
&Psql12Image, "psql-12-image",
Psql12Image, "The database old container image",
)
FlagSet.StringVar(
&CosiSideCarImage, "cosi-sidecar-image",
CosiSideCarImage, "The cosi side car container image",
Expand Down

0 comments on commit cb71627

Please sign in to comment.