-
Notifications
You must be signed in to change notification settings - Fork 42
187 lines (152 loc) · 6.43 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: KinD e2e tests
on:
push:
branches: [ 'main', 'release-*' ]
pull_request:
branches: [ 'main', 'release-*' ]
jobs:
ko-resolve:
name: e2e tests
runs-on: ubuntu-latest
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
k8s-version:
- v1.25.3
eventing-version:
- knative-v1.10.1
# Map between K8s and KinD versions.
# This is attempting to make it a bit clearer what's being tested.
# See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.9.0
include:
- k8s-version: v1.25.3
kind-version: v0.17.0
kind-image-sha: sha256:cd248d1438192f7814fbca8fede13cfe5b9918746dfa12583976158a834fd5c5
env:
KO_DOCKER_REPO: kind.local
SYSTEM_NAMESPACE: knative-eventing
KIND_CLUSTER_NAME: kind
steps:
- name: Defaults
run: |
if [[ "${{ secrets.SLACK_WEBHOOK }}" != "" ]]; then
echo "SLACK_WEBHOOK=exists" >> $GITHUB_ENV
fi
- name: Set up Go 1.18.x
uses: actions/setup-go@v2
with:
go-version: 1.18.x
- name: Install Dependencies
run: |
echo '::group:: install ko'
curl -L https://github.com/google/ko/releases/download/v0.7.0/ko_0.7.0_Linux_x86_64.tar.gz | tar xzf - ko
chmod +x ./ko
sudo mv ko /usr/local/bin
echo '::endgroup::'
- name: Check out code
uses: actions/checkout@v2
- name: Install KinD
env:
KIND_VERSION: ${{ matrix.kind-version }}
run: |
set -x
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${{ matrix.kind-version }}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
- name: Create KinD Cluster
run: |
set -x
# KinD configuration.
cat > kind.yaml <<EOF
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
# This is needed in order to support projected volumes with service account tokens.
# See: https://kubernetes.slack.com/archives/CEKK1KTN2/p1600268272383600
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"
nodes:
- role: control-plane
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }}
- role: worker
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }}
EOF
# Create a cluster!
kind create cluster --config kind.yaml
- name: Install natss
run: |
set -x
kubectl create namespace natss
kubectl apply -n natss -f ./config/broker/natss.yaml
# Create a ConfigMap that we use to instruct Broker to create natss channels.
kubectl apply -n natss -f ./config/broker/config-br-default-channel-natss.yaml
- name: Install Knative Eventing
run: |
set -x
kubectl apply --filename https://github.com/knative/eventing/releases/download/${{ matrix.eventing-version }}/eventing-crds.yaml
sleep 2 # Wait for the CRDs to be reconciled.
kubectl apply --filename https://github.com/knative/eventing/releases/download/${{ matrix.eventing-version }}/eventing-core.yaml
kubectl apply --filename https://github.com/knative/eventing/releases/download/${{ matrix.eventing-version }}/mt-channel-broker.yaml
- name: Install
run: |
set -x
# TODO: this should use the release script and then apply the newly created release yaml in the future.
# Install the natss channel
ko apply -f ./config/
- name: Wait for Ready
run: |
set -x
# Probably don't need this anymore, but keep until we
# have something that waits for pods to becomes ready.
sleep 60
# For debugging.
kubectl get pods --all-namespaces
- name: Run e2e Tests
run: |
set -x
# Run the tests tagged as e2e on the KinD cluster.
go test -v -race -count=1 -timeout=15m -tags=e2e ./test/e2e/...
- name: Gather Failure Data
if: ${{ failure() }}
run: |
set -x
echo "===================== Brokers =============================="
kubectl get broker --all-namespaces=true -oyaml
echo "===================== Channels ============================="
kubectl get channel --all-namespaces=true -oyaml
echo "===================== Triggers ============================="
kubectl get trigger --all-namespaces=true -oyaml
echo "===================== K8s Events ==========================="
kubectl get events --all-namespaces=true -oyaml
echo "===================== Pod Logs ============================="
namespace=knative-eventing
for pod in $(kubectl get pod -n $namespace | 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
- name: Post failure notice to Slack
# Note: using env.SLACK_WEBHOOK here because secrets are not allowed in the if block.
if: ${{ env.SLACK_WEBHOOK != '' && failure() && github.event_name != 'pull_request' }}
uses: rtCamp/action-slack-notify@v2.1.0
env:
SLACK_ICON: http://github.com/knative.png?size=48
SLACK_USERNAME: github-actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: 'eventing-delivery'
MSG_MINIMAL: 'true'
SLACK_TITLE: Periodic e2e for Natss on kind on (${{ matrix.k8s-version }}, ${{ matrix.eventing-version }}) failed.
SLACK_MESSAGE: |
For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}