forked from kubernetes-sigs/kind
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (101 loc) · 3.08 KB
/
cluster-e2e-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Kind Cluster E2E Tests
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'site/**'
permissions:
contents: read
jobs:
cluster-testing:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
ipFamily: [ipv4]
deployment: [singleNode, multiNode]
env:
JOB_NAME: "cluster-${{ matrix.deployment }}-${{ matrix.ipFamily }}"
IP_FAMILY: ${{ matrix.ipFamily }}
steps:
-
name: Update Ubuntu
run: |
sudo apt update && sudo apt upgrade -y
-
name: Check out code into the Go module directory
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
-
name: Install kind
run: make && sudo make install INSTALL_DIR=/usr/local/bin
-
name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
# - name: Install helm
# run: |
# curl -Lo ./get-helm-3 https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
# chmod +x get-helm-3
# sudo ./get-helm-3
# helm repo update
-
name: Enable ipv4 and ipv6 forwarding
run: |
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo sysctl -w net.ipv4.ip_forward=1
-
name: Create single node cluster
if: ${{ matrix.deployment == 'singleNode' }}
run: |
cat <<EOF | /usr/local/bin/kind create cluster -v7 --wait 1m --retain --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
ipFamily: ${IP_FAMILY}
EOF
-
name: Create multi node cluster
if: ${{ matrix.deployment == 'multiNode' }}
run: |
cat <<EOF | kind create cluster -v7 --wait 1m --retain --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
ipFamily: ${IP_FAMILY}
nodes:
- role: control-plane
- role: worker
- role: worker
EOF
-
name: Get Cluster status
run: |
# wait network is ready
kubectl wait --for=condition=ready pods --namespace=kube-system -l k8s-app=kube-dns
kubectl get nodes -o wide
kubectl get pods -A
kubectl cluster-info
-
name: run e2e tests
run: ./hack/ci/e2e.sh
-
name: Export logs
if: always()
run: |
mkdir -p /tmp/kind/logs
/usr/local/bin/kind export logs /tmp/kind/logs
sudo chown -R $USER:$USER /tmp/kind/logs
-
name: Upload logs
if: always()
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: kind-logs-${{ env.JOB_NAME }}-${{ github.run_id }}
path: /tmp/kind/logs
-
name: Delete cluster
run: /usr/local/bin/kind delete cluster