From 8b8d2eb914a4dc10fd25993033e7eb7e76ed0bde Mon Sep 17 00:00:00 2001 From: shahargl Date: Fri, 15 Nov 2024 13:28:00 +0200 Subject: [PATCH 01/27] feat: add haproxy support --- charts/keep/Chart.yaml | 4 +- charts/keep/templates/ingress-haproxy.yaml | 105 ++++++++++++++++++ .../{ingress.yaml => ingress-nginx.yaml} | 2 +- 3 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 charts/keep/templates/ingress-haproxy.yaml rename charts/keep/templates/{ingress.yaml => ingress-nginx.yaml} (97%) diff --git a/charts/keep/Chart.yaml b/charts/keep/Chart.yaml index 22cf3b7..bafcb46 100644 --- a/charts/keep/Chart.yaml +++ b/charts/keep/Chart.yaml @@ -1,10 +1,10 @@ apiVersion: v2 name: keep -version: 0.1.39 +version: 0.1.40 description: Keep Helm Chart type: application icon: https://platform.keephq.dev/_next/image?url=%2Fkeep.png&w=48&q=75 -appVersion: 0.28.9 +appVersion: 0.28.10 deprecated: false annotations: app: keep diff --git a/charts/keep/templates/ingress-haproxy.yaml b/charts/keep/templates/ingress-haproxy.yaml new file mode 100644 index 0000000..285e5d9 --- /dev/null +++ b/charts/keep/templates/ingress-haproxy.yaml @@ -0,0 +1,105 @@ +{{- if and .Values.global.ingress.enabled (or (eq .Values.global.ingress.className "haproxy") (eq .Values.global.ingress.classType "haproxy")) }} +{{- $fullName := include "keep.fullname" . }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }}-ingress + labels: + {{- include "keep.labels" . | nindent 4 }} + annotations: + kubernetes.io/ingress.class: "haproxy" + # HAProxy timeout configurations + haproxy-ingress.github.io/timeout-client: "3600s" + haproxy-ingress.github.io/timeout-server: "3600s" + haproxy-ingress.github.io/timeout-connect: "3600s" + haproxy-ingress.github.io/timeout-tunnel: "3600s" + + # WebSocket support + haproxy-ingress.github.io/config-backend: | + timeout tunnel 3600s + option http-keep-alive + http-reuse safe + + haproxy-ingress.github.io/ssl-redirect: "false" + + # Backend configurations for path rewrites + haproxy-ingress.github.io/config-backend: | + acl path_v2 path_beg /v2/ + acl path_ws path_beg /websocket/ + http-request set-path %[path,regsub(^/v2/,/)] if path_v2 + http-request set-path %[path,regsub(^/websocket/,/)] if path_ws + +spec: + ingressClassName: haproxy + {{- if .Values.global.ingress.tls }} + tls: + {{- range .Values.global.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- if .Values.global.ingress.hosts }} + {{- range .Values.global.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- if $.Values.websocket.enabled }} + - path: "/websocket" + pathType: Prefix + backend: + service: + name: {{ $fullName }}-websocket + port: + number: {{ $.Values.websocket.service.port }} + {{- end }} + {{- if $.Values.backend.enabled }} + - path: "/v2" + pathType: Prefix + backend: + service: + name: {{ $fullName }}-backend + port: + number: {{ $.Values.backend.service.port }} + {{- end }} + - path: "/" + pathType: Prefix + backend: + service: + name: {{ $fullName }}-frontend + port: + number: {{ $.Values.frontend.service.port }} + {{- end }} + {{- else }} + - http: + paths: + {{- if $.Values.websocket.enabled }} + - path: "/websocket" + pathType: Prefix + backend: + service: + name: {{ $fullName }}-websocket + port: + number: {{ $.Values.websocket.service.port }} + {{- end }} + {{- if $.Values.backend.enabled }} + - path: "/v2" + pathType: Prefix + backend: + service: + name: {{ $fullName }}-backend + port: + number: {{ $.Values.backend.service.port }} + {{- end }} + - path: "/" + pathType: Prefix + backend: + service: + name: {{ $fullName }}-frontend + port: + number: {{ $.Values.frontend.service.port }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/keep/templates/ingress.yaml b/charts/keep/templates/ingress-nginx.yaml similarity index 97% rename from charts/keep/templates/ingress.yaml rename to charts/keep/templates/ingress-nginx.yaml index 786772d..4f340d0 100644 --- a/charts/keep/templates/ingress.yaml +++ b/charts/keep/templates/ingress-nginx.yaml @@ -1,4 +1,4 @@ -{{- if .Values.global.ingress.enabled }} +{{- if and .Values.global.ingress.enabled (or (eq .Values.global.ingress.className "nginx") (eq .Values.global.ingress.classType "nginx")) }} {{- $fullName := include "keep.fullname" . }} apiVersion: networking.k8s.io/v1 kind: Ingress From 7ceedc5e775a6b3f9d826f0282cb7ae8c6eca2a3 Mon Sep 17 00:00:00 2001 From: shahargl Date: Fri, 15 Nov 2024 13:30:07 +0200 Subject: [PATCH 02/27] feat: haproxy --- charts/keep/templates/ingress-haproxy.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/charts/keep/templates/ingress-haproxy.yaml b/charts/keep/templates/ingress-haproxy.yaml index 285e5d9..366946e 100644 --- a/charts/keep/templates/ingress-haproxy.yaml +++ b/charts/keep/templates/ingress-haproxy.yaml @@ -24,10 +24,10 @@ metadata: # Backend configurations for path rewrites haproxy-ingress.github.io/config-backend: | - acl path_v2 path_beg /v2/ - acl path_ws path_beg /websocket/ - http-request set-path %[path,regsub(^/v2/,/)] if path_v2 - http-request set-path %[path,regsub(^/websocket/,/)] if path_ws + acl path_v2 path_beg {{ .Values.global.ingress.backendPrefix }}/ + acl path_ws path_beg {{ .Values.global.ingress.websocketPrefix }}/ + http-request set-path %[path,regsub(^{{ .Values.global.ingress.backendPrefix }}/,/)] if path_v2 + http-request set-path %[path,regsub(^{{ .Values.global.ingress.websocketPrefix }}/,/)] if path_ws spec: ingressClassName: haproxy @@ -48,7 +48,7 @@ spec: http: paths: {{- if $.Values.websocket.enabled }} - - path: "/websocket" + - path: {{ $.Values.global.ingress.websocketPrefix }} pathType: Prefix backend: service: @@ -57,7 +57,7 @@ spec: number: {{ $.Values.websocket.service.port }} {{- end }} {{- if $.Values.backend.enabled }} - - path: "/v2" + - path: {{ $.Values.global.ingress.backendPrefix }} pathType: Prefix backend: service: @@ -77,7 +77,7 @@ spec: - http: paths: {{- if $.Values.websocket.enabled }} - - path: "/websocket" + - path: {{ $.Values.global.ingress.websocketPrefix }} pathType: Prefix backend: service: @@ -86,7 +86,7 @@ spec: number: {{ $.Values.websocket.service.port }} {{- end }} {{- if $.Values.backend.enabled }} - - path: "/v2" + - path: {{ $.Values.global.ingress.backendPrefix }} pathType: Prefix backend: service: From 174f4d7496e571c829fa889d509bb718647ebe97 Mon Sep 17 00:00:00 2001 From: shahargl Date: Fri, 15 Nov 2024 13:31:12 +0200 Subject: [PATCH 03/27] feat: haproxy --- charts/keep/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/keep/values.yaml b/charts/keep/values.yaml index 26e5e75..ad70f0c 100644 --- a/charts/keep/values.yaml +++ b/charts/keep/values.yaml @@ -11,6 +11,7 @@ global: # this section controls the ingress resource at nginx-ingress.yaml ingress: enabled: true + # Keep supports both nginx and haproxy ingress controllers className: "nginx" # this is for cases where you want nginx configuration but the nginx className is different. classType: "" From 1a0417f69e3734ab8d197b7446ab64d8a54e4a71 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 10:36:17 +0200 Subject: [PATCH 04/27] feat: add tests for proxies --- .github/workflows/test-haproxy-ingress.yml | 145 ++++++++++++++++++ .github/workflows/test-nginx-ingress.yml | 166 +++++++++++++++++++++ local_test_haproxy.sh | 139 +++++++++++++++++ local_test_nginx.sh | 131 ++++++++++++++++ 4 files changed, 581 insertions(+) create mode 100644 .github/workflows/test-haproxy-ingress.yml create mode 100644 .github/workflows/test-nginx-ingress.yml create mode 100644 local_test_haproxy.sh create mode 100644 local_test_nginx.sh diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml new file mode 100644 index 0000000..651f10d --- /dev/null +++ b/.github/workflows/test-haproxy-ingress.yml @@ -0,0 +1,145 @@ +name: Test HAProxy Ingress + +on: + pull_request: + branches: + - main + workflow_dispatch: + inputs: + debug_enabled: + description: 'Run workflow with debug logging' + required: false + default: false + type: boolean + +jobs: + test-haproxy-ingress: + 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.10.3 + + - uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Install test dependencies + run: | + npm install -g wscat + sudo apt-get update && sudo apt-get install -y curl + + - name: Create kind cluster + uses: helm/kind-action@v1.9.0 + with: + wait: 600s + config: | + kind: Cluster + apiVersion: kind.x-k8s.io/v1alpha4 + nodes: + - role: control-plane + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP + + - name: Install HAProxy Ingress Controller + run: | + helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts + helm repo update + helm install haproxy-ingress haproxy-ingress/haproxy-ingress \ + --set controller.service.type=NodePort \ + --set controller.watchIngressWithoutClass=true + + - name: Wait for HAProxy Ingress + run: | + kubectl wait --namespace default \ + --for=condition=ready pod \ + --selector=app.kubernetes.io/instance=haproxy-ingress \ + --timeout=90s + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.6.1 + + - name: Create test values for haproxy + run: | + cat < haproxy-values.yaml + global: + ingress: + enabled: true + className: haproxy + classType: haproxy + websocketPrefix: /websocket + backendPrefix: /v2/docs + frontendPrefix: / + frontend: + enabled: true + backend: + enabled: true + websocket: + enabled: true + EOF + + - name: Debug - Show test values + if: ${{ inputs.debug_enabled }} + run: cat haproxy-values.yaml + + - name: Run chart-testing install + run: | + ct install --debug --config ct.yaml --namespace default --values haproxy-values.yaml + + - name: Wait for the backend pod + run: | + kubectl wait --namespace default \ + --for=condition=ready pod \ + --selector=app.kubernetes.io/instance=keep,keep-component=backend \ + --timeout=90s + + - name: Debug - Show pods and services + if: ${{ inputs.debug_enabled }} + run: | + kubectl get pods -A + kubectl get svc -A + kubectl get ingress -A + kubectl describe ingress -A + + - name: Test HAProxy Ingress endpoints + run: | + INGRESS_IP="127.0.0.1" + APP_NAME=$(helm list -n default -o json | jq -r '.[0].name') + + echo "Testing frontend endpoint..." + RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://$INGRESS_IP/) + echo "Frontend response code: $RESP_CODE" + [ "$RESP_CODE" -eq 200 ] || exit 1 + + echo "Testing backend endpoint..." + RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://$INGRESS_IP/v2/docs/) + echo "Backend response code: $RESP_CODE" + [ "$RESP_CODE" -eq 200 ] || exit 1 + + echo "Testing websocket endpoint..." + RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -H "Upgrade: websocket" -H "Connection: Upgrade" http://$INGRESS_IP/websocket/) + echo "WebSocket response code: $RESP_CODE" + [ "$RESP_CODE" -eq 101 ] || [ "$RESP_CODE" -eq 400 ] || exit 1 + + - name: Debug - Show logs on failure + if: ${{ failure() && inputs.debug_enabled }} + run: | + echo "HAProxy Ingress Controller logs:" + kubectl logs -l app.kubernetes.io/instance=haproxy-ingress -n default --tail=100 + + echo "Application pods logs:" + for pod in $(kubectl get pods -n default -l app.kubernetes.io/instance=$APP_NAME -o name); do + echo "Logs for $pod:" + kubectl logs $pod -n default --tail=100 + done \ No newline at end of file diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml new file mode 100644 index 0000000..ae07844 --- /dev/null +++ b/.github/workflows/test-nginx-ingress.yml @@ -0,0 +1,166 @@ +name: Test Nginx Ingress + +on: + pull_request: + branches: + - main + workflow_dispatch: + inputs: + debug_enabled: + description: 'Run workflow with debug logging' + required: false + default: false + type: boolean + +jobs: + test-nginx-ingress: + 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.10.3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install test dependencies + run: | + npm install -g wscat + sudo apt-get update && sudo apt-get install -y curl + + - name: Create kind cluster + uses: helm/kind-action@v1.9.0 + with: + wait: 600s + config: | + kind: Cluster + apiVersion: kind.x-k8s.io/v1alpha4 + nodes: + - role: control-plane + kubeadmConfigPatches: + - | + kind: InitConfiguration + nodeRegistration: + kubeletExtraArgs: + node-labels: "ingress-ready=true" + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP + + - name: Install Nginx Ingress Controller + run: | + helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx + helm repo update + helm install nginx-ingress ingress-nginx/ingress-nginx \ + --set controller.service.type=NodePort \ + --set controller.watchIngressWithoutClass=true \ + --set controller.allowSnippetAnnotations=true \ + --set controller.config.allow-snippets=true \ + --set controller.config.enable-snippets=true \ + --set controller.hostPort.enabled=true \ + --set controller.service.ports.http=80 \ + --set controller.service.ports.https=443 \ + --set controller.nodeSelector."kubernetes\.io/os"=linux \ + --set controller.admissionWebhooks.enabled=false + + - name: Wait for Nginx Ingress + run: | + kubectl wait --namespace default \ + --for=condition=ready pod \ + --selector=app.kubernetes.io/instance=nginx-ingress \ + --timeout=90s + + - name: Create test values for nginx + run: | + mkdir -p debug + cat < debug/nginx-values.yaml + global: + ingress: + enabled: true + className: nginx + classType: nginx + websocketPrefix: /websocket + backendPrefix: /v2/docs + frontendPrefix: / + frontend: + enabled: true + backend: + enabled: true + websocket: + enabled: true + EOF + + - name: Debug - Show test values + if: ${{ inputs.debug_enabled }} + run: cat debug/nginx-values.yaml + + - name: Install Keep chart + run: | + helm install keep ./charts/keep -f debug/nginx-values.yaml + + - name: Wait for the backend pod + run: | + kubectl wait --namespace default \ + --for=condition=ready pod \ + --selector=app.kubernetes.io/instance=keep,keep-component=backend \ + --timeout=90s + + - name: Debug - Show resources + if: ${{ inputs.debug_enabled }} + run: | + echo "๐Ÿ” Checking all resources..." + kubectl get pods -A + kubectl get svc -A + kubectl get ingress -A + kubectl describe ingress -A + + - name: Test endpoints + run: | + echo "๐Ÿงช Testing endpoints..." + + echo "Frontend (/) - Should redirect to /incidents:" + RESP=$(curl -s -I http://localhost/) + echo "$RESP" | grep "HTTP" + LOCATION=$(echo "$RESP" | grep -i "location") + echo "$LOCATION" + if [[ "$LOCATION" != *"/incidents"* ]]; then + echo "โŒ Redirect to /incidents not found" + exit 1 + fi + + echo -e "\nBackend (/v2/docs) - Should return API info:" + RESP=$(curl -s http://localhost/v2/docs/) + echo "Response: $RESP" + if [[ $RESP != *"Rest API powering"* ]]; then + echo "โŒ Unexpected backend response" + exit 1 + fi + + echo -e "\nWebSocket (/websocket) - Testing connection:" + wscat -c "ws://localhost/websocket/app/keepappkey?protocol=7&client=js&version=8.3.0&flash=false" & + WSCAT_PID=$! + sleep 2 + kill $WSCAT_PID 2>/dev/null + + - name: Debug - Show logs on failure + if: ${{ failure() && inputs.debug_enabled }} + run: | + echo "๐Ÿ“œ Nginx Ingress Controller logs:" + kubectl logs -l app.kubernetes.io/instance=nginx-ingress --tail=100 + + echo "Application pods logs:" + for pod in $(kubectl get pods -n default -l app.kubernetes.io/instance=keep -o name); do + echo "Logs for $pod:" + kubectl logs $pod --tail=100 + done \ No newline at end of file diff --git a/local_test_haproxy.sh b/local_test_haproxy.sh new file mode 100644 index 0000000..7d3daf7 --- /dev/null +++ b/local_test_haproxy.sh @@ -0,0 +1,139 @@ +#!/bin/bash + +# Create a debug folder and values file +mkdir -p debug +cat < debug/haproxy-values.yaml +global: + ingress: + enabled: true + className: haproxy + annotations: + ingress.class: haproxy + websocketPrefix: /websocket + backendPrefix: /v2/docs + frontendPrefix: / +frontend: + enabled: true +backend: + enabled: true +websocket: + enabled: true +EOF + +# Create Kind cluster with ingress ports exposed +cat < debug/kind-config.yaml +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP + - containerPort: 30024 + hostPort: 30024 + protocol: TCP +EOF + +# Function to check service/pod status +check_status() { + echo "๐Ÿ” Checking all resources..." + kubectl get pods -A + kubectl get svc -A + kubectl get ingress -A +} + +# Create cluster +kind create cluster --config debug/kind-config.yaml + +# Add and update HAProxy helm repo +echo "๐Ÿ“ฆ Adding HAProxy helm repo..." +helm repo add haproxytech https://haproxy-ingress.github.io/charts +helm repo update + +# Install HAProxy Ingress Controller +echo "๐Ÿ”ง Installing HAProxy Ingress Controller..." +helm install haproxy haproxy-ingress/haproxy-ingress \ + --set controller.service.type=NodePort \ + --set controller.kind=DaemonSet \ + --set controller.daemonset.useHostPort=true \ + --set controller.service.ports.http=80 \ + --set controller.service.ports.https=443 \ + --set controller.service.ports.stat=30024 + +# Wait for HAProxy ingress controller +echo "โณ Waiting for HAProxy ingress controller..." +kubectl wait --namespace default \ + --for=condition=ready pod \ + --selector=app.kubernetes.io/instance=haproxy \ + --timeout=90s + +# Install your chart +echo "๐Ÿ“Š Installing Keep chart..." +helm install keep ./charts/keep -f debug/haproxy-values.yaml + +# Wait for backend pod (the last one to be ready) +echo "โณ Waiting for Keep backend to be ready..." +kubectl wait --namespace default \ + --for=condition=ready pod \ + --selector=app.kubernetes.io/instance=keep,keep-component=backend \ + --timeout=90s + +# Check status +check_status + +# Test endpoints +echo "๐Ÿงช Testing endpoints..." + +echo "Frontend (/) - Should redirect to /incidents:" +RESP=$(curl -s -I http://localhost/) +echo "$RESP" | grep "HTTP" +LOCATION=$(echo "$RESP" | grep -i "location") +echo "$LOCATION" +if [[ "$LOCATION" == *"/incidents"* ]]; then + echo "โœ… Redirect to /incidents confirmed" +else + echo "โŒ Redirect to /incidents not found" + exit 1 +fi + +echo -e "\nBackend (/v2/docs) - Should return API info:" +RESP=$(curl -s http://localhost/v2/docs/) +echo "Response: $RESP" +if [[ $RESP == *"Rest API powering"* ]]; then + echo "โœ… Backend response contains expected message" +else + echo "โŒ Unexpected backend response" +fi + +echo -e "\nWebSocket (/websocket) - Testing connection:" +wscat -c "ws://localhost/websocket/app/keepappkey?protocol=7&client=js&version=8.3.0&flash=false" & +WSCAT_PID=$! +sleep 2 +kill $WSCAT_PID 2>/dev/null + +# Show HAProxy stats +echo -e "\n๐Ÿ“Š HAProxy Stats:" +curl -s "http://localhost:30024/stats?stats;csv" + +# Show logs if needed +echo -e "\n๐Ÿ“œ HAProxy controller logs:" +kubectl logs -l app.kubernetes.io/instance=haproxy --tail=100 + +# Keep script running for debugging +echo -e "\n๐Ÿ”„ Debug session active. Press Ctrl+C to cleanup." +echo "๐Ÿ“ Quick commands:" +echo " - kubectl get pods -A" +echo " - kubectl describe ingress" +echo " - kubectl logs " +echo " - curl -v http://localhost/" +echo " - curl -v http://localhost/v2/docs/" +echo " - curl -v -H \"Upgrade: websocket\" -H \"Connection: Upgrade\" http://localhost/websocket/" +echo " - curl http://localhost:30024/stats" + +# Wait for user interrupt +trap "kind delete cluster" EXIT +read -r -d '' _ debug/nginx-values.yaml +global: + ingress: + enabled: true + className: nginx + classType: nginx + websocketPrefix: /websocket + backendPrefix: /v2/docs + frontendPrefix: / +frontend: + enabled: true +backend: + enabled: true +websocket: + enabled: true +EOF + +# Create Kind cluster with ingress ports exposed +cat < debug/kind-config.yaml +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP +EOF + +# Function to check service/pod status +check_status() { + echo "๐Ÿ” Checking all resources..." + kubectl get pods -A + kubectl get svc -A + kubectl get ingress -A +} + +# Create cluster +kind create cluster --config debug/kind-config.yaml + +# Install Nginx Ingress +helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx +helm repo update +helm install nginx-ingress ingress-nginx/ingress-nginx \ + --set controller.service.type=NodePort \ + --set controller.watchIngressWithoutClass=true \ + --set controller.allowSnippetAnnotations=true \ + --set controller.config.allow-snippets=true \ + --set controller.config.enable-snippets=true \ + --set controller.hostPort.enabled=true \ + --set controller.service.ports.http=80 \ + --set controller.service.ports.https=443 \ + --set controller.nodeSelector."kubernetes\.io/os"=linux \ + --set controller.admissionWebhooks.enabled=false + +# Wait for ingress controller +echo "โณ Waiting for Nginx ingress controller..." +kubectl wait --namespace default \ + --for=condition=ready pod \ + --selector=app.kubernetes.io/instance=nginx-ingress \ + --timeout=90s + +# Install your chart +helm install keep ./charts/keep -f debug/nginx-values.yaml + +# Wait for pods +echo "โณ Waiting for all pods to be ready..." +# Wait for backend pod (the last one to be ready) +echo "โณ Waiting for Keep backend to be ready..." +kubectl wait --namespace default \ + --for=condition=ready pod \ + --selector=app.kubernetes.io/instance=keep,keep-component=backend \ + --timeout=90s + +# Check status +check_status + +# Test endpoints +echo "๐Ÿงช Testing endpoints..." + +echo "Frontend (/) - Should redirect to /incidents:" +RESP=$(curl -s -I http://localhost/) +echo "$RESP" | grep "HTTP" +LOCATION=$(echo "$RESP" | grep -i "location") +echo "$LOCATION" +if [[ "$LOCATION" == *"/incidents"* ]]; then + echo "โœ… Redirect to /incidents confirmed" +else + echo "โŒ Redirect to /incidents not found" + exit 1 +fi + +echo -e "\nBackend (/v2/docs) - Should return API info:" +RESP=$(curl -s http://localhost/v2/docs/) +echo "Response: $RESP" +if [[ $RESP == *"Rest API powering"* ]]; then + echo "โœ… Backend response contains expected message" +else + echo "โŒ Unexpected backend response" +fi + +echo -e "\nWebSocket (/websocket) - Testing connection:" +wscat -c "ws://localhost/websocket/app/keepappkey?protocol=7&client=js&version=8.3.0&flash=false" & +WSCAT_PID=$! +sleep 2 +kill $WSCAT_PID 2>/dev/null + +# Show logs if needed +echo -e "\n๐Ÿ“œ Ingress controller logs:" +kubectl logs -l app.kubernetes.io/instance=nginx-ingress --tail=100 + +# Keep script running for debugging +echo -e "\n๐Ÿ”„ Debug session active. Press Ctrl+C to cleanup." +echo "๐Ÿ“ Quick commands:" +echo " - kubectl get pods -A" +echo " - kubectl describe ingress" +echo " - kubectl logs " +echo " - curl -v http://localhost/" +echo " - curl -v http://localhost/v2/docs/" +echo " - curl -v -H \"Upgrade: websocket\" -H \"Connection: Upgrade\" http://localhost/websocket/" + +# Wait for user interrupt +trap "kind delete cluster" EXIT +read -r -d '' _ Date: Sat, 16 Nov 2024 10:40:11 +0200 Subject: [PATCH 05/27] feat: add tests for proxies --- .github/workflows/test-haproxy-ingress.yml | 32 +++++++++++----------- .github/workflows/test-nginx-ingress.yml | 8 +----- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 651f10d..26fd788 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -35,22 +35,22 @@ jobs: npm install -g wscat sudo apt-get update && sudo apt-get install -y curl - - name: Create kind cluster - uses: helm/kind-action@v1.9.0 - with: - wait: 600s - config: | - kind: Cluster - apiVersion: kind.x-k8s.io/v1alpha4 - nodes: - - role: control-plane - extraPortMappings: - - containerPort: 80 - hostPort: 80 - protocol: TCP - - containerPort: 443 - hostPort: 443 - protocol: TCP + - name: Create kind cluster + uses: helm/kind-action@v1.9.0 + with: + wait: 600s + config: |- + kind: Cluster + apiVersion: kind.x-k8s.io/v1alpha4 + nodes: + - role: control-plane + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP - name: Install HAProxy Ingress Controller run: | diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index ae07844..0c90872 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -39,17 +39,11 @@ jobs: uses: helm/kind-action@v1.9.0 with: wait: 600s - config: | + config: |- kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - kubeadmConfigPatches: - - | - kind: InitConfiguration - nodeRegistration: - kubeletExtraArgs: - node-labels: "ingress-ready=true" extraPortMappings: - containerPort: 80 hostPort: 80 From 5e0d8a30f7c2210239543812b16b3c53b8708e22 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 10:41:50 +0200 Subject: [PATCH 06/27] feat: add tests for proxies --- .github/workflows/test-haproxy-ingress.yml | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 26fd788..08e2d4c 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -35,22 +35,22 @@ jobs: npm install -g wscat sudo apt-get update && sudo apt-get install -y curl - - name: Create kind cluster - uses: helm/kind-action@v1.9.0 - with: - wait: 600s - config: |- - kind: Cluster - apiVersion: kind.x-k8s.io/v1alpha4 - nodes: - - role: control-plane - extraPortMappings: - - containerPort: 80 - hostPort: 80 - protocol: TCP - - containerPort: 443 - hostPort: 443 - protocol: TCP + - name: Create kind cluster + uses: helm/kind-action@v1.9.0 + with: + wait: 600s + config: |- + kind: Cluster + apiVersion: kind.x-k8s.io/v1alpha4 + nodes: + - role: control-plane + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP - name: Install HAProxy Ingress Controller run: | From c039bbcf26e5f2b01ffdb6925808789afc6691d8 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 10:44:02 +0200 Subject: [PATCH 07/27] feat: add tests for proxies --- .github/workflows/test-haproxy-ingress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 08e2d4c..651f10d 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -39,7 +39,7 @@ jobs: uses: helm/kind-action@v1.9.0 with: wait: 600s - config: |- + config: | kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: From ed850e3cd0bfbe61c267965d6c8b4b86624dfdfc Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 10:44:25 +0200 Subject: [PATCH 08/27] feat: wip --- .github/workflows/test-nginx-ingress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index 0c90872..efeed01 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -39,7 +39,7 @@ jobs: uses: helm/kind-action@v1.9.0 with: wait: 600s - config: |- + config: | kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: From 46e4f38c1af7f4fc8c4726125892a333b58baec0 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 10:47:30 +0200 Subject: [PATCH 09/27] feat: wip --- .github/workflows/test-nginx-ingress.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index efeed01..d882dee 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -35,11 +35,9 @@ jobs: npm install -g wscat sudo apt-get update && sudo apt-get install -y curl - - name: Create kind cluster - uses: helm/kind-action@v1.9.0 - with: - wait: 600s - config: | + - name: Create kind config + run: | + cat > kind-config.yaml << EOF kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: @@ -51,6 +49,13 @@ jobs: - containerPort: 443 hostPort: 443 protocol: TCP + EOF + + - name: Create kind cluster + uses: helm/kind-action@v1.9.0 + with: + wait: 600s + config: kind-config.yaml - name: Install Nginx Ingress Controller run: | From 84bddfcf9caed055a2c81a934dad96be878024ff Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 10:50:00 +0200 Subject: [PATCH 10/27] feat: wip --- .github/workflows/test-nginx-ingress.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index d882dee..163e0c8 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -37,20 +37,24 @@ jobs: - name: Create kind config run: | - cat > kind-config.yaml << EOF + cat <<-EOF > kind-config.yaml kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - - role: control-plane - extraPortMappings: - - containerPort: 80 - hostPort: 80 - protocol: TCP - - containerPort: 443 - hostPort: 443 - protocol: TCP - EOF + - role: control-plane + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP + EOF + - name: Debug kind config + if: ${{ inputs.debug_enabled }} + run: cat kind-config.yaml + - name: Create kind cluster uses: helm/kind-action@v1.9.0 with: From c592f2e646040744bf3ef2e1b1cdffde770f4906 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 10:55:23 +0200 Subject: [PATCH 11/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 129 ++++++++++++++------- .github/workflows/test-nginx-ingress.yml | 31 +++-- 2 files changed, 108 insertions(+), 52 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 651f10d..698c00a 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -35,22 +35,27 @@ jobs: npm install -g wscat sudo apt-get update && sudo apt-get install -y curl + - name: Create kind config + run: | + cat <<-EOF > kind-config.yaml + kind: Cluster + apiVersion: kind.x-k8s.io/v1alpha4 + nodes: + - role: control-plane + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP + EOF + - name: Create kind cluster uses: helm/kind-action@v1.9.0 with: wait: 600s - config: | - kind: Cluster - apiVersion: kind.x-k8s.io/v1alpha4 - nodes: - - role: control-plane - extraPortMappings: - - containerPort: 80 - hostPort: 80 - protocol: TCP - - containerPort: 443 - hostPort: 443 - protocol: TCP + config: kind-config.yaml - name: Install HAProxy Ingress Controller run: | @@ -62,10 +67,11 @@ jobs: - name: Wait for HAProxy Ingress run: | + echo "Waiting for HAProxy Ingress pods..." kubectl wait --namespace default \ --for=condition=ready pod \ --selector=app.kubernetes.io/instance=haproxy-ingress \ - --timeout=90s + --timeout=120s - name: Set up chart-testing uses: helm/chart-testing-action@v2.6.1 @@ -89,57 +95,98 @@ jobs: enabled: true EOF - - name: Debug - Show test values - if: ${{ inputs.debug_enabled }} - run: cat haproxy-values.yaml - - name: Run chart-testing install run: | ct install --debug --config ct.yaml --namespace default --values haproxy-values.yaml - - name: Wait for the backend pod + - name: Wait for all pods run: | - kubectl wait --namespace default \ - --for=condition=ready pod \ - --selector=app.kubernetes.io/instance=keep,keep-component=backend \ - --timeout=90s + echo "Waiting for all pods to be ready..." + kubectl wait --for=condition=ready pod --all -n default --timeout=180s + + echo "Checking pod status..." + kubectl get pods -n default + + echo "Checking ingress status..." + kubectl get ingress -n default + + echo "Waiting additional 30s for services to stabilize..." + sleep 30 - - name: Debug - Show pods and services - if: ${{ inputs.debug_enabled }} + - name: Verify services and endpoints run: | - kubectl get pods -A - kubectl get svc -A - kubectl get ingress -A - kubectl describe ingress -A + echo "Service Status:" + kubectl get svc -n default + + echo "Endpoint Status:" + kubectl get endpoints -n default + + echo "Ingress Details:" + kubectl describe ingress -n default - name: Test HAProxy Ingress endpoints run: | INGRESS_IP="127.0.0.1" APP_NAME=$(helm list -n default -o json | jq -r '.[0].name') + MAX_RETRIES=5 + RETRY_DELAY=10 + + test_endpoint() { + local url=$1 + local expected_code=$2 + local headers=${3:-""} + + for ((i=1; i<=MAX_RETRIES; i++)); do + echo "Attempt $i of $MAX_RETRIES for $url" + if [ -n "$headers" ]; then + RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" $headers "$url") + else + RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$url") + fi + echo "Response code: $RESP_CODE" + + if [ "$RESP_CODE" -eq "$expected_code" ]; then + return 0 + fi + + if [ "$i" -lt "$MAX_RETRIES" ]; then + echo "Waiting ${RETRY_DELAY}s before next attempt..." + sleep "$RETRY_DELAY" + fi + done + return 1 + } echo "Testing frontend endpoint..." - RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://$INGRESS_IP/) - echo "Frontend response code: $RESP_CODE" - [ "$RESP_CODE" -eq 200 ] || exit 1 + test_endpoint "http://$INGRESS_IP/" 200 || exit 1 echo "Testing backend endpoint..." - RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://$INGRESS_IP/v2/docs/) - echo "Backend response code: $RESP_CODE" - [ "$RESP_CODE" -eq 200 ] || exit 1 + test_endpoint "http://$INGRESS_IP/v2/docs/" 200 || exit 1 echo "Testing websocket endpoint..." - RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -H "Upgrade: websocket" -H "Connection: Upgrade" http://$INGRESS_IP/websocket/) - echo "WebSocket response code: $RESP_CODE" - [ "$RESP_CODE" -eq 101 ] || [ "$RESP_CODE" -eq 400 ] || exit 1 + test_endpoint "http://$INGRESS_IP/websocket/" 101 "-H 'Upgrade: websocket' -H 'Connection: Upgrade'" || \ + test_endpoint "http://$INGRESS_IP/websocket/" 400 "-H 'Upgrade: websocket' -H 'Connection: Upgrade'" || exit 1 - name: Debug - Show logs on failure - if: ${{ failure() && inputs.debug_enabled }} + if: ${{ failure() }} run: | echo "HAProxy Ingress Controller logs:" kubectl logs -l app.kubernetes.io/instance=haproxy-ingress -n default --tail=100 + echo "All pods status:" + kubectl get pods -n default -o wide + echo "Application pods logs:" - for pod in $(kubectl get pods -n default -l app.kubernetes.io/instance=$APP_NAME -o name); do + for pod in $(kubectl get pods -n default -o name); do echo "Logs for $pod:" - kubectl logs $pod -n default --tail=100 - done \ No newline at end of file + kubectl logs $pod -n default --tail=100 || true + done + + echo "Ingress configuration:" + kubectl get ingress -n default -o yaml + + echo "Endpoints:" + kubectl get endpoints -n default + + echo "Services:" + kubectl get svc -n default \ No newline at end of file diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index 163e0c8..c3140fa 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -35,9 +35,9 @@ jobs: npm install -g wscat sudo apt-get update && sudo apt-get install -y curl - - name: Create kind config - run: | - cat <<-EOF > kind-config.yaml + - name: Create kind config + run: | + cat <<-EOF > kind-config.yaml kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: @@ -49,12 +49,12 @@ jobs: - containerPort: 443 hostPort: 443 protocol: TCP - EOF + EOF - name: Debug kind config if: ${{ inputs.debug_enabled }} run: cat kind-config.yaml - + - name: Create kind cluster uses: helm/kind-action@v1.9.0 with: @@ -143,12 +143,21 @@ jobs: fi echo -e "\nBackend (/v2/docs) - Should return API info:" - RESP=$(curl -s http://localhost/v2/docs/) - echo "Response: $RESP" - if [[ $RESP != *"Rest API powering"* ]]; then - echo "โŒ Unexpected backend response" - exit 1 - fi + for i in {1..5}; do + echo "Attempt $i of 5..." + RESP=$(curl -s http://localhost/v2/docs/) + echo "Response: $RESP" + if [[ $RESP == *"Rest API powering"* ]]; then + echo "โœ… Backend response successful" + break + fi + if [[ $i -eq 5 ]]; then + echo "โŒ Unexpected backend response after 5 attempts" + exit 1 + fi + echo "Waiting 2 seconds before next attempt..." + sleep 2 + done echo -e "\nWebSocket (/websocket) - Testing connection:" wscat -c "ws://localhost/websocket/app/keepappkey?protocol=7&client=js&version=8.3.0&flash=false" & From 3dd9328d98c3cd7038455191477eae31f28d2b8e Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 10:58:54 +0200 Subject: [PATCH 12/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 8 ++++++-- .github/workflows/test-nginx-ingress.yml | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 698c00a..811b9af 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -95,9 +95,13 @@ jobs: enabled: true EOF - - name: Run chart-testing install + - name: Debug - Show test values + if: ${{ inputs.debug_enabled }} + run: cat debug/haproxy-values.yaml + + - name: Install Keep chart run: | - ct install --debug --config ct.yaml --namespace default --values haproxy-values.yaml + helm install keep ./charts/keep -f debug/haproxy-values.yaml - name: Wait for all pods run: | diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index c3140fa..584730c 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -35,9 +35,9 @@ jobs: npm install -g wscat sudo apt-get update && sudo apt-get install -y curl - - name: Create kind config - run: | - cat <<-EOF > kind-config.yaml + - name: Create kind config + run: | + cat <<-EOF > kind-config.yaml kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: From a52214be6dabd7b7fc47e855637a659845bf2c0a Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 15:51:20 +0200 Subject: [PATCH 13/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 811b9af..e4a0434 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -78,7 +78,8 @@ jobs: - name: Create test values for haproxy run: | - cat < haproxy-values.yaml + mkdir -p debug + cat < debug/haproxy-values.yaml global: ingress: enabled: true From 2998a672c87d87f835ff3e98b54734e68f06b7c5 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 15:52:30 +0200 Subject: [PATCH 14/27] feat: wip --- .github/workflows/test-nginx-ingress.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index 584730c..6828ab4 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -38,17 +38,17 @@ jobs: - name: Create kind config run: | cat <<-EOF > kind-config.yaml - kind: Cluster - apiVersion: kind.x-k8s.io/v1alpha4 - nodes: - - role: control-plane - extraPortMappings: - - containerPort: 80 - hostPort: 80 - protocol: TCP - - containerPort: 443 - hostPort: 443 - protocol: TCP + kind: Cluster + apiVersion: kind.x-k8s.io/v1alpha4 + nodes: + - role: control-plane + extraPortMappings: + - containerPort: 80 + hostPort: 80 + protocol: TCP + - containerPort: 443 + hostPort: 443 + protocol: TCP EOF - name: Debug kind config From 2865edf424d1bb37d417b97124b7c49bb23f0641 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 15:58:30 +0200 Subject: [PATCH 15/27] feat: tests --- .github/workflows/test-nginx-ingress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index 6828ab4..9a28fde 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -49,7 +49,7 @@ jobs: - containerPort: 443 hostPort: 443 protocol: TCP - EOF + EOF - name: Debug kind config if: ${{ inputs.debug_enabled }} From f173f5e51c339d608bfe3e0cb95f68bd82e9a7d8 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 16:07:39 +0200 Subject: [PATCH 16/27] feat: test --- .github/workflows/test-haproxy-ingress.yml | 2 +- .github/workflows/test-nginx-ingress.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index e4a0434..70eea06 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -86,7 +86,7 @@ jobs: className: haproxy classType: haproxy websocketPrefix: /websocket - backendPrefix: /v2/docs + backendPrefix: /v2 frontendPrefix: / frontend: enabled: true diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index 9a28fde..1023127 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -94,7 +94,7 @@ jobs: className: nginx classType: nginx websocketPrefix: /websocket - backendPrefix: /v2/docs + backendPrefix: /v2 frontendPrefix: / frontend: enabled: true From e231b7b9a45fbdd3dfdf1835db23a25f6743b61b Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 16:12:45 +0200 Subject: [PATCH 17/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 28 +++++++++++++++++----- .github/workflows/test-nginx-ingress.yml | 17 +++++++++---- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 70eea06..fe5bb59 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -143,32 +143,48 @@ jobs: for ((i=1; i<=MAX_RETRIES; i++)); do echo "Attempt $i of $MAX_RETRIES for $url" + echo "Headers being sent: $headers" + if [ -n "$headers" ]; then - RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" $headers "$url") + echo "Full curl command: curl -v $headers \"$url\"" + RESP=$(curl -v $headers "$url" 2>&1) + RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') else - RESP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$url") + echo "Full curl command: curl -v \"$url\"" + RESP=$(curl -v "$url" 2>&1) + RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') fi + + echo -e "\n๐Ÿ” Response Details:" + echo "------------------------" echo "Response code: $RESP_CODE" + echo -e "\n๐Ÿ“‹ Response Headers:" + echo "$RESP" | grep -E "^< " || echo "No headers found" + echo -e "\n๐Ÿ“ Response Body:" + echo "$RESP" | sed -n '/^* Connected/,/^* Connection/!p' | grep -v "^[*<>]" || echo "No body found" + echo "------------------------" if [ "$RESP_CODE" -eq "$expected_code" ]; then + echo "โœ… Expected response code $expected_code received" return 0 fi if [ "$i" -lt "$MAX_RETRIES" ]; then - echo "Waiting ${RETRY_DELAY}s before next attempt..." + echo "โณ Waiting ${RETRY_DELAY}s before next attempt..." sleep "$RETRY_DELAY" fi done + echo "โŒ Failed to get expected response code $expected_code after $MAX_RETRIES attempts" return 1 } - echo "Testing frontend endpoint..." + echo "๐ŸŒ Testing frontend endpoint..." test_endpoint "http://$INGRESS_IP/" 200 || exit 1 - echo "Testing backend endpoint..." + echo "๐Ÿ”Œ Testing backend endpoint..." test_endpoint "http://$INGRESS_IP/v2/docs/" 200 || exit 1 - echo "Testing websocket endpoint..." + echo "๐Ÿ”„ Testing websocket endpoint..." test_endpoint "http://$INGRESS_IP/websocket/" 101 "-H 'Upgrade: websocket' -H 'Connection: Upgrade'" || \ test_endpoint "http://$INGRESS_IP/websocket/" 400 "-H 'Upgrade: websocket' -H 'Connection: Upgrade'" || exit 1 diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index 1023127..f78f45c 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -112,12 +112,19 @@ jobs: run: | helm install keep ./charts/keep -f debug/nginx-values.yaml - - name: Wait for the backend pod + - name: Wait for all pods run: | - kubectl wait --namespace default \ - --for=condition=ready pod \ - --selector=app.kubernetes.io/instance=keep,keep-component=backend \ - --timeout=90s + echo "Waiting for all pods to be ready..." + kubectl wait --for=condition=ready pod --all -n default --timeout=180s + + echo "Checking pod status..." + kubectl get pods -n default + + echo "Checking ingress status..." + kubectl get ingress -n default + + echo "Waiting additional 30s for services to stabilize..." + sleep 30 - name: Debug - Show resources if: ${{ inputs.debug_enabled }} From 44ede4807c33e59d5e2c67850b384a5c05da311c Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 16:19:27 +0200 Subject: [PATCH 18/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 26 ++++++++++++++-- .github/workflows/test-nginx-ingress.yml | 36 ++++++++++++++++------ 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index fe5bb59..1c465a9 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -133,7 +133,7 @@ jobs: run: | INGRESS_IP="127.0.0.1" APP_NAME=$(helm list -n default -o json | jq -r '.[0].name') - MAX_RETRIES=5 + MAX_RETRIES=20 RETRY_DELAY=10 test_endpoint() { @@ -148,11 +148,31 @@ jobs: if [ -n "$headers" ]; then echo "Full curl command: curl -v $headers \"$url\"" RESP=$(curl -v $headers "$url" 2>&1) - RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') else echo "Full curl command: curl -v \"$url\"" RESP=$(curl -v "$url" 2>&1) - RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') + fi + + # Extract response code, handling connection failures + RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') + if [ -z "$RESP_CODE" ]; then + echo "โš ๏ธ No response code received - connection may have failed" + echo -e "\n๐Ÿ” Response Details:" + echo "------------------------" + echo "Response code: Connection failed" + echo -e "\n๐Ÿ“‹ Response Headers:" + echo "$RESP" | grep -E "^< " || echo "No headers found" + echo -e "\n๐Ÿ“ Response Body:" + echo "$RESP" | sed -n '/^* Connected/,/^* Connection/!p' | grep -v "^[*<>]" || echo "No body found" + echo "------------------------" + + if [ "$i" -lt "$MAX_RETRIES" ]; then + echo "โณ Waiting ${RETRY_DELAY}s before next attempt..." + sleep "$RETRY_DELAY" + continue + fi + echo "โŒ Failed to establish connection after $MAX_RETRIES attempts" + return 1 fi echo -e "\n๐Ÿ” Response Details:" diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index f78f45c..c2d85b3 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -140,20 +140,36 @@ jobs: echo "๐Ÿงช Testing endpoints..." echo "Frontend (/) - Should redirect to /incidents:" - RESP=$(curl -s -I http://localhost/) - echo "$RESP" | grep "HTTP" + RESP=$(curl -v http://localhost/ 2>&1) + echo -e "\n๐Ÿ“‹ Response Headers:" + echo "$RESP" | grep -E "^< " || echo "No headers found" + echo -e "\n๐Ÿ“ Response Body:" + echo "$RESP" | sed -n '/^* Connected/,/^* Connection/!p' | grep -v "^[*<>]" || echo "No body found" + + RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') LOCATION=$(echo "$RESP" | grep -i "location") - echo "$LOCATION" + echo -e "\nResponse code: $RESP_CODE" + echo "Location header: $LOCATION" + if [[ "$LOCATION" != *"/incidents"* ]]; then echo "โŒ Redirect to /incidents not found" exit 1 fi + echo "โœ… Frontend redirect successful" echo -e "\nBackend (/v2/docs) - Should return API info:" - for i in {1..5}; do - echo "Attempt $i of 5..." - RESP=$(curl -s http://localhost/v2/docs/) - echo "Response: $RESP" + for i in {1..20}; do + echo -e "\nAttempt $i of 20..." + RESP=$(curl -v http://localhost/v2/docs/ 2>&1) + + echo -e "\n๐Ÿ“‹ Response Headers:" + echo "$RESP" | grep -E "^< " || echo "No headers found" + echo -e "\n๐Ÿ“ Response Body:" + echo "$RESP" | sed -n '/^* Connected/,/^* Connection/!p' | grep -v "^[*<>]" || echo "No body found" + + RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') + echo -e "\nResponse code: $RESP_CODE" + if [[ $RESP == *"Rest API powering"* ]]; then echo "โœ… Backend response successful" break @@ -162,14 +178,16 @@ jobs: echo "โŒ Unexpected backend response after 5 attempts" exit 1 fi - echo "Waiting 2 seconds before next attempt..." + echo "โณ Waiting 2 seconds before next attempt..." sleep 2 done echo -e "\nWebSocket (/websocket) - Testing connection:" - wscat -c "ws://localhost/websocket/app/keepappkey?protocol=7&client=js&version=8.3.0&flash=false" & + echo "๐Ÿ”„ Attempting WebSocket connection..." + wscat -c "ws://localhost/websocket/app/keepappkey?protocol=7&client=js&version=8.3.0&flash=false" --showHeaders & WSCAT_PID=$! sleep 2 + echo "๐Ÿ“Š WebSocket connection attempt completed" kill $WSCAT_PID 2>/dev/null - name: Debug - Show logs on failure From c5bb7b22d5c09371ef16652cafa76767e7cf1ecc Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 16:26:03 +0200 Subject: [PATCH 19/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 4 ++-- .github/workflows/test-nginx-ingress.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 1c465a9..9a108f4 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -9,7 +9,7 @@ on: debug_enabled: description: 'Run workflow with debug logging' required: false - default: false + default: true type: boolean jobs: @@ -133,7 +133,7 @@ jobs: run: | INGRESS_IP="127.0.0.1" APP_NAME=$(helm list -n default -o json | jq -r '.[0].name') - MAX_RETRIES=20 + MAX_RETRIES=5 RETRY_DELAY=10 test_endpoint() { diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index c2d85b3..5644a01 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -9,7 +9,7 @@ on: debug_enabled: description: 'Run workflow with debug logging' required: false - default: false + default: true type: boolean jobs: @@ -158,8 +158,8 @@ jobs: echo "โœ… Frontend redirect successful" echo -e "\nBackend (/v2/docs) - Should return API info:" - for i in {1..20}; do - echo -e "\nAttempt $i of 20..." + for i in {1..5}; do + echo -e "\nAttempt $i of 5..." RESP=$(curl -v http://localhost/v2/docs/ 2>&1) echo -e "\n๐Ÿ“‹ Response Headers:" From f3a6719bb5871dff89fb6c5dc14e007acb2e2f3e Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 16:56:19 +0200 Subject: [PATCH 20/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 9a108f4..697e28f 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -61,9 +61,13 @@ jobs: run: | helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts helm repo update - helm install haproxy-ingress haproxy-ingress/haproxy-ingress \ + helm install haproxy haproxy-ingress/haproxy-ingress \ --set controller.service.type=NodePort \ - --set controller.watchIngressWithoutClass=true + --set controller.kind=DaemonSet \ + --set controller.daemonset.useHostPort=true \ + --set controller.service.ports.http=80 \ + --set controller.service.ports.https=443 \ + --set controller.service.ports.stat=30024 - name: Wait for HAProxy Ingress run: | From d1aed375d28512f833ada4e6f41557ab781ba4c2 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 18:02:47 +0200 Subject: [PATCH 21/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 697e28f..5db195b 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -74,7 +74,7 @@ jobs: echo "Waiting for HAProxy Ingress pods..." kubectl wait --namespace default \ --for=condition=ready pod \ - --selector=app.kubernetes.io/instance=haproxy-ingress \ + --selector=app.kubernetes.io/name=haproxy-ingress \ --timeout=120s - name: Set up chart-testing From 06a01648d9098c078663bdc0a3222d3214891e5c Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 18:08:38 +0200 Subject: [PATCH 22/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 5db195b..b764333 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -203,7 +203,7 @@ jobs: } echo "๐ŸŒ Testing frontend endpoint..." - test_endpoint "http://$INGRESS_IP/" 200 || exit 1 + test_endpoint "http://$INGRESS_IP/" 307 || exit 1 echo "๐Ÿ”Œ Testing backend endpoint..." test_endpoint "http://$INGRESS_IP/v2/docs/" 200 || exit 1 From 11f9ea488f9b28df07b63d88de0d7848df9d9c08 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 18:13:32 +0200 Subject: [PATCH 23/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 2 +- .github/workflows/test-nginx-ingress.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index b764333..14fa1ec 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -206,7 +206,7 @@ jobs: test_endpoint "http://$INGRESS_IP/" 307 || exit 1 echo "๐Ÿ”Œ Testing backend endpoint..." - test_endpoint "http://$INGRESS_IP/v2/docs/" 200 || exit 1 + test_endpoint "http://$INGRESS_IP/v2/docs" 200 || exit 1 echo "๐Ÿ”„ Testing websocket endpoint..." test_endpoint "http://$INGRESS_IP/websocket/" 101 "-H 'Upgrade: websocket' -H 'Connection: Upgrade'" || \ diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index 5644a01..7eee331 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -160,7 +160,7 @@ jobs: echo -e "\nBackend (/v2/docs) - Should return API info:" for i in {1..5}; do echo -e "\nAttempt $i of 5..." - RESP=$(curl -v http://localhost/v2/docs/ 2>&1) + RESP=$(curl -v http://localhost/v2/docs 2>&1) echo -e "\n๐Ÿ“‹ Response Headers:" echo "$RESP" | grep -E "^< " || echo "No headers found" From 7e9644c32c907596e148552e6de926bae139e98c Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 18:20:18 +0200 Subject: [PATCH 24/27] feat: wip --- .github/workflows/test-haproxy-ingress.yml | 4 ++-- .github/workflows/test-nginx-ingress.yml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-haproxy-ingress.yml b/.github/workflows/test-haproxy-ingress.yml index 14fa1ec..c0675e3 100644 --- a/.github/workflows/test-haproxy-ingress.yml +++ b/.github/workflows/test-haproxy-ingress.yml @@ -209,8 +209,8 @@ jobs: test_endpoint "http://$INGRESS_IP/v2/docs" 200 || exit 1 echo "๐Ÿ”„ Testing websocket endpoint..." - test_endpoint "http://$INGRESS_IP/websocket/" 101 "-H 'Upgrade: websocket' -H 'Connection: Upgrade'" || \ - test_endpoint "http://$INGRESS_IP/websocket/" 400 "-H 'Upgrade: websocket' -H 'Connection: Upgrade'" || exit 1 + # should return "OK" + test_endpoint "http://$INGRESS_IP/websocket/" 200 || exit 1 - name: Debug - Show logs on failure if: ${{ failure() }} diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index 7eee331..461598b 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -79,9 +79,10 @@ jobs: - name: Wait for Nginx Ingress run: | + echo "Waiting for Nginx Ingress pods..." kubectl wait --namespace default \ --for=condition=ready pod \ - --selector=app.kubernetes.io/instance=nginx-ingress \ + --selector=app.kubernetes.io/name=nginx-ingress \ --timeout=90s - name: Create test values for nginx From d3397da6e0294155a4b1d51bca81104adb05f458 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 18:27:27 +0200 Subject: [PATCH 25/27] feat: wip --- .github/workflows/test-nginx-ingress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index 461598b..a9b9915 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -82,7 +82,7 @@ jobs: echo "Waiting for Nginx Ingress pods..." kubectl wait --namespace default \ --for=condition=ready pod \ - --selector=app.kubernetes.io/name=nginx-ingress \ + --selector=app.kubernetes.io/instance=nginx-ingress \ --timeout=90s - name: Create test values for nginx From 80ed6c24db2381ad221f76914604504b89c32a9a Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 18:32:04 +0200 Subject: [PATCH 26/27] feat: wip --- .github/workflows/test-nginx-ingress.yml | 122 ++++++++++++++--------- 1 file changed, 73 insertions(+), 49 deletions(-) diff --git a/.github/workflows/test-nginx-ingress.yml b/.github/workflows/test-nginx-ingress.yml index a9b9915..fd8c62d 100644 --- a/.github/workflows/test-nginx-ingress.yml +++ b/.github/workflows/test-nginx-ingress.yml @@ -138,59 +138,83 @@ jobs: - name: Test endpoints run: | - echo "๐Ÿงช Testing endpoints..." + INGRESS_IP="127.0.0.1" + APP_NAME=$(helm list -n default -o json | jq -r '.[0].name') + MAX_RETRIES=5 + RETRY_DELAY=10 - echo "Frontend (/) - Should redirect to /incidents:" - RESP=$(curl -v http://localhost/ 2>&1) - echo -e "\n๐Ÿ“‹ Response Headers:" - echo "$RESP" | grep -E "^< " || echo "No headers found" - echo -e "\n๐Ÿ“ Response Body:" - echo "$RESP" | sed -n '/^* Connected/,/^* Connection/!p' | grep -v "^[*<>]" || echo "No body found" - - RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') - LOCATION=$(echo "$RESP" | grep -i "location") - echo -e "\nResponse code: $RESP_CODE" - echo "Location header: $LOCATION" + test_endpoint() { + local url=$1 + local expected_code=$2 + local headers=${3:-""} + + for ((i=1; i<=MAX_RETRIES; i++)); do + echo "Attempt $i of $MAX_RETRIES for $url" + echo "Headers being sent: $headers" + + if [ -n "$headers" ]; then + echo "Full curl command: curl -v $headers \"$url\"" + RESP=$(curl -v $headers "$url" 2>&1) + else + echo "Full curl command: curl -v \"$url\"" + RESP=$(curl -v "$url" 2>&1) + fi + + # Extract response code, handling connection failures + RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') + if [ -z "$RESP_CODE" ]; then + echo "โš ๏ธ No response code received - connection may have failed" + echo -e "\n๐Ÿ” Response Details:" + echo "------------------------" + echo "Response code: Connection failed" + echo -e "\n๐Ÿ“‹ Response Headers:" + echo "$RESP" | grep -E "^< " || echo "No headers found" + echo -e "\n๐Ÿ“ Response Body:" + echo "$RESP" | sed -n '/^* Connected/,/^* Connection/!p' | grep -v "^[*<>]" || echo "No body found" + echo "------------------------" + + if [ "$i" -lt "$MAX_RETRIES" ]; then + echo "โณ Waiting ${RETRY_DELAY}s before next attempt..." + sleep "$RETRY_DELAY" + continue + fi + echo "โŒ Failed to establish connection after $MAX_RETRIES attempts" + return 1 + fi + + echo -e "\n๐Ÿ” Response Details:" + echo "------------------------" + echo "Response code: $RESP_CODE" + echo -e "\n๐Ÿ“‹ Response Headers:" + echo "$RESP" | grep -E "^< " || echo "No headers found" + echo -e "\n๐Ÿ“ Response Body:" + echo "$RESP" | sed -n '/^* Connected/,/^* Connection/!p' | grep -v "^[*<>]" || echo "No body found" + echo "------------------------" + + if [ "$RESP_CODE" -eq "$expected_code" ]; then + echo "โœ… Expected response code $expected_code received" + return 0 + fi + + if [ "$i" -lt "$MAX_RETRIES" ]; then + echo "โณ Waiting ${RETRY_DELAY}s before next attempt..." + sleep "$RETRY_DELAY" + fi + done + echo "โŒ Failed to get expected response code $expected_code after $MAX_RETRIES attempts" + return 1 + } - if [[ "$LOCATION" != *"/incidents"* ]]; then - echo "โŒ Redirect to /incidents not found" - exit 1 - fi - echo "โœ… Frontend redirect successful" + echo "๐ŸŒ Testing frontend endpoint..." + test_endpoint "http://$INGRESS_IP/" 307 || exit 1 - echo -e "\nBackend (/v2/docs) - Should return API info:" - for i in {1..5}; do - echo -e "\nAttempt $i of 5..." - RESP=$(curl -v http://localhost/v2/docs 2>&1) - - echo -e "\n๐Ÿ“‹ Response Headers:" - echo "$RESP" | grep -E "^< " || echo "No headers found" - echo -e "\n๐Ÿ“ Response Body:" - echo "$RESP" | sed -n '/^* Connected/,/^* Connection/!p' | grep -v "^[*<>]" || echo "No body found" - - RESP_CODE=$(echo "$RESP" | grep "< HTTP" | awk '{print $3}') - echo -e "\nResponse code: $RESP_CODE" - - if [[ $RESP == *"Rest API powering"* ]]; then - echo "โœ… Backend response successful" - break - fi - if [[ $i -eq 5 ]]; then - echo "โŒ Unexpected backend response after 5 attempts" - exit 1 - fi - echo "โณ Waiting 2 seconds before next attempt..." - sleep 2 - done + echo "๐Ÿ”Œ Testing backend endpoint..." + test_endpoint "http://$INGRESS_IP/v2/docs" 200 || exit 1 - echo -e "\nWebSocket (/websocket) - Testing connection:" - echo "๐Ÿ”„ Attempting WebSocket connection..." - wscat -c "ws://localhost/websocket/app/keepappkey?protocol=7&client=js&version=8.3.0&flash=false" --showHeaders & - WSCAT_PID=$! - sleep 2 - echo "๐Ÿ“Š WebSocket connection attempt completed" - kill $WSCAT_PID 2>/dev/null - + echo "๐Ÿ”„ Testing websocket endpoint..." + # should return "OK" + test_endpoint "http://$INGRESS_IP/websocket/" 200 || exit 1 + - name: Debug - Show logs on failure if: ${{ failure() && inputs.debug_enabled }} run: | From 4ef0fe8c959c8550d5ae919e783aac9d01cf062f Mon Sep 17 00:00:00 2001 From: shahargl Date: Sat, 16 Nov 2024 18:46:22 +0200 Subject: [PATCH 27/27] feat: wip --- charts/keep/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/keep/Chart.yaml b/charts/keep/Chart.yaml index bafcb46..3252d0e 100644 --- a/charts/keep/Chart.yaml +++ b/charts/keep/Chart.yaml @@ -4,7 +4,7 @@ version: 0.1.40 description: Keep Helm Chart type: application icon: https://platform.keephq.dev/_next/image?url=%2Fkeep.png&w=48&q=75 -appVersion: 0.28.10 +appVersion: 0.29.0 deprecated: false annotations: app: keep