diff --git a/e2e/bgp-test/lb-cilium-bgp/chainsaw-test.yaml b/e2e/bgp-test/lb-cilium-bgp/chainsaw-test.yaml index faf8a5bc..74fb2d7a 100644 --- a/e2e/bgp-test/lb-cilium-bgp/chainsaw-test.yaml +++ b/e2e/bgp-test/lb-cilium-bgp/chainsaw-test.yaml @@ -7,6 +7,12 @@ metadata: all: spec: namespace: "cilium-bgp-test" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "cilium-bgp-test" | tail -100 steps: - name: Check if CCM is deployed try: @@ -61,7 +67,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail delete_nanode() { local NANODE_RESPONSE=$(curl -s -H "Authorization: Bearer $LINODE_TOKEN" \ diff --git a/e2e/subnet-test/chainsaw-test.yaml b/e2e/subnet-test/chainsaw-test.yaml index fd3b7f65..b85732e4 100644 --- a/e2e/subnet-test/chainsaw-test.yaml +++ b/e2e/subnet-test/chainsaw-test.yaml @@ -10,12 +10,18 @@ spec: - name: fwname value: (join('-', ['ccm-fwtest', env('CLUSTER_NAME')])) namespace: "subnet-filtering-test" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "subnet-filtering-test" | tail -100 steps: - name: Check if the CCM for each cluster focus on their individual subnets try: - script: content: | - set -e + set -euo pipefail if [ -z "$FIRST_CONFIG" ] || [ -z "$SECOND_CONFIG" ] || [ -z "$LINODE_TOKEN" ]; then echo "Error: FIRST_CONFIG, SECOND_CONFIG, and LINODE_TOKEN environment variables must be set" diff --git a/e2e/test/fw-use-specified-nb/chainsaw-test.yaml b/e2e/test/fw-use-specified-nb/chainsaw-test.yaml index 582ef422..681f6486 100644 --- a/e2e/test/fw-use-specified-nb/chainsaw-test.yaml +++ b/e2e/test/fw-use-specified-nb/chainsaw-test.yaml @@ -11,6 +11,12 @@ spec: - name: fwname value: (join('-', ['ccm-fwtest', env('CLUSTER_NAME')])) namespace: "fw-use-specified-nb" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "fw-use-specified-nb" | tail -100 steps: - name: Create firewall, Create pods and services try: @@ -19,7 +25,7 @@ spec: - name: FWLABEL value: ($fwname) content: | - set -e + set -euo pipefail create_fw=$(curl -s --write-out "%{http_code}\n" --output /dev/null --request POST \ -H "Authorization: Bearer $LINODE_TOKEN" \ @@ -79,7 +85,7 @@ spec: - name: FWLABEL value: ($fwname) content: | - set -e + set -euo pipefail re='^[0-9]+$' fwid=$(curl -s \ diff --git a/e2e/test/lb-created-with-invalid-ip/chainsaw-test.yaml b/e2e/test/lb-created-with-invalid-ip/chainsaw-test.yaml index 2f733cf1..e7f3b68f 100644 --- a/e2e/test/lb-created-with-invalid-ip/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-invalid-ip/chainsaw-test.yaml @@ -8,12 +8,18 @@ metadata: lke: spec: namespace: "lb-created-with-invalid-ip" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-invalid-ip" | tail -100 steps: - name: create reserved ip and nodebalancer resources try: - script: content: | - set -e + set -euo pipefail invalid_ip="100.1000.1000.1000" @@ -41,7 +47,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail delete_cm=$(kubectl delete configmap invalid-ip-config -n $NAMESPACE) if [[ "$delete_cm" == "configmap \"invalid-ip-config\" deleted" ]]; then @@ -66,7 +72,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail sleep 30 invalid_ip=$(kubectl get configmap invalid-ip-config -o=jsonpath='{.data.InvalidIP}' -n $NAMESPACE) if [[ -z "$invalid_ip" ]]; then diff --git a/e2e/test/lb-created-with-new-nb-id/chainsaw-test.yaml b/e2e/test/lb-created-with-new-nb-id/chainsaw-test.yaml index 4be7f750..20820df9 100644 --- a/e2e/test/lb-created-with-new-nb-id/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-new-nb-id/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-created-with-new-nb-id" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-new-nb-id" | tail -100 steps: - name: Create dummy service try: @@ -34,7 +40,7 @@ spec: - name: nbconf value: (json_parse($stdout)) content: | - set -e + set -euo pipefail re='^[0-9]+$' LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)" @@ -80,7 +86,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail expectedId=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .metadata.annotations[]) nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -95,7 +101,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail re='^[0-9]+$' diff --git a/e2e/test/lb-created-with-reserved-ip-and-nb-id-annotations/chainsaw-test.yaml b/e2e/test/lb-created-with-reserved-ip-and-nb-id-annotations/chainsaw-test.yaml index 57b93625..787a7f87 100644 --- a/e2e/test/lb-created-with-reserved-ip-and-nb-id-annotations/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-reserved-ip-and-nb-id-annotations/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-created-with-reserved-and-nb-id-annotations" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-reserved-and-nb-id-annotations" | tail -100 steps: - name: Create dummy service try: @@ -31,7 +37,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail re='^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$' @@ -88,7 +94,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap nb-config -o=jsonpath='{.data.Reserved_IP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -132,7 +138,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap nb-config -o=jsonpath='{.data.Reserved_IP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -166,4 +172,4 @@ spec: (contains($stdout, 'No service ip found for service svc-test')): false (contains($stdout, 'IPs do not match')): false (contains($stdout, 'NB IDs do not match')): false - \ No newline at end of file + diff --git a/e2e/test/lb-created-with-reserved-ip-attached-to-nb/chainsaw-test.yaml b/e2e/test/lb-created-with-reserved-ip-attached-to-nb/chainsaw-test.yaml index e91c185a..6ab56f98 100644 --- a/e2e/test/lb-created-with-reserved-ip-attached-to-nb/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-reserved-ip-attached-to-nb/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-created-with-reserved-ip-attached-to-nb" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-reserved-ip-attached-to-nb" | tail -100 steps: - name: Create dummy service try: @@ -32,7 +38,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail re='^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$' @@ -89,7 +95,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap nb-config -o=jsonpath='{.data.Reserved_IP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -150,7 +156,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap nb-config -o=jsonpath='{.data.Reserved_IP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -179,4 +185,4 @@ spec: (contains($stdout, 'No reserved ip found in configmap')): false (contains($stdout, 'Service ip found for service svc-test. Expected to be empty')): false (contains($stdout, 'IPs do not match')): true - \ No newline at end of file + diff --git a/e2e/test/lb-created-with-reserved-ip-change-ip-concurrently/chainsaw-test.yaml b/e2e/test/lb-created-with-reserved-ip-change-ip-concurrently/chainsaw-test.yaml index d6779f22..05531a42 100644 --- a/e2e/test/lb-created-with-reserved-ip-change-ip-concurrently/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-reserved-ip-change-ip-concurrently/chainsaw-test.yaml @@ -8,13 +8,19 @@ metadata: lke: spec: namespace: "lb-created-with-reserved-ip-change-ip-concurrently" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-reserved-ip-change-ip-concurrently" | tail -100 steps: - name: create reserved ip and nodebalancer resources try: - script: content: | + set -euo pipefail #!/bin/bash - set -e re='^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$' @@ -72,7 +78,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -133,8 +139,8 @@ spec: try: - script: content: | + set -euo pipefail #!/bin/bash - set -e patch_annotation() { VALUE=$1 @@ -188,7 +194,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then diff --git a/e2e/test/lb-created-with-reserved-ip-change-ip-unreserved/chainsaw-test.yaml b/e2e/test/lb-created-with-reserved-ip-change-ip-unreserved/chainsaw-test.yaml index efc57c8a..a6ca2b6b 100644 --- a/e2e/test/lb-created-with-reserved-ip-change-ip-unreserved/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-reserved-ip-change-ip-unreserved/chainsaw-test.yaml @@ -8,13 +8,19 @@ metadata: lke: spec: namespace: "lb-created-with-reserved-ip-change-ip-unreserved" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-reserved-ip-change-ip-unreserved" | tail -100 steps: - name: create reserved ip and nodebalancer resources try: - script: content: | + set -euo pipefail #!/bin/bash - set -e re='^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$' @@ -57,7 +63,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -100,8 +106,8 @@ spec: try: - script: content: | + set -euo pipefail #!/bin/bash - set -e reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -145,7 +151,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -170,4 +176,4 @@ spec: (contains($stdout, 'No reserved ip found in configmap')): false (contains($stdout, 'No service ip found for service svc-test')): false (contains($stdout, 'IPs do not match')): false - \ No newline at end of file + diff --git a/e2e/test/lb-created-with-reserved-ip-change-ip/chainsaw-test.yaml b/e2e/test/lb-created-with-reserved-ip-change-ip/chainsaw-test.yaml index 60f84fd7..19a490db 100644 --- a/e2e/test/lb-created-with-reserved-ip-change-ip/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-reserved-ip-change-ip/chainsaw-test.yaml @@ -8,13 +8,19 @@ metadata: lke: spec: namespace: "lb-created-with-reserved-ip-change-ip" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-reserved-ip-change-ip" | tail -100 steps: - name: create reserved ip and nodebalancer resources try: - script: content: | + set -euo pipefail #!/bin/bash - set -e re='^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$' @@ -71,7 +77,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -128,8 +134,8 @@ spec: try: - script: content: | + set -euo pipefail #!/bin/bash - set -e reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -173,7 +179,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -198,4 +204,4 @@ spec: (contains($stdout, 'No reserved ip found in configmap')): false (contains($stdout, 'No service ip found for service svc-test')): false (contains($stdout, 'IPs do not match')): false - \ No newline at end of file + diff --git a/e2e/test/lb-created-with-reserved-ip-linode-range/chainsaw-test.yaml b/e2e/test/lb-created-with-reserved-ip-linode-range/chainsaw-test.yaml index 25f07012..2054168f 100644 --- a/e2e/test/lb-created-with-reserved-ip-linode-range/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-reserved-ip-linode-range/chainsaw-test.yaml @@ -8,12 +8,18 @@ metadata: lke: spec: namespace: "lb-created-with-reserved-ip-linode-range" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-reserved-ip-linode-range" | tail -100 steps: - name: create reserved ip and nodebalancer resources try: - script: content: | - set -e + set -euo pipefail re='^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$' @@ -89,7 +95,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -149,7 +155,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -183,4 +189,4 @@ spec: (contains($stdout, 'No service ip found for service svc-test')): false (contains($stdout, 'IPs do not match')): false (contains($stdout, 'Request failed with response code')): false - \ No newline at end of file + diff --git a/e2e/test/lb-created-with-reserved-ip-multiple-change-ip/chainsaw-test.yaml b/e2e/test/lb-created-with-reserved-ip-multiple-change-ip/chainsaw-test.yaml index f6283ecc..f4a8db13 100644 --- a/e2e/test/lb-created-with-reserved-ip-multiple-change-ip/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-reserved-ip-multiple-change-ip/chainsaw-test.yaml @@ -8,13 +8,19 @@ metadata: lke: spec: namespace: "lb-created-with-reserved-ip-multiple-change-ip" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-reserved-ip-multiple-change-ip" | tail -100 steps: - name: create reserved ip and nodebalancer resources try: - script: content: | + set -euo pipefail #!/bin/bash - set -e re='^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$' @@ -73,7 +79,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -134,8 +140,8 @@ spec: try: - script: content: | + set -euo pipefail #!/bin/bash - set -e reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -198,7 +204,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then diff --git a/e2e/test/lb-created-with-reserved-ip-nb-range/chainsaw-test.yaml b/e2e/test/lb-created-with-reserved-ip-nb-range/chainsaw-test.yaml index e942756b..91d5d646 100644 --- a/e2e/test/lb-created-with-reserved-ip-nb-range/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-reserved-ip-nb-range/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-created-with-reserved-ip-nb-range" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-reserved-ip-nb-range" | tail -100 steps: - name: Create nodebalancer and create resources try: @@ -16,7 +22,7 @@ spec: - name: ip value: (json_parse($stdout)) content: | - set -e + set -euo pipefail re='^[0-9]+$' ip_re='^"((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})"$' @@ -56,7 +62,7 @@ spec: -H "Content-Type: application/json" --fail-early --retry 3 \ -H "accept: application/json" \ "${LINODE_URL}/v4beta/nodebalancers/$nbid") - response=$($delnb) + response=$del_nb if [ "$(echo "$del_nb" | jq 'length')" != 0 ]; then echo "Error deleting the nodebalancer" @@ -121,7 +127,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -181,7 +187,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap reserved-ip-config -o=jsonpath='{.data.ReservedIP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -215,4 +221,4 @@ spec: (contains($stdout, 'No service ip found for service svc-test')): false (contains($stdout, 'IPs do not match')): false (contains($stdout, 'Request failed with response code')): false - \ No newline at end of file + diff --git a/e2e/test/lb-created-with-specified-nb-id-reserved/chainsaw-test.yaml b/e2e/test/lb-created-with-specified-nb-id-reserved/chainsaw-test.yaml index a7546252..ddfa3d5b 100644 --- a/e2e/test/lb-created-with-specified-nb-id-reserved/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-specified-nb-id-reserved/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-created-with-specified-nb-id-reserved" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-specified-nb-id-reserved" | tail -100 steps: - name: Create dummy service try: @@ -31,7 +37,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail re='^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$' @@ -88,7 +94,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap nb-config -o=jsonpath='{.data.Reserved_IP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then @@ -131,7 +137,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail reserved_ip=$(kubectl get configmap nb-config -o=jsonpath='{.data.Reserved_IP}' -n $NAMESPACE) if [ -z "$reserved_ip" ]; then diff --git a/e2e/test/lb-created-with-specified-nb-id/chainsaw-test.yaml b/e2e/test/lb-created-with-specified-nb-id/chainsaw-test.yaml index da9ec62f..668511e0 100644 --- a/e2e/test/lb-created-with-specified-nb-id/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-specified-nb-id/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-created-with-specified-nb-id" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-specified-nb-id" | tail -100 steps: - name: Create dummy service try: @@ -34,7 +40,7 @@ spec: - name: nbconf value: (json_parse($stdout)) content: | - set -e + set -euo pipefail re='^[0-9]+$' LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)" @@ -80,7 +86,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail expectedId=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .metadata.annotations[]) nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-created-with-unreserved-ip/chainsaw-test.yaml b/e2e/test/lb-created-with-unreserved-ip/chainsaw-test.yaml index 48beed33..edc67afa 100644 --- a/e2e/test/lb-created-with-unreserved-ip/chainsaw-test.yaml +++ b/e2e/test/lb-created-with-unreserved-ip/chainsaw-test.yaml @@ -8,12 +8,18 @@ metadata: lke: spec: namespace: "lb-created-with-unreserved-ip" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-created-with-unreserved-ip" | tail -100 steps: - name: create reserved ip and nodebalancer resources try: - script: content: | - set -e + set -euo pipefail unreserved_ip="100.10.10.10" @@ -42,7 +48,7 @@ spec: cleanup: - script: content: | - set -e + set -euo pipefail delete_cm=$(kubectl delete configmap unreserved-ip-config -n $NAMESPACE) if [[ "$delete_cm" == "configmap \"unreserved-ip-config\" deleted" ]]; then @@ -67,7 +73,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail unreserved_ip=$(kubectl get configmap unreserved-ip-config -o=jsonpath='{.data.UnReservedIP}' -n $NAMESPACE) if [[ -z "$unreserved_ip" ]]; then diff --git a/e2e/test/lb-delete-svc-no-nb/chainsaw-test.yaml b/e2e/test/lb-delete-svc-no-nb/chainsaw-test.yaml index 85f7f295..e505759e 100644 --- a/e2e/test/lb-delete-svc-no-nb/chainsaw-test.yaml +++ b/e2e/test/lb-delete-svc-no-nb/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-delete-svc-no-nb" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-delete-svc-no-nb" | tail -100 steps: - name: Create dummy service try: @@ -34,7 +40,7 @@ spec: - name: nbconf value: (json_parse($stdout)) content: | - set -e + set -euo pipefail re='^[0-9]+$' LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)" @@ -80,7 +86,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail expectedId=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .metadata.annotations[]) nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -95,7 +101,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail re='^[0-9]+$' nbid=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .metadata.annotations[]) diff --git a/e2e/test/lb-delete-svc-use-new-nbid/chainsaw-test.yaml b/e2e/test/lb-delete-svc-use-new-nbid/chainsaw-test.yaml index ef67cef0..a7a343bb 100644 --- a/e2e/test/lb-delete-svc-use-new-nbid/chainsaw-test.yaml +++ b/e2e/test/lb-delete-svc-use-new-nbid/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-delete-svc-use-new-nbid" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-delete-svc-use-new-nbid" | tail -100 steps: - name: Create dummy service try: @@ -34,7 +40,7 @@ spec: - name: nbconf value: (json_parse($stdout)) content: | - set -e + set -euo pipefail re='^[0-9]+$' LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)" @@ -80,7 +86,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail expectedId=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .metadata.annotations[]) nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -95,7 +101,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail re='^[0-9]+$' diff --git a/e2e/test/lb-delete-svc-use-specified-nb/chainsaw-test.yaml b/e2e/test/lb-delete-svc-use-specified-nb/chainsaw-test.yaml index 7338c585..c025f113 100644 --- a/e2e/test/lb-delete-svc-use-specified-nb/chainsaw-test.yaml +++ b/e2e/test/lb-delete-svc-use-specified-nb/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-delete-svc-use-specified-nb" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-delete-svc-use-specified-nb" | tail -100 steps: - name: Create dummy service try: @@ -34,7 +40,7 @@ spec: - name: nbconf value: (json_parse($stdout)) content: | - set -e + set -euo pipefail re='^[0-9]+$' LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)" @@ -80,7 +86,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail expectedId=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .metadata.annotations[]) nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-fw-delete-acl/chainsaw-test.yaml b/e2e/test/lb-fw-delete-acl/chainsaw-test.yaml index 7f9a6d87..cde38aa8 100644 --- a/e2e/test/lb-fw-delete-acl/chainsaw-test.yaml +++ b/e2e/test/lb-fw-delete-acl/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-fw-delete-acl" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-fw-delete-acl" | tail -100 steps: - name: Create pods and services try: @@ -34,7 +40,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail for i in {1..10}; do nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -60,7 +66,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail for i in {1..10}; do nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -114,7 +120,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail nbid=0 fwid=0 diff --git a/e2e/test/lb-fw-update-acl/chainsaw-test.yaml b/e2e/test/lb-fw-update-acl/chainsaw-test.yaml index 957c9b96..88e8c925 100644 --- a/e2e/test/lb-fw-update-acl/chainsaw-test.yaml +++ b/e2e/test/lb-fw-update-acl/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-fw-update-acl" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-fw-update-acl" | tail -100 steps: - name: Create pods and services try: @@ -34,7 +40,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail for i in {1..10}; do nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -68,7 +74,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail for i in {1..10}; do nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-hostname-only-ingress/chainsaw-test.yaml b/e2e/test/lb-hostname-only-ingress/chainsaw-test.yaml index a8027c43..e0884365 100644 --- a/e2e/test/lb-hostname-only-ingress/chainsaw-test.yaml +++ b/e2e/test/lb-hostname-only-ingress/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-hostname-only-ingress" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-hostname-only-ingress" | tail -100 steps: - name: Create pods and services try: @@ -46,7 +52,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl annotate svc svc-test-2 -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-hostname-only-ingress=true check: ($error == null): true diff --git a/e2e/test/lb-http-body-health-check/chainsaw-test.yaml b/e2e/test/lb-http-body-health-check/chainsaw-test.yaml index b01c1d44..d90c07f8 100644 --- a/e2e/test/lb-http-body-health-check/chainsaw-test.yaml +++ b/e2e/test/lb-http-body-health-check/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-http-body-health-check" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-http-body-health-check" | tail -100 steps: - name: Create pods and services try: @@ -35,7 +41,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-http-status-health-check/chainsaw-test.yaml b/e2e/test/lb-http-status-health-check/chainsaw-test.yaml index a7764b09..3d4612ef 100644 --- a/e2e/test/lb-http-status-health-check/chainsaw-test.yaml +++ b/e2e/test/lb-http-status-health-check/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-http-status-health-check" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-http-status-health-check" | tail -100 steps: - name: Create pods and services try: @@ -35,7 +41,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) echo "Nodebalancer id: $nbid" diff --git a/e2e/test/lb-passive-health-check/chainsaw-test.yaml b/e2e/test/lb-passive-health-check/chainsaw-test.yaml index 9cc3fe87..fc4044dd 100644 --- a/e2e/test/lb-passive-health-check/chainsaw-test.yaml +++ b/e2e/test/lb-passive-health-check/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-passive-health-check" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-passive-health-check" | tail -100 steps: - name: Create pods and services try: @@ -35,7 +41,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-premium-nb/chainsaw-test.yaml b/e2e/test/lb-premium-nb/chainsaw-test.yaml index b531659f..6fe364a4 100644 --- a/e2e/test/lb-premium-nb/chainsaw-test.yaml +++ b/e2e/test/lb-premium-nb/chainsaw-test.yaml @@ -7,6 +7,12 @@ metadata: all: spec: namespace: "lb-premium-nb" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-premium-nb" | tail -100 steps: - name: Create pods and services try: @@ -34,7 +40,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail IP=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .status.loadBalancer.ingress[0].ip) echo "LoadBalancer IP: $IP" @@ -76,7 +82,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) for i in {1..10}; do diff --git a/e2e/test/lb-preserve-annotation-new-nb-specified/chainsaw-test.yaml b/e2e/test/lb-preserve-annotation-new-nb-specified/chainsaw-test.yaml index a2018a0a..733067c3 100644 --- a/e2e/test/lb-preserve-annotation-new-nb-specified/chainsaw-test.yaml +++ b/e2e/test/lb-preserve-annotation-new-nb-specified/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-preserve-annotation-new-nb-specified" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-preserve-annotation-new-nb-specified" | tail -100 steps: - name: Create resources try: @@ -34,7 +40,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail re='^[0-9]+$' diff --git a/e2e/test/lb-preserve-annotation-svc-delete/chainsaw-test.yaml b/e2e/test/lb-preserve-annotation-svc-delete/chainsaw-test.yaml index 3f9a33fe..afc71d15 100644 --- a/e2e/test/lb-preserve-annotation-svc-delete/chainsaw-test.yaml +++ b/e2e/test/lb-preserve-annotation-svc-delete/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-preserve-annotation-svc-delete" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-preserve-annotation-svc-delete" | tail -100 steps: - name: Create resources try: @@ -34,7 +40,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-simple/chainsaw-test.yaml b/e2e/test/lb-simple/chainsaw-test.yaml index e24a78be..9a7b2567 100644 --- a/e2e/test/lb-simple/chainsaw-test.yaml +++ b/e2e/test/lb-simple/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-simple" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-simple" | tail -100 steps: - name: Create pods and services try: @@ -34,7 +40,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail IP=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .status.loadBalancer.ingress[0].ip) podnames=() diff --git a/e2e/test/lb-single-tls/chainsaw-test.yaml b/e2e/test/lb-single-tls/chainsaw-test.yaml index b27409e5..fd37f61d 100644 --- a/e2e/test/lb-single-tls/chainsaw-test.yaml +++ b/e2e/test/lb-single-tls/chainsaw-test.yaml @@ -8,12 +8,18 @@ metadata: lke: spec: namespace: "lb-single-tls" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-single-tls" | tail -100 steps: - name: Create secret try: - script: content: | - set -e + set -euo pipefail kubectl -n $NAMESPACE create secret tls tls-secret --cert=../certificates/server.crt --key=../certificates/server.key check: ($error == null): true @@ -42,7 +48,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail IP=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .status.loadBalancer.ingress[0].ip) podnames=() diff --git a/e2e/test/lb-tcp-connection-health-check/chainsaw-test.yaml b/e2e/test/lb-tcp-connection-health-check/chainsaw-test.yaml index 09929a54..63182afb 100644 --- a/e2e/test/lb-tcp-connection-health-check/chainsaw-test.yaml +++ b/e2e/test/lb-tcp-connection-health-check/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-tcp-connection-health-check" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-tcp-connection-health-check" | tail -100 steps: - name: Create pods and services try: @@ -35,7 +41,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-update-port/chainsaw-test.yaml b/e2e/test/lb-update-port/chainsaw-test.yaml index a5f31cb7..464a0d0b 100644 --- a/e2e/test/lb-update-port/chainsaw-test.yaml +++ b/e2e/test/lb-update-port/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-update-port" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-update-port" | tail -100 steps: - name: Create pods and services try: @@ -34,7 +40,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail sleep 30 IP=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .status.loadBalancer.ingress[0].ip) @@ -78,7 +84,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail #wait for changes to propagate to the LB sleep 60 IP=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .status.loadBalancer.ingress[0].ip) @@ -119,7 +125,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail for i in {1..10}; do nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-updated-with-nb-id/chainsaw-test.yaml b/e2e/test/lb-updated-with-nb-id/chainsaw-test.yaml index c5b51aab..ac395ebe 100644 --- a/e2e/test/lb-updated-with-nb-id/chainsaw-test.yaml +++ b/e2e/test/lb-updated-with-nb-id/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-updated-with-nb-id" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-updated-with-nb-id" | tail -100 steps: - name: Create pods and services try: @@ -35,7 +41,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail re='^[0-9]+$' LABEL="ccm-$(head /dev/urandom | tr -dc 'a-z0-9' | head -c 5)" diff --git a/e2e/test/lb-with-http-to-https/chainsaw-test.yaml b/e2e/test/lb-with-http-to-https/chainsaw-test.yaml index ada0cd59..2b0d9b7a 100644 --- a/e2e/test/lb-with-http-to-https/chainsaw-test.yaml +++ b/e2e/test/lb-with-http-to-https/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-http-to-https" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-http-to-https" | tail -100 steps: - name: Create pods and services try: @@ -24,7 +30,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl -n $NAMESPACE create secret tls tls-secret-1 --cert=../certificates/server.crt --key=../certificates/server.key check: ($error == null): true @@ -32,7 +38,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-port-443='{"tls-secret-name": "tls-secret-1", "protocol": "https"}' kubectl patch svc svc-test -n $NAMESPACE --type='json' -p='[{"op": "add", "path": "/spec/ports/-", "value": {"name": "https", "port": 443, "targetPort": 8080, "protocol": "TCP"}}]' sleep 10 @@ -71,7 +77,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail IP=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .status.loadBalancer.ingress[0].ip) echo "loadbalancer ip: $IP" diff --git a/e2e/test/lb-with-multiple-http-https-ports/chainsaw-test.yaml b/e2e/test/lb-with-multiple-http-https-ports/chainsaw-test.yaml index 2ada3cee..682e0111 100644 --- a/e2e/test/lb-with-multiple-http-https-ports/chainsaw-test.yaml +++ b/e2e/test/lb-with-multiple-http-https-ports/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-multiple-http-https-ports" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-multiple-http-https-ports" | tail -100 steps: - name: Create pods and services try: @@ -24,7 +30,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl -n $NAMESPACE create secret tls tls-secret-1 --cert=../certificates/server.crt --key=../certificates/server.key kubectl -n $NAMESPACE create secret tls tls-secret-2 --cert=../certificates/server.crt --key=../certificates/server.key sleep 2 @@ -63,7 +69,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail IP=$(kubectl get svc svc-test -n $NAMESPACE -o json | jq -r .status.loadBalancer.ingress[0].ip) echo "loadbalancer ip: $IP" diff --git a/e2e/test/lb-with-node-addition/chainsaw-test.yaml b/e2e/test/lb-with-node-addition/chainsaw-test.yaml index 18e4ad24..e4e5fb8b 100644 --- a/e2e/test/lb-with-node-addition/chainsaw-test.yaml +++ b/e2e/test/lb-with-node-addition/chainsaw-test.yaml @@ -7,6 +7,12 @@ metadata: all: spec: namespace: "lb-with-node-addition" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-node-addition" | tail -100 steps: - name: Create resources try: @@ -34,7 +40,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -70,7 +76,7 @@ spec: - script: timeout: 10m content: | - set -e + set -euo pipefail current_replicas=$(KUBECONFIG=$MGMT_KUBECONFIG kubectl get machinedeployment ${CLUSTER_NAME}-md-0 -o=jsonpath='{.spec.replicas}') required_replicas=$((current_replicas + 1)) diff --git a/e2e/test/lb-with-proxyprotocol-default-annotation/chainsaw-test.yaml b/e2e/test/lb-with-proxyprotocol-default-annotation/chainsaw-test.yaml index d39f754b..ef4cdd9b 100644 --- a/e2e/test/lb-with-proxyprotocol-default-annotation/chainsaw-test.yaml +++ b/e2e/test/lb-with-proxyprotocol-default-annotation/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-proxyprotocol-default-annotation" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-proxyprotocol-default-annotation" | tail -100 steps: - name: Create pods and services try: @@ -34,7 +40,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-proxy-protocol=v2 sleep 10 check: @@ -43,7 +49,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -71,7 +77,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-default-proxy-protocol=v1 sleep 10 check: @@ -80,7 +86,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail re='^[0-9]+$' diff --git a/e2e/test/lb-with-proxyprotocol-override/chainsaw-test.yaml b/e2e/test/lb-with-proxyprotocol-override/chainsaw-test.yaml index 7715ffc7..e1f39f22 100644 --- a/e2e/test/lb-with-proxyprotocol-override/chainsaw-test.yaml +++ b/e2e/test/lb-with-proxyprotocol-override/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-proxyprotocol-override" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-proxyprotocol-override" | tail -100 steps: - name: Create pods and services try: @@ -34,7 +40,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-port-80='{"proxy-protocol": "v1"}' kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-port-8080='{"proxy-protocol": "v2"}' sleep 10 @@ -42,7 +48,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -66,7 +72,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-default-proxy-protocol=v2 kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-port-80- kubectl annotate --overwrite svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-port-8080='{"proxy-protocol": "v1"}' @@ -77,7 +83,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-with-proxyprotocol-port-specific/chainsaw-test.yaml b/e2e/test/lb-with-proxyprotocol-port-specific/chainsaw-test.yaml index 1f43cefe..38951cd7 100644 --- a/e2e/test/lb-with-proxyprotocol-port-specific/chainsaw-test.yaml +++ b/e2e/test/lb-with-proxyprotocol-port-specific/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-proxyprotocol-port-specific" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-proxyprotocol-port-specific" | tail -100 steps: - name: Create pods and services try: @@ -34,7 +40,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-port-8080='{"proxy-protocol": "v2"}' sleep 10 check: @@ -43,7 +49,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-with-proxyprotocol-set/chainsaw-test.yaml b/e2e/test/lb-with-proxyprotocol-set/chainsaw-test.yaml index a7809a63..d7c7e99a 100644 --- a/e2e/test/lb-with-proxyprotocol-set/chainsaw-test.yaml +++ b/e2e/test/lb-with-proxyprotocol-set/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-proxyprotocol-set" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-proxyprotocol-set" | tail -100 steps: - name: Create pods and services try: @@ -44,7 +50,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-port-80='{"proxy-protocol": "v1"}' kubectl annotate svc svc-test -n $NAMESPACE service.beta.kubernetes.io/linode-loadbalancer-port-8080='{"proxy-protocol": "v2"}' sleep 10 @@ -54,7 +60,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) diff --git a/e2e/test/lb-with-udp-ports-algorithm/chainsaw-test.yaml b/e2e/test/lb-with-udp-ports-algorithm/chainsaw-test.yaml index 94084918..b7a1f755 100644 --- a/e2e/test/lb-with-udp-ports-algorithm/chainsaw-test.yaml +++ b/e2e/test/lb-with-udp-ports-algorithm/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-udp-ports-algorithm" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-udp-ports-algorithm" | tail -100 steps: - name: Create pods and services try: diff --git a/e2e/test/lb-with-udp-ports-change-port/chainsaw-test.yaml b/e2e/test/lb-with-udp-ports-change-port/chainsaw-test.yaml index a8dafe20..ca69b132 100644 --- a/e2e/test/lb-with-udp-ports-change-port/chainsaw-test.yaml +++ b/e2e/test/lb-with-udp-ports-change-port/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-udp-ports-change-port" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-udp-ports-change-port" | tail -100 steps: - name: Create pods and services try: diff --git a/e2e/test/lb-with-udp-ports-mode/chainsaw-test.yaml b/e2e/test/lb-with-udp-ports-mode/chainsaw-test.yaml index deb89f20..d6db4b95 100644 --- a/e2e/test/lb-with-udp-ports-mode/chainsaw-test.yaml +++ b/e2e/test/lb-with-udp-ports-mode/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-udp-ports-mode" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-udp-ports-mode" | tail -100 steps: - name: Create pods and services try: diff --git a/e2e/test/lb-with-udp-ports-stickiness/chainsaw-test.yaml b/e2e/test/lb-with-udp-ports-stickiness/chainsaw-test.yaml index b7773b57..2561bde8 100644 --- a/e2e/test/lb-with-udp-ports-stickiness/chainsaw-test.yaml +++ b/e2e/test/lb-with-udp-ports-stickiness/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-udp-ports-stickiness" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-udp-ports-stickiness" | tail -100 steps: - name: Create pods and services try: @@ -72,8 +78,3 @@ spec: check: ($error == null): true (contains($stdout, 'Stickiness successfully updated to source_ip')): true - catch: - - script: - content: | - echo "Test failed. Fetching CCM logs..." - kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-udp-ports-stickiness" diff --git a/e2e/test/lb-with-udp-ports/chainsaw-test.yaml b/e2e/test/lb-with-udp-ports/chainsaw-test.yaml index 9e5959f1..19ffea45 100644 --- a/e2e/test/lb-with-udp-ports/chainsaw-test.yaml +++ b/e2e/test/lb-with-udp-ports/chainsaw-test.yaml @@ -8,6 +8,12 @@ metadata: lke: spec: namespace: "lb-with-udp-ports" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-udp-ports" | tail -100 steps: - name: Create pods and services try: diff --git a/e2e/test/lb-with-vpc-backends/chainsaw-test.yaml b/e2e/test/lb-with-vpc-backends/chainsaw-test.yaml index ac7a99e4..26ab955f 100644 --- a/e2e/test/lb-with-vpc-backends/chainsaw-test.yaml +++ b/e2e/test/lb-with-vpc-backends/chainsaw-test.yaml @@ -7,6 +7,12 @@ metadata: all: spec: namespace: "lb-with-vpc-backends" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "lb-with-vpc-backends" | tail -100 steps: - name: Create pods and services try: @@ -43,7 +49,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail nbid=$(KUBECONFIG=$KUBECONFIG NAMESPACE=$NAMESPACE LINODE_TOKEN=$LINODE_TOKEN ../scripts/get-nb-id.sh) @@ -61,7 +67,7 @@ spec: "$LINODE_URL/v4/nodebalancers/$nbid/configs/$config_id/nodes") # Extract all addresses and remove ports - addresses=$(echo "$json_data" | jq -r '.data[].address' | sed 's/:[0-9]*$//') + addresses=$(echo "$nodes" | jq -r '.data[].address' | sed 's/:[0-9]*$//') for ip in $addresses; do if [[ $ip =~ ^10\.0\.0\.[0-9]+$ ]]; then diff --git a/e2e/test/route-controller-test/chainsaw-test.yaml b/e2e/test/route-controller-test/chainsaw-test.yaml index e8657557..e5521743 100644 --- a/e2e/test/route-controller-test/chainsaw-test.yaml +++ b/e2e/test/route-controller-test/chainsaw-test.yaml @@ -10,12 +10,18 @@ spec: - name: fwname value: (join('-', ['ccm-fwtest', env('CLUSTER_NAME')])) namespace: "route-controller-test" + catch: + - script: + content: | + set -euo pipefail + echo "Test failed. Fetching CCM logs..." + kubectl logs -n kube-system daemonsets/ccm-linode | grep "route-controller-test" | tail -100 steps: - name: Check if the route controller updated the config for the linode try: - script: content: | - set -e + set -euo pipefail if [ -z "$KUBECONFIG" ] || [ -z "$LINODE_TOKEN" ]; then echo "Error: KUBECONFIG and LINODE_TOKEN environment variables must be set" @@ -65,7 +71,7 @@ spec: try: - script: content: | - set -e + set -euo pipefail # Use last node to change its label node=$(kubectl get nodes -o jsonpath='{.items[-1].metadata.name}')