Update scripts

This commit is contained in:
Björn Busse 2024-01-08 17:34:45 +01:00
parent c14a75b6b5
commit 2aae249b82
2 changed files with 25 additions and 8 deletions

26
deploy
View File

@ -7,27 +7,41 @@ DEPLOY_MODE="flux"
readonly DEPLOY_MODE
APP_NAMESPACE="app"
readonly APP_NAMESPACE
PGSQLHA_VERSION="12.3.7"
readonly PGSQLHA_VERSION
MONITORING_NAMESPACE="monitoring"
readonly MONITORING_NAMESPACE
PGSQLHA_CHART_VERSION="12.3.7"
readonly PGSQLHA_CHART_VERSION
PGSQLHA_OCI_URL="oci://registry-1.docker.io/bitnamicharts/postgresql-ha"
readonly PGSQLHA_OCI_URL
GTFSO_IMPORT_CHART_VERSION="0.1.0"
readonly GTFSO_IMPORT_CHART_VERSION
GTFSO_VBB_CHART_VERSION="0.1.0"
readonly GTFSO_VBB_CHART_VERSION
# Create namespace
# Create namespaces
kubectl create namespace "${APP_NAMESPACE}"
kubectl create namespace "${MONITORING_NAMESPACE}"
# Add Helm Charts
# Add Deployments / Helm Charts either via fluxcd or Helm
if [ "flux" == $DEPLOY_MODE ]; then
# Add Helm Charts via Flux HelmRelease CRD
printf "Using flux to create HelmRelease\n"
./flux create helmrelease pgsql-ha \
--chart postgresql-ha \
--chart-version "${PGSQLHA_VERSION}" \
--chart-version "${PGSQLHA_CHART_VERSION}" \
--source HelmRepository/bitnamicharts \
--namespace "${APP_NAMESPACE}"
elif [ "helm" == $DEPLOY_MODE ]; then
# Add Helm Charts via Helm
printf "Using Helm to install Chart\n"
helm install pgsql-ha "${PGSQLHA_OCI_URL}" \
--version "${PGSQLHA_VERSION}" \
--version "${PGSQLHA_CHART_VERSION}" \
--namespace "${APP_NAMESPACE}"
helm install gtfso-import charts/gtfso-import \
--version "${GTFSO_IMPORT_CHART_VERSION}" \
--namespace "${APP_NAMESPACE}"
helm install gtfso-vbb charts/gtfso-vbb \
--version "${GTFSO_VBB_CHART_VERSION}" \
--namespace "${APP_NAMESPACE}"
fi

View File

@ -68,7 +68,7 @@ fi
if ! $(which terraform) or 1=="$TF_FORCE_LOCAL"; then
printf "Fetching terraform archive..\n"
curl -LO "${TF_URL}"
tar xf "${TF_ARCHIVE}"
unzip -o "${TF_ARCHIVE}"
TF_CMD="./terraform"
else
TF_CMD="terraform"
@ -76,7 +76,7 @@ fi
# Install flux if not in PATH
# or local version enforced
if ! $(which flux) or 1=="$FLUX_FORCE_LOCAL"; then
if ! $(which flux) ] or 1=="$FLUX_FORCE_LOCAL"; then
printf "Fetching flux archive..\n"
curl -LO "${FLUX_URL}"
tar xf "${FLUX_ARCHIVE}"
@ -92,6 +92,9 @@ if [[ $(${FLUX_CMD} get helmreleases --all-namespaces) ]]; then
fi
# 'flux bootstrap' is idempotent
# We use the Gitea integration with a PAT
# that needs to be supplied to create and write to
# Gitea fluxcd owned repositories
printf 'Installing Flux controller\n'
${FLUX_CMD} bootstrap gitea \
--hostname="$GITEA_HOSTNAME" \