-
Notifications
You must be signed in to change notification settings - Fork 38
107 lines (86 loc) · 3.31 KB
/
kind-e2e.yaml
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
105
name: KinD e2e tests
on:
push:
branches: [ 'main', 'release-*' ]
pull_request:
branches: [ 'main', 'release-*' ]
jobs:
e2e-tests:
strategy:
matrix:
platform: [ ubuntu-latest ]
kind-version: [ 0.14.0 ]
name: e2e tests
runs-on: ${{ matrix.platform }}
env:
KO_DOCKER_REPO: kind.local
KIND_VERSION: ${{ matrix.kind-version }}
steps:
- name: Set up Go
uses: knative/actions/setup-go@main
id: go
- name: Check out code onto GOPATH
uses: actions/checkout@v2
with:
path: ./src/knative.dev/${{ github.event.repository.name }}
- name: Install KinD ${{ matrix.kind-version }}
working-directory: ./src/knative.dev/${{ github.event.repository.name }}
run: |
set -x
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
- name: Create KinD Cluster
working-directory: ./src/knative.dev/${{ github.event.repository.name }}
env:
NODE_IMAGE: 'kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6'
run: |
set -x
# KinD configuration.
cat > kind.yaml <<EOF
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
image: ${NODE_IMAGE}
- role: worker
image: ${NODE_IMAGE}
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
metadata:
name: config
apiServer:
extraArgs:
"service-account-issuer": "kubernetes.default.svc"
"service-account-signing-key-file": "/etc/kubernetes/pki/sa.key"
EOF
# Create a cluster!
kind create cluster --config kind.yaml
- name: Run e2e Tests
working-directory: ./src/knative.dev/${{ github.event.repository.name }}
run: |
set -x
source test/e2e-common.sh && test_setup
# Run the tests tagged as e2e on the KinD cluster.
go run gotest.tools/[email protected] --format testname -- \
-race -count=1 -timeout=1h -tags=e2e ./test/...
- name: Gather Failure Data
if: ${{ failure() }}
run: |
set -x
echo "===================== K8s Events ==========================="
kubectl get events --all-namespaces=true -oyaml
echo "===================== Pod Logs ============================="
namespace=knative-reconciler-test
for pod in $(kubectl get pod -n $namespace | grep Running | awk '{print $1}'); do
for container in $(kubectl get pod "${pod}" -n $namespace -ojsonpath='{.spec.containers[*].name}'); do
echo "Namespace, Pod, Container: ${namespace}, ${pod}, ${container}"
kubectl logs -n $namespace "${pod}" -c "${container}" || true
echo "----------------------------------------------------------"
echo "Namespace, Pod, Container (Previous instance): ${namespace}, ${pod}, ${container}"
kubectl logs -p -n $namespace "${pod}" -c "${container}" || true
echo "============================================================"
done
done