Skip to content

feat: Single TCP route for all coords #404

feat: Single TCP route for all coords

feat: Single TCP route for all coords #404

name: Lint and Test Charts High Availability
on:
pull_request:
paths:
- "charts/memgraph-high-availability/**"
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.14.0
- uses: actions/setup-python@v4
with:
python-version: "3.12"
check-latest: true
- name: Download dependencies
run: |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
- name: Update chart dependencies
run: |
helm dependency update charts/memgraph-high-availability
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }} --check-version-increment false --lint-conf lintconf.yaml --charts charts/memgraph-high-availability
# 🔹 Minikube instead of kind
- name: Set up Minikube
if: steps.list-changed.outputs.changed == 'true'
uses: medyagh/setup-minikube@latest
with:
driver: docker
- name: Create Minikube cluster (5 nodes)
if: steps.list-changed.outputs.changed == 'true'
run: |
minikube start --nodes=5 --driver=docker
minikube addons disable storage-provisioner
minikube addons disable default-storageclass
minikube addons enable volumesnapshots
minikube addons enable csi-hostpath-driver
kubectl get nodes -o wide
- name: Set up Memgraph environment variables
if: steps.list-changed.outputs.changed == 'true'
run: |
echo "MEMGRAPH_ENTERPRISE_LICENSE=${{ secrets.MEMGRAPH_ENTERPRISE_LICENSE }}" >> $GITHUB_ENV
echo "MEMGRAPH_ORGANIZATION_NAME=${{ secrets.MEMGRAPH_ORGANIZATION_NAME }}" >> $GITHUB_ENV
- name: Install csi-hostpath-delayed storage class
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl apply -f ./charts/memgraph-high-availability/storage-class.yaml
- name: Create Kubernetes secret for license
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl create secret generic memgraph-secrets \
--from-literal=MEMGRAPH_ENTERPRISE_LICENSE="$MEMGRAPH_ENTERPRISE_LICENSE" \
--from-literal=MEMGRAPH_ORGANIZATION_NAME="$MEMGRAPH_ORGANIZATION_NAME" \
--namespace default
- name: Install memgraph-high-availability
if: steps.list-changed.outputs.changed == 'true'
run: |
helm install memgraph-db ./charts/memgraph-high-availability \
--set storage.data.libStorageClassName=csi-hostpath-delayed \
--set storage.data.logStorageClassName=csi-hostpath-delayed \
--set storage.coordinators.libStorageClassName=csi-hostpath-delayed \
--set storage.coordinators.logStorageClassName=csi-hostpath-delayed
- name: Wait for Memgraph pods
if: steps.list-changed.outputs.changed == 'true'
run: |
echo "Waiting for all pods in the namespace to be Ready..."
all_ready=false
for _ in {1..60}; do
echo "--- Pod status at $(date) ---"
kubectl get pods -o wide | grep -E '(NAME|memgraph-coordinator|memgraph-data)'
# If any pods are Pending, describe them
pending=$(kubectl get pods --no-headers | grep -E 'memgraph-(coordinator|data)' | awk '$3=="Pending"{print $1}')
if [ -n "$pending" ]; then
echo "⚠️ Some pods are Pending, describing..."
for pod in $pending; do
echo ">>> kubectl describe pod $pod"
kubectl describe pod "$pod"
done
fi
# Check if all pods are Ready
not_ready=$(kubectl get pods --no-headers | grep -E 'memgraph-(coordinator|data)' | awk '{print $2}' | grep -vE '^([0-9]+)/\1$' || true)
if [ -z "$not_ready" ]; then
echo "✅ All pods are Ready"
all_ready=true
break
fi
sleep 10
done
if [ "$all_ready" = false ]; then
echo "❌ ERROR: Timeout waiting for pods to become ready after 10 minutes"
kubectl get pods | grep -E '(NAME|memgraph-coordinator|memgraph-data)'
exit 1
fi
- name: Run Helm tests (create test Jobs)
if: steps.list-changed.outputs.changed == 'true'
run: |
helm test memgraph-db --timeout 5m || true
- name: Collect Helm test pod logs
if: steps.list-changed.outputs.changed == 'true'
run: |
jobs=$(kubectl get jobs -o jsonpath='{.items[?(@.metadata.labels."helm\.sh/hook"=="test")].metadata.name}')
for job in $jobs; do
echo "=== Logs for job/$job ==="
pods=$(kubectl get pods --selector=job-name=$job -o jsonpath='{.items[*].metadata.name}')
for pod in $pods; do
echo "--- pod/$pod ---"
kubectl logs "$pod"
done
done