From 219628409a4b95cf7fa92ececb5253f9e81f9149 Mon Sep 17 00:00:00 2001 From: Itay Grudev Date: Mon, 9 Sep 2024 04:08:15 +0300 Subject: [PATCH 1/6] Addressed comments --- charts/cluster/templates/_bootstrap.tpl | 7 ------- 1 file changed, 7 deletions(-) diff --git a/charts/cluster/templates/_bootstrap.tpl b/charts/cluster/templates/_bootstrap.tpl index 87f27303f..597aacd36 100644 --- a/charts/cluster/templates/_bootstrap.tpl +++ b/charts/cluster/templates/_bootstrap.tpl @@ -15,13 +15,6 @@ bootstrap: - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; {{- else if eq .Values.type "timescaledb" }} - CREATE EXTENSION IF NOT EXISTS timescaledb; - {{- else if eq .Values.type "paradedb" }} - - CREATE EXTENSION IF NOT EXISTS pg_search; - - CREATE EXTENSION IF NOT EXISTS pg_analytics; - - CREATE EXTENSION IF NOT EXISTS pg_ivm; - - CREATE EXTENSION IF NOT EXISTS vector; - - CREATE EXTENSION IF NOT EXISTS vectorscale; - - ALTER DATABASE "{{ default "app" .Values.cluster.initdb.database }}" SET search_path TO public,paradedb; {{- end }} {{- with .Values.cluster.initdb }} {{- range .postInitApplicationSQL }} From 17ea476ea966552e42064f8fbefa4e13e60a98a8 Mon Sep 17 00:00:00 2001 From: Itay Grudev Date: Mon, 9 Sep 2024 04:25:33 +0300 Subject: [PATCH 2/6] Bug Fix: Recovery not working if extensions are only specified in template sql --- charts/cluster/templates/_bootstrap.tpl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/charts/cluster/templates/_bootstrap.tpl b/charts/cluster/templates/_bootstrap.tpl index 597aacd36..87f27303f 100644 --- a/charts/cluster/templates/_bootstrap.tpl +++ b/charts/cluster/templates/_bootstrap.tpl @@ -15,6 +15,13 @@ bootstrap: - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; {{- else if eq .Values.type "timescaledb" }} - CREATE EXTENSION IF NOT EXISTS timescaledb; + {{- else if eq .Values.type "paradedb" }} + - CREATE EXTENSION IF NOT EXISTS pg_search; + - CREATE EXTENSION IF NOT EXISTS pg_analytics; + - CREATE EXTENSION IF NOT EXISTS pg_ivm; + - CREATE EXTENSION IF NOT EXISTS vector; + - CREATE EXTENSION IF NOT EXISTS vectorscale; + - ALTER DATABASE "{{ default "app" .Values.cluster.initdb.database }}" SET search_path TO public,paradedb; {{- end }} {{- with .Values.cluster.initdb }} {{- range .postInitApplicationSQL }} From db9ce0f415fbbbbddaca9a943384b1450814e5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20No=C3=ABl?= Date: Sat, 7 Sep 2024 10:22:15 -0400 Subject: [PATCH 3/6] Add test --- .DS_Store | Bin 0 -> 6148 bytes .github/.DS_Store | Bin 0 -> 6148 bytes .github/workflows/test-helm-chart.yml | 320 ++++++++++++++++++++++++++ 3 files changed, 320 insertions(+) create mode 100644 .DS_Store create mode 100644 .github/.DS_Store create mode 100644 .github/workflows/test-helm-chart.yml diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1e019e1534ffe6af15b6a9129dd0e34a18ce4c29 GIT binary patch literal 6148 zcmeHK%Wl&^6upy%#z{qq5J=r1Sz;SX+CmXx6OtHIsiaaJ=mJoP8%kIraJUdH?D zpS``wXrR9h-@HK>jN)qbJIk%*Z>$%rg0*42chC65jl1!9RPPSoie8)Z&|9>--kZRm zbjo)cJc_$PUGQyomTGnI$oN%cR}ZxPZ@SWHh*Rhf&C*K4t`~bfr)LMI+)g zBtNYay9d9ds_S$LJ-hIXX_WC55tF{RsX<57B!?aVU!WHK7Dis9)kgFS>SfmWky)d3 zwZ;*hfa}mPxoJ*L{gVEhG=O%TF2RVvjG(74e}@6})3KP)Gs!I?9|zCdL`-K{E=;JG zWRxW1P_mHAGLBR)$-xpUX?mYq8!P#A=An!NMuC5+fcQSxC<1F5=L+Sg1C_i20P`4@ zhPM3c546Pqu%>aY5F;?As6a(!`ijBy&4DR8=4;x2u29j5$;enoM`rql!t}+1+0va@ zO`)lc0!D$f0&A*U7U#e7`}=>IWO_ycqriWq0LwSsW*sT%v-MhX;;gk%KA;E_eshJA lf=VC9vLTM*Efi^(vqb|~(>Pa%5t#WSAZ0L>QQ)sC@CyON?9u=L literal 0 HcmV?d00001 diff --git a/.github/.DS_Store b/.github/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7729569e08bb4c0030c943ba1790303b38438e28 GIT binary patch literal 6148 zcmeHKO>fgc5S>j!V^e{00I3(GmAFPBZD}jS#SP`a6(cwR3U(8~bhBI8POU16u9t||a5ml{>Jm`^*VqctTw}Ul`--((W)sNF zJrqeQo(Xl5ij``g_!||_&#prWolr>`{qp=&iXQ!19KriPj3FYrNmEoxQ{ATvaHk~f zGr#0~y~4RoIZeP(bdLHGai2a>VaD5E=CXTNxFJ=j%juNflR#88Z&))L`|^86S`}xh zFpO{MnaGNAF!;_|8|@pLouCtJ1#jbzs*1~`oE5_)f32@xC?(P+PSTgzq#AYaJW;Yt zGC9c&AsbIn^5#`0$Eq5tnH(2}8{3W`48l=&dp_Si-0$(dgPlc>&mZj$di>$u!D0~x zcke%V{CspOrc!;zEMN>@lCfJ38_=`7MvL<}mqN)8=xvw{!=qQgE8rDar+`~8f~|E0 zKJOLq3jDVU==FiaHAW6=i)QISV~zm8Hqyor>z_u=;SM8*wMF#6n568aJA5!VGIJ*sW=6;TxhW?WS@f+}z$>tiz%e`t$!X$zOQ|yaNA} z0<3);9}h7lx3{iLPVcoG{tm89*VPs;DG1C~j9R@FZ^Mlt&vgKd9M%?*f%zW+BZF_e I0)JG2pPNU97ytkO literal 0 HcmV?d00001 diff --git a/.github/workflows/test-helm-chart.yml b/.github/workflows/test-helm-chart.yml new file mode 100644 index 000000000..d6e936908 --- /dev/null +++ b/.github/workflows/test-helm-chart.yml @@ -0,0 +1,320 @@ +# workflows/test-helm-chart.yml +# +# Test Helm Chart +# Test the ParadeDB Helm chart against a local Minikube cluster and a local AWS EKS cluster. + +name: Test Helm Chart + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - "charts/paradedb/*" + - ".github/workflows/test-helm-chart.yml" + workflow_dispatch: + +concurrency: + group: test-helm-chart-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + test-helm-minikube: + name: Test Helm Chart on Minikube + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + + steps: + - name: Checkout Git Repository + uses: actions/checkout@v4 + + - name: Set up Kubectl + uses: azure/setup-kubectl@v4 + + - name: Set up Helm + uses: azure/setup-helm@v4 + + # Enables the default-storageclass and storage-provisioner addons by default + - name: Set up & Start Minikube + uses: medyagh/setup-minikube@latest + + - name: Install the CloudNativePG Operator + run: | + helm repo add cnpg https://cloudnative-pg.github.io/charts + helm upgrade --install cnpg --namespace cnpg-system --create-namespace cnpg/cloudnative-pg + + - name: Wait for CNPG Webhook Service to be Ready + run: | + kubectl wait --namespace cnpg-system --for=condition=available --timeout=120s deployment/cnpg-cloudnative-pg + kubectl get svc -n cnpg-system cnpg-webhook-service + + - name: Test Helm Dependency Update + working-directory: charts/paradedb/ + run: helm dependency update . --debug + + - name: Update appVersion to Latest paradedb/paradedb Tag + working-directory: charts/paradedb/ + run: | + # Fetch the latest release tag and strip the 'v' prefix + LATEST_TAG=$(curl -s https://api.github.com/repos/paradedb/paradedb/releases/latest | jq -r '.tag_name') + CLEANED_TAG=${LATEST_TAG#v} + + # Update the appVersion in the Chart.yaml file + sed -i "s/^appVersion: .*/appVersion: $CLEANED_TAG/" Chart.yaml + cat Chart.yaml + + - name: Test Helm Template + working-directory: charts/paradedb/ + run: helm template paradedb . --debug + + - name: Test Helm Install + working-directory: charts/paradedb/ + run: helm install paradedb . --namespace paradedb --create-namespace --debug + + - name: Test Helm Upgrade + working-directory: charts/paradedb/ + run: helm upgrade paradedb . --namespace paradedb --debug + + # TODO: This fails + - name: Test PostgreSQL Connection + run: | + # Get the ParadeDB K8s cluster secrets + kubectl -n paradedb get secrets paradedb-app -o yaml + + # Decode the ParadeDB K8s cluster secrets + export PG_USERNAME=$(kubectl -n paradedb get secrets paradedb-app -o jsonpath="{.data.username}" | base64 --decode) + export PG_PASSWORD=$(kubectl -n paradedb get secrets paradedb-app -o jsonpath="{.data.password}" | base64 --decode) + export PG_DATABASE=$(kubectl -n paradedb get secrets paradedb-app -o jsonpath="{.data.dbname}" | base64 --decode) + + # Wait for PostgreSQL to be ready + sleep 30 + + # Check if any pods were found + POD_NAMES=$(kubectl -n paradedb get pods --no-headers | grep 'paradedb-1-initdb-' | awk '{print $1}') + if [ -n "$POD_NAMES" ]; then + for POD_NAME in $POD_NAMES; do + echo "Fetching details for pod $POD_NAME..." + kubectl -n paradedb describe pod $POD_NAME + + echo "Fetching logs for pod $POD_NAME..." + kubectl -n paradedb logs $POD_NAME || echo "No current logs available for $POD_NAME." + echo "--------------------------------------" + done + else + echo "No pods matching the pattern found." + fi + + echo "Fetching details for all resources in the paradedb namespace..." + kubectl -n paradedb get all + + echo "Waiting for the paradedb-rw service to be ready..." + while [[ $(kubectl -n paradedb get pods -l app=paradedb -o jsonpath="{.items[*].status.containerStatuses[*].ready}") != "true" ]]; do + echo "Waiting for pod(s) to be ready..." + sleep 5 + done + + echo "Starting port-forward..." + kubectl port-forward svc/paradedb-rw 5432:5432 & + + echo "Connecting to ParadeDB via psql..." + psql -h localhost -p 5432 -U $PG_USERNAME -d $PG_DATABASE -c "SELECT * FROM pg_extension;" + + - name: Test Helm Uninstall + run: helm uninstall paradedb --namespace paradedb --debug + + test-helm-eks: + name: Test Helm Chart on AWS EKS via LocalStack + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + + steps: + - name: Checkout Git Repository + uses: actions/checkout@v4 + + - name: Set up Kubectl + uses: azure/setup-kubectl@v4 + + - name: Set up Helm + uses: azure/setup-helm@v4 + + - name: Start LocalStack + uses: LocalStack/setup-localstack@v0.2.2 + with: + image-tag: "latest" + install-awslocal: "true" + configuration: DEBUG=1 + use-pro: "true" + env: + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} + + - name: Configure AWS CLI for LocalStack + run: | + awslocal configure set aws_secret_access_key test + awslocal configure set aws_access_key_id test + awslocal configure set region us-east-1 + + # As of writing, the latest Kubernetes version available on LocalStack EKS + # is 1.29. CloudNativePG requires version 1.25+ + - name: Create the LocalStack AWS EKS Cluster + run: | + awslocal --endpoint-url=http://localhost:4566 eks create-cluster \ + --name paradedb-eks \ + --role-arn arn:aws:iam::000000000000:role/eks-service-role \ + --resources-vpc-config subnetIds=subnet-12345 \ + --kubernetes-version 1.29 + + - name: Wait for LocalStack AWS EKS Cluster to be Active + run: | + for i in {1..10}; do + STATUS=$(awslocal --endpoint-url=http://localhost:4566 --region us-east-1 eks describe-cluster --name paradedb-eks --query 'cluster.status' --output text) + if [ "$STATUS" == "ACTIVE" ]; then + echo "Cluster is ACTIVE" + break + else + echo "Cluster status is $STATUS. Waiting..." + sleep 10 + fi + done + + - name: Update Kubeconfig to Use the LocalStack AWS EKS Cluster + run: awslocal --endpoint-url=http://localhost:4566 eks update-kubeconfig --name paradedb-eks + + - name: Wait for the LocalStack AWS EKS Cluster to be Ready + run: | + nodes=$(kubectl get nodes --no-headers -o custom-columns=NAME:.metadata.name) + for node in $nodes; do + kubectl wait --for=condition=ready node/$node --timeout=120s + done + + # This is required to mock the AWS EKS storage class + - name: Create StorageClass + run: | + cat < Date: Sat, 7 Sep 2024 10:22:39 -0400 Subject: [PATCH 4/6] Rm DS_Store --- .DS_Store | Bin 6148 -> 0 bytes .github/.DS_Store | Bin 6148 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store delete mode 100644 .github/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 1e019e1534ffe6af15b6a9129dd0e34a18ce4c29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%Wl&^6upy%#z{qq5J=r1Sz;SX+CmXx6OtHIsiaaJ=mJoP8%kIraJUdH?D zpS``wXrR9h-@HK>jN)qbJIk%*Z>$%rg0*42chC65jl1!9RPPSoie8)Z&|9>--kZRm zbjo)cJc_$PUGQyomTGnI$oN%cR}ZxPZ@SWHh*Rhf&C*K4t`~bfr)LMI+)g zBtNYay9d9ds_S$LJ-hIXX_WC55tF{RsX<57B!?aVU!WHK7Dis9)kgFS>SfmWky)d3 zwZ;*hfa}mPxoJ*L{gVEhG=O%TF2RVvjG(74e}@6})3KP)Gs!I?9|zCdL`-K{E=;JG zWRxW1P_mHAGLBR)$-xpUX?mYq8!P#A=An!NMuC5+fcQSxC<1F5=L+Sg1C_i20P`4@ zhPM3c546Pqu%>aY5F;?As6a(!`ijBy&4DR8=4;x2u29j5$;enoM`rql!t}+1+0va@ zO`)lc0!D$f0&A*U7U#e7`}=>IWO_ycqriWq0LwSsW*sT%v-MhX;;gk%KA;E_eshJA lf=VC9vLTM*Efi^(vqb|~(>Pa%5t#WSAZ0L>QQ)sC@CyON?9u=L diff --git a/.github/.DS_Store b/.github/.DS_Store deleted file mode 100644 index 7729569e08bb4c0030c943ba1790303b38438e28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO>fgc5S>j!V^e{00I3(GmAFPBZD}jS#SP`a6(cwR3U(8~bhBI8POU16u9t||a5ml{>Jm`^*VqctTw}Ul`--((W)sNF zJrqeQo(Xl5ij``g_!||_&#prWolr>`{qp=&iXQ!19KriPj3FYrNmEoxQ{ATvaHk~f zGr#0~y~4RoIZeP(bdLHGai2a>VaD5E=CXTNxFJ=j%juNflR#88Z&))L`|^86S`}xh zFpO{MnaGNAF!;_|8|@pLouCtJ1#jbzs*1~`oE5_)f32@xC?(P+PSTgzq#AYaJW;Yt zGC9c&AsbIn^5#`0$Eq5tnH(2}8{3W`48l=&dp_Si-0$(dgPlc>&mZj$di>$u!D0~x zcke%V{CspOrc!;zEMN>@lCfJ38_=`7MvL<}mqN)8=xvw{!=qQgE8rDar+`~8f~|E0 zKJOLq3jDVU==FiaHAW6=i)QISV~zm8Hqyor>z_u=;SM8*wMF#6n568aJA5!VGIJ*sW=6;TxhW?WS@f+}z$>tiz%e`t$!X$zOQ|yaNA} z0<3);9}h7lx3{iLPVcoG{tm89*VPs;DG1C~j9R@FZ^Mlt&vgKd9M%?*f%zW+BZF_e I0)JG2pPNU97ytkO From e5d772e1c2e0719ec90205a98e0282fb6d78e259 Mon Sep 17 00:00:00 2001 From: Itay Grudev Date: Tue, 10 Sep 2024 02:01:45 +0300 Subject: [PATCH 5/6] Test modifications by Itay (#16) --- .github/workflows/test-helm-chart.yml | 173 ++------------------------ 1 file changed, 11 insertions(+), 162 deletions(-) diff --git a/.github/workflows/test-helm-chart.yml b/.github/workflows/test-helm-chart.yml index d6e936908..8453e8aed 100644 --- a/.github/workflows/test-helm-chart.yml +++ b/.github/workflows/test-helm-chart.yml @@ -9,7 +9,7 @@ on: pull_request: types: [opened, synchronize, reopened, ready_for_review] paths: - - "charts/paradedb/*" + - "charts/cluster/*" - ".github/workflows/test-helm-chart.yml" workflow_dispatch: @@ -18,109 +18,6 @@ concurrency: cancel-in-progress: true jobs: - test-helm-minikube: - name: Test Helm Chart on Minikube - runs-on: ubuntu-latest - if: github.event.pull_request.draft == false - - steps: - - name: Checkout Git Repository - uses: actions/checkout@v4 - - - name: Set up Kubectl - uses: azure/setup-kubectl@v4 - - - name: Set up Helm - uses: azure/setup-helm@v4 - - # Enables the default-storageclass and storage-provisioner addons by default - - name: Set up & Start Minikube - uses: medyagh/setup-minikube@latest - - - name: Install the CloudNativePG Operator - run: | - helm repo add cnpg https://cloudnative-pg.github.io/charts - helm upgrade --install cnpg --namespace cnpg-system --create-namespace cnpg/cloudnative-pg - - - name: Wait for CNPG Webhook Service to be Ready - run: | - kubectl wait --namespace cnpg-system --for=condition=available --timeout=120s deployment/cnpg-cloudnative-pg - kubectl get svc -n cnpg-system cnpg-webhook-service - - - name: Test Helm Dependency Update - working-directory: charts/paradedb/ - run: helm dependency update . --debug - - - name: Update appVersion to Latest paradedb/paradedb Tag - working-directory: charts/paradedb/ - run: | - # Fetch the latest release tag and strip the 'v' prefix - LATEST_TAG=$(curl -s https://api.github.com/repos/paradedb/paradedb/releases/latest | jq -r '.tag_name') - CLEANED_TAG=${LATEST_TAG#v} - - # Update the appVersion in the Chart.yaml file - sed -i "s/^appVersion: .*/appVersion: $CLEANED_TAG/" Chart.yaml - cat Chart.yaml - - - name: Test Helm Template - working-directory: charts/paradedb/ - run: helm template paradedb . --debug - - - name: Test Helm Install - working-directory: charts/paradedb/ - run: helm install paradedb . --namespace paradedb --create-namespace --debug - - - name: Test Helm Upgrade - working-directory: charts/paradedb/ - run: helm upgrade paradedb . --namespace paradedb --debug - - # TODO: This fails - - name: Test PostgreSQL Connection - run: | - # Get the ParadeDB K8s cluster secrets - kubectl -n paradedb get secrets paradedb-app -o yaml - - # Decode the ParadeDB K8s cluster secrets - export PG_USERNAME=$(kubectl -n paradedb get secrets paradedb-app -o jsonpath="{.data.username}" | base64 --decode) - export PG_PASSWORD=$(kubectl -n paradedb get secrets paradedb-app -o jsonpath="{.data.password}" | base64 --decode) - export PG_DATABASE=$(kubectl -n paradedb get secrets paradedb-app -o jsonpath="{.data.dbname}" | base64 --decode) - - # Wait for PostgreSQL to be ready - sleep 30 - - # Check if any pods were found - POD_NAMES=$(kubectl -n paradedb get pods --no-headers | grep 'paradedb-1-initdb-' | awk '{print $1}') - if [ -n "$POD_NAMES" ]; then - for POD_NAME in $POD_NAMES; do - echo "Fetching details for pod $POD_NAME..." - kubectl -n paradedb describe pod $POD_NAME - - echo "Fetching logs for pod $POD_NAME..." - kubectl -n paradedb logs $POD_NAME || echo "No current logs available for $POD_NAME." - echo "--------------------------------------" - done - else - echo "No pods matching the pattern found." - fi - - echo "Fetching details for all resources in the paradedb namespace..." - kubectl -n paradedb get all - - echo "Waiting for the paradedb-rw service to be ready..." - while [[ $(kubectl -n paradedb get pods -l app=paradedb -o jsonpath="{.items[*].status.containerStatuses[*].ready}") != "true" ]]; do - echo "Waiting for pod(s) to be ready..." - sleep 5 - done - - echo "Starting port-forward..." - kubectl port-forward svc/paradedb-rw 5432:5432 & - - echo "Connecting to ParadeDB via psql..." - psql -h localhost -p 5432 -U $PG_USERNAME -d $PG_DATABASE -c "SELECT * FROM pg_extension;" - - - name: Test Helm Uninstall - run: helm uninstall paradedb --namespace paradedb --debug - test-helm-eks: name: Test Helm Chart on AWS EKS via LocalStack runs-on: ubuntu-latest @@ -246,75 +143,27 @@ jobs: kubectl get svc -n cnpg-system cnpg-webhook-service - name: Test Helm Dependency Update - working-directory: charts/paradedb/ + working-directory: charts/cluster/ run: helm dependency update . --debug - - name: Update appVersion to Latest paradedb/paradedb Tag - working-directory: charts/paradedb/ + - name: Fetch the latest ParadeDB release tag + id: paradedb-version run: | # Fetch the latest release tag and strip the 'v' prefix LATEST_TAG=$(curl -s https://api.github.com/repos/paradedb/paradedb/releases/latest | jq -r '.tag_name') CLEANED_TAG=${LATEST_TAG#v} - - # Update the appVersion in the Chart.yaml file - sed -i "s/^appVersion: .*/appVersion: $CLEANED_TAG/" Chart.yaml - cat Chart.yaml - - - name: Test Helm Template - working-directory: charts/paradedb/ - run: helm template paradedb . --debug + echo $CLEANED_TAG + echo "version=$CLEANED_TAG" >> $GITHUB_OUTPUT - name: Test Helm Install - working-directory: charts/paradedb/ - run: helm install paradedb . --namespace paradedb --create-namespace --debug + working-directory: charts/cluster/ + run: helm install paradedb . --namespace paradedb --create-namespace --set version.paradedb=${{ steps.paradedb-version.outputs.version }} --debug - name: Test Helm Upgrade - working-directory: charts/paradedb/ - run: helm upgrade paradedb . --namespace paradedb --debug + working-directory: charts/cluster/ + run: helm upgrade paradedb . --namespace paradedb --reuse-values --wait --debug # TODO: This fails - name: Test PostgreSQL Connection run: | - # Get the ParadeDB K8s cluster secrets - kubectl -n paradedb get secrets paradedb-app -o yaml - - # Decode the ParadeDB K8s cluster secrets - export PG_USERNAME=$(kubectl -n paradedb get secrets paradedb-app -o jsonpath="{.data.username}" | base64 --decode) - export PG_PASSWORD=$(kubectl -n paradedb get secrets paradedb-app -o jsonpath="{.data.password}" | base64 --decode) - export PG_DATABASE=$(kubectl -n paradedb get secrets paradedb-app -o jsonpath="{.data.dbname}" | base64 --decode) - - # Wait for PostgreSQL to be ready - sleep 30 - - # Get the list of pods matching the pattern - POD_NAMES=$(kubectl -n paradedb get pods --no-headers | grep 'paradedb-1-initdb-' | awk '{print $1}') - - # Check if any pods were found - if [ -n "$POD_NAMES" ]; then - # Loop through each pod name - for POD_NAME in $POD_NAMES; do - echo "Fetching details for pod $POD_NAME..." - - # Describe the pod - kubectl -n paradedb describe pod $POD_NAME - - echo "Fetching logs for pod $POD_NAME..." - - # Fetch current logs - kubectl -n paradedb logs $POD_NAME || echo "No current logs available for $POD_NAME." - - # Fetch previous logs (if any) - kubectl -n paradedb logs $POD_NAME --previous || echo "No previous logs available for $POD_NAME." - - echo "--------------------------------------" - done - else - echo "No pods matching the pattern found." - fi - - # Test that we can connect to the ParadeDB K8s cluster via psql and that the extensions are installed - kubectl port-forward svc/paradedb-rw 5432:5432 & - psql -h localhost -p 5432 -U $PG_USERNAME -d $PG_DATABASE -c "SELECT * FROM pg_extension;" - - - name: Test Helm Uninstall - run: helm uninstall paradedb --namespace paradedb --debug + helm test paradedb --namespace paradedb \ No newline at end of file From 05df8b86594e30c7a4d79597f60ad7c43800e0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20No=C3=ABl?= Date: Mon, 9 Sep 2024 16:19:42 -0700 Subject: [PATCH 6/6] Clean up a bit --- ...t-helm-chart.yml => paradedb-test-eks.yml} | 71 +++---------------- 1 file changed, 10 insertions(+), 61 deletions(-) rename .github/workflows/{test-helm-chart.yml => paradedb-test-eks.yml} (68%) diff --git a/.github/workflows/test-helm-chart.yml b/.github/workflows/paradedb-test-eks.yml similarity index 68% rename from .github/workflows/test-helm-chart.yml rename to .github/workflows/paradedb-test-eks.yml index 8453e8aed..88c0955e6 100644 --- a/.github/workflows/test-helm-chart.yml +++ b/.github/workflows/paradedb-test-eks.yml @@ -1,25 +1,26 @@ -# workflows/test-helm-chart.yml +# workflows/paradedb-test-eks.yml # -# Test Helm Chart -# Test the ParadeDB Helm chart against a local Minikube cluster and a local AWS EKS cluster. +# ParadeDB Test EKS +# Test the ParadeDB Helm chart against a local AWS EKS cluster via LocalStack. This test workflow is +# specific to the ParadeDB cloudnative-pg/charts fork. -name: Test Helm Chart +name: ParadeDB Test EKS on: pull_request: types: [opened, synchronize, reopened, ready_for_review] paths: - "charts/cluster/*" - - ".github/workflows/test-helm-chart.yml" + - ".github/workflows/paradedb-test-eks.yml" workflow_dispatch: concurrency: - group: test-helm-chart-${{ github.head_ref || github.ref }} + group: paradedb-test-eks-${{ github.head_ref || github.ref }} cancel-in-progress: true jobs: - test-helm-eks: - name: Test Helm Chart on AWS EKS via LocalStack + paradedb-test-eks: + name: Test ParadeDB Helm Chart on AWS EKS via LocalStack runs-on: ubuntu-latest if: github.event.pull_request.draft == false @@ -82,56 +83,6 @@ jobs: kubectl wait --for=condition=ready node/$node --timeout=120s done - # This is required to mock the AWS EKS storage class - - name: Create StorageClass - run: | - cat <