Skip to content

Commit

Permalink
make requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
louisehuyton authored Dec 16, 2024
1 parent 8935873 commit df118cb
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions bin/v2/postgres-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ if [ -z "${NAMESPACE_NAME}" ] || [ -z "${APP_NAME}" ]; then
exit 1
fi

if [ ! -f "apps/$NAMESPACE_NAME/preview/aso" ]; then
if [ ! -f "apps/$NAMESPACE_NAME/dev/aso" ]; then
echo "Creating aso"
mkdir -p apps/$NAMESPACE_NAME
mkdir -p apps/$NAMESPACE_NAME/preview
mkdir -p apps/$NAMESPACE_NAME/preview/aso
mkdir -p apps/$NAMESPACE_NAME/dev
mkdir -p apps/$NAMESPACE_NAME/dev/aso

(
cat <<EOF
Expand All @@ -41,7 +41,7 @@ spec:
source: user-override
value: "btree_gin"
EOF
) >"apps/$NAMESPACE_NAME/preview/aso/$NAMESPACE_NAME-postgres-config.yaml"
) >"apps/$NAMESPACE_NAME/dev/aso/$NAMESPACE_NAME-postgres-config.yaml"

(
cat <<EOF
Expand All @@ -51,21 +51,16 @@ metadata:
name: ${NAMESPACE}-${ENVIRONMENT}
namespace: ${NAMESPACE}
spec:
version: "14"
network:
delegatedSubnetResourceReference:
armId: /subscriptions/8b6ea922-0862-443e-af15-6056e1c9b9a4/resourceGroups/cft-preview-network-rg/providers/Microsoft.Network/virtualNetworks/cft-preview-vnet/subnets/postgresql
privateDnsZoneArmResourceReference:
armId: /subscriptions/1baf5470-1c3e-40d3-a6f7-74bfbce4b348/resourceGroups/core-infra-intsvc-rg/providers/Microsoft.Network/privateDnsZones/privatelink.postgres.database.azure.com
version: "16"
EOF
) >"apps/$NAMESPACE_NAME/preview/aso/$NAMESPACE_NAME-postgres.yaml"
) >"apps/$NAMESPACE_NAME/dev/aso/$NAMESPACE_NAME-postgres.yaml"
fi

if [ ! -f "apps/$NAMESPACE_NAME/preview/sops-secrets" ]; then
if [ ! -f "apps/$NAMESPACE_NAME/dev/sops-secrets" ]; then
echo "Creating sops-secrets"
mkdir -p apps/$NAMESPACE_NAME
mkdir -p apps/$NAMESPACE_NAME/preview
mkdir -p apps/$NAMESPACE_NAME/preview/sops-secrets
mkdir -p apps/$NAMESPACE_NAME/dev
mkdir -p apps/$NAMESPACE_NAME/dev/sops-secrets
fi

(
Expand All @@ -80,7 +75,7 @@ metadata:
namespace: $NAMESPACE_NAME
type: Opaque
EOF
) >"apps/$NAMESPACE_NAME/preview/sops-secrets/$APP_NAME-values.enc.yaml"
) >"apps/$NAMESPACE_NAME/dev/sops-secrets/$APP_NAME-values.enc.yaml"

if ! [ -f /usr/local/bin/sops ]; then
echo "Sops is not installed... installing..."
Expand All @@ -89,7 +84,7 @@ if ! [ -f /usr/local/bin/sops ]; then
chmod +x /usr/local/bin/sops
fi

sops --encrypt --azure-kv https://dcdcftappsdevkv.vault.azure.net/keys/sops-key/aedb9ea38954430ca1d0a46ed589c049 --encrypted-regex "^(data|stringData)$" --in-place apps/$NAMESPACE_NAME/preview/sops-secrets/$APP_NAME-values.enc.yaml
sops --encrypt --azure-kv https://dtssharedservicesdevkv.vault.azure.net/keys/sops-key/2beba064ddfe454482ad0133af2cf0fd --encrypted-regex "^(data|stringData)$" --in-place apps/$NAMESPACE_NAME/dev/sops-secrets/$APP_NAME-values.enc.yaml

(
cat <<EOF
Expand All @@ -99,4 +94,4 @@ resources:
- $APP_NAME-postgres.enc.yaml
namespace: $NAMESPACE_NAME
EOF
) >"apps/$NAMESPACE_NAME/preview/sops-secrets/kustomization.yaml"
) >"apps/$NAMESPACE_NAME/dev/sops-secrets/kustomization.yaml"

0 comments on commit df118cb

Please sign in to comment.