|
| 1 | +name: gateway |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +env: |
| 9 | + GO_VERSION: "1.24" |
| 10 | + K8S_VERSION: "v1.32.0" |
| 11 | + KIND_VERSION: "v0.27.0" |
| 12 | + KIND_CLUSTER_NAME: "kind-cloud" |
| 13 | + |
| 14 | +jobs: |
| 15 | + gateway: |
| 16 | + name: gateway |
| 17 | + runs-on: ubuntu-latest |
| 18 | + timeout-minutes: 100 |
| 19 | + env: |
| 20 | + JOB_NAME: "cloud-provider-kind-e2e-gateway" |
| 21 | + steps: |
| 22 | + - name: Set up Go |
| 23 | + uses: actions/setup-go@v5 |
| 24 | + with: |
| 25 | + go-version: ${{ env.GO_VERSION }} |
| 26 | + id: go |
| 27 | + |
| 28 | + - name: Check out code |
| 29 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 30 | + |
| 31 | + - name: Enable ipv4 and ipv6 forwarding |
| 32 | + run: | |
| 33 | + sudo sysctl -w net.ipv6.conf.all.forwarding=1 |
| 34 | + sudo sysctl -w net.ipv4.ip_forward=1 |
| 35 | +
|
| 36 | + - name: Set up environment (download dependencies) |
| 37 | + run: | |
| 38 | + TMP_DIR=$(mktemp -d) |
| 39 | + # Test binaries |
| 40 | + git clone --depth 1 https://github.com/kubernetes-sigs/gateway-api.git ${TMP_DIR} |
| 41 | + cd ${TMP_DIR} |
| 42 | + go test ./conformance/ -c |
| 43 | + cd - |
| 44 | + sudo cp ${TMP_DIR}/conformance.test /usr/local/bin/conformance.test |
| 45 | + sudo chmod +x /usr/local/bin/conformance.test |
| 46 | + # kubectl |
| 47 | + curl -L https://dl.k8s.io/${{ env.K8S_VERSION }}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl |
| 48 | + # kind |
| 49 | + curl -Lo ${TMP_DIR}/kind https://kind.sigs.k8s.io/dl/${{ env.KIND_VERSION }}/kind-linux-amd64 |
| 50 | + # Install |
| 51 | + sudo cp ${TMP_DIR}/kubectl /usr/local/bin/kubectl |
| 52 | + sudo cp ${TMP_DIR}/kind /usr/local/bin/kind |
| 53 | + sudo chmod +x /usr/local/bin/kubectl |
| 54 | + sudo chmod +x /usr/local/bin/kind |
| 55 | + # Create folder to store artifacts |
| 56 | + mkdir -p _artifacts |
| 57 | +
|
| 58 | + - name: Run cloud-provider-kind |
| 59 | + run: | |
| 60 | + make |
| 61 | + nohup bin/cloud-provider-kind -v 2 --enable-log-dumping --logs-dir ./_artifacts/loadbalancers > ./_artifacts/ccm-kind.log 2>&1 & |
| 62 | +
|
| 63 | + - name: Create multi node cluster |
| 64 | + run: | |
| 65 | + # create cluster |
| 66 | + cat <<EOF | /usr/local/bin/kind create cluster \ |
| 67 | + --name ${{ env.KIND_CLUSTER_NAME}} \ |
| 68 | + --image kindest/node:${{ env.K8S_VERSION }} \ |
| 69 | + -v7 --wait 1m --retain --config=- |
| 70 | + kind: Cluster |
| 71 | + apiVersion: kind.x-k8s.io/v1alpha4 |
| 72 | + nodes: |
| 73 | + - role: control-plane |
| 74 | + - role: worker |
| 75 | + - role: worker |
| 76 | + kubeadmConfigPatches: |
| 77 | + - | |
| 78 | + kind: ClusterConfiguration |
| 79 | + apiServer: |
| 80 | + extraArgs: |
| 81 | + cloud-provider: "external" |
| 82 | + v: "5" |
| 83 | + controllerManager: |
| 84 | + extraArgs: |
| 85 | + cloud-provider: "external" |
| 86 | + v: "5" |
| 87 | + --- |
| 88 | + kind: InitConfiguration |
| 89 | + nodeRegistration: |
| 90 | + kubeletExtraArgs: |
| 91 | + cloud-provider: "external" |
| 92 | + v: "5" |
| 93 | + --- |
| 94 | + kind: JoinConfiguration |
| 95 | + nodeRegistration: |
| 96 | + kubeletExtraArgs: |
| 97 | + cloud-provider: "external" |
| 98 | + v: "5" |
| 99 | + EOF |
| 100 | + /usr/local/bin/kind get kubeconfig --name ${{ env.KIND_CLUSTER_NAME}} > _artifacts/kubeconfig.conf |
| 101 | +
|
| 102 | + - name: Get Cluster status |
| 103 | + run: | |
| 104 | + /usr/local/bin/kubectl get nodes -o yaml |
| 105 | + /usr/local/bin/kubectl get pods -A -o wide |
| 106 | + # wait network is ready |
| 107 | + /usr/local/bin/kubectl wait --for=condition=ready pods --namespace=kube-system -l k8s-app=kube-dns --timeout=3m |
| 108 | + /usr/local/bin/kubectl get nodes -o wide |
| 109 | + /usr/local/bin/kubectl get pods -A |
| 110 | +
|
| 111 | + - name: Run tests |
| 112 | + run: | |
| 113 | + /usr/local/bin/conformance.test -test.run TestConformance \ |
| 114 | + --kubeconfig=_artifacts/kubeconfig.conf \ |
| 115 | + --organizaion=sigs.k8s.io \ |
| 116 | + --project=cloud-provider-kind \ |
| 117 | + --gateway-class=cloud-provider-kind \ |
| 118 | + --supported-features=Gateway,HTTPRoute \ |
| 119 | + --report-output=./_artifacts |
| 120 | +
|
| 121 | + - name: Export logs |
| 122 | + if: always() |
| 123 | + run: | |
| 124 | + /usr/local/bin/kind export logs --name ${{ env.KIND_CLUSTER_NAME}} ./_artifacts/logs |
| 125 | + cp ./_artifacts/ccm-kind.log ./_artifacts/logs |
| 126 | + cp ./_artifacts/loadbalancers/* ./_artifacts/logs |
| 127 | +
|
| 128 | + - name: Upload logs |
| 129 | + if: always() |
| 130 | + uses: actions/upload-artifact@v4 |
| 131 | + with: |
| 132 | + name: kind-logs-${{ env.JOB_NAME }}-${{ github.run_id }} |
| 133 | + path: ./_artifacts |
0 commit comments