@@ -3,34 +3,60 @@ name: KinD e2e tests
33on :
44 push :
55 branches : [ 'main', 'release-*' ]
6+ paths :
7+ - ' **/*.go'
8+ - ' go.mod'
9+ - ' go.sum'
10+ - ' config/**'
11+ - ' test/**'
12+ - ' hack/**'
13+ - ' third_party/**'
14+ - ' .github/workflows/kind-e2e.yaml'
615 pull_request :
716 branches : [ 'main', 'release-*' ]
17+ paths :
18+ - ' **/*.go'
19+ - ' go.mod'
20+ - ' go.sum'
21+ - ' config/**'
22+ - ' test/**'
23+ - ' hack/**'
24+ - ' third_party/**'
25+ - ' .github/workflows/kind-e2e.yaml'
26+
27+ defaults :
28+ run :
29+ shell : bash
30+
31+ concurrency :
32+ group : ${{ github.workflow }}-${{ github.ref }}
33+ cancel-in-progress : true
34+
35+ permissions :
36+ contents : read
837
938jobs :
1039
11- ko-resolve :
12- name : e2e tests
40+ e2e-tests :
41+ name : e2e tests (${{ matrix.k8s-version }}, ${{ matrix.eventing-version }})
1342 runs-on : ubuntu-latest
43+ timeout-minutes : 120
1444 strategy :
1545 fail-fast : false # Keep running if one leg fails.
1646 matrix :
1747 k8s-version :
18- - v1.34.3
48+ - v1.34.x
49+ - v1.35.x
1950
2051 eventing-version :
21- - knative-v1.21.0
22-
23- # Map between K8s and KinD versions.
24- # This is attempting to make it a bit clearer what's being tested.
25- # See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.29.0
26- include :
27- - k8s-version : v1.34.3
28- kind-version : v0.31.0
29- kind-image-sha : sha256:08497ee19eace7b4b5348db5c6a1591d7752b164530a36f855cb0f2bdcbadd48
52+ # Exercise compatibility with a supported Eventing installation.
53+ - knative-v1.23.0
54+ # Build the Eventing revision selected by go.mod.
55+ - go.mod
56+
3057 env :
3158 KO_DOCKER_REPO : kind.local
3259 SYSTEM_NAMESPACE : knative-eventing
33- KIND_CLUSTER_NAME : kind
3460
3561 steps :
3662 - name : Defaults
@@ -43,75 +69,61 @@ jobs:
4369 uses : knative/actions/setup-go@main
4470
4571 - name : Install ko
46- uses : ko-build/setup-ko@v0.7
72+ uses : ko-build/setup-ko@v0.10
4773
4874 - name : Check out code
49- uses : actions/checkout@v4
75+ uses : actions/checkout@v7
5076
51- - name : Install KinD
52- env :
53- KIND_VERSION : ${{ matrix.kind-version }}
77+ - name : Resolve Knative Eventing dependency
78+ if : matrix.eventing-version == 'go.mod'
79+ id : eventing-dependency
5480 run : |
55- set -x
81+ set -euo pipefail
82+
83+ eventing_version="$(go list -m -f '{{.Version}}' knative.dev/eventing)"
84+ eventing_ref="$(
85+ GOPROXY=direct go mod download -json "knative.dev/eventing@${eventing_version}" |
86+ jq -er '.Origin.Hash'
87+ )"
88+ echo "ref=${eventing_ref}" >> "$GITHUB_OUTPUT"
89+
90+ - name : Check out Knative Eventing source
91+ if : matrix.eventing-version == 'go.mod'
92+ uses : actions/checkout@v7
93+ with :
94+ repository : knative/eventing
95+ ref : ${{ steps.eventing-dependency.outputs.ref }}
96+ path : .eventing-source
5697
57- curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${{ matrix.kind-version }}/kind-$(uname)-amd64
58- chmod +x ./kind
59- sudo mv kind /usr/local/bin
60-
61- - name : Create KinD Cluster
62- run : |
63- set -x
98+ - name : Install KinD
99+ uses : chainguard-dev/actions/setup-kind@c69a264ec2a5934c3186c618f368fc1c86f16cff # main
100+ with :
101+ k8s-version : ${{ matrix.k8s-version }}
102+ kind-worker-count : 1
103+ cluster-suffix : cluster.local
64104
65- # KinD configuration.
66- cat > kind.yaml <<EOF
67- apiVersion: kind.x-k8s.io/v1alpha4
68- kind: Cluster
69-
70- # This is needed in order to support projected volumes with service account tokens.
71- # See: https://kubernetes.slack.com/archives/CEKK1KTN2/p1600268272383600
72- kubeadmConfigPatches:
73- - |
74- apiVersion: kubeadm.k8s.io/v1beta2
75- kind: ClusterConfiguration
76- metadata:
77- name: config
78- apiServer:
79- extraArgs:
80- "service-account-issuer": "kubernetes.default.svc"
81- "service-account-signing-key-file": "/etc/kubernetes/pki/sa.key"
82- nodes:
83- - role: control-plane
84- image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }}
85- - role: worker
86- image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }}
87-
88- EOF
89-
90- # Create a cluster!
91- kind create cluster --config kind.yaml
92-
93- - name : Install nats
105+ - name : Install NATS
94106 run : |
95107 set -x
96108
97- kubectl create namespace nats
98- kubectl apply -n nats-io -f ./config/mtbroker/natsjsm.yaml
109+ kubectl apply -f ./config/mtbroker/natsjsm.yaml
99110 # Create a ConfigMap that we use to instruct Broker to create nats channels.
100- kubectl create namespace knative-eventing
101- kubectl apply -n knative-eventing -f ./config/mtbroker/config-br-default-channel-jsm.yaml
102- kubectl apply -n knative-eventing -f ./config/mtbroker/config-nats.yaml
103-
111+ kubectl create namespace ${SYSTEM_NAMESPACE}
112+ kubectl apply -n ${SYSTEM_NAMESPACE} -f ./config/mtbroker/config-br-default-channel-jsm.yaml
113+ kubectl apply -n ${SYSTEM_NAMESPACE} -f ./config/mtbroker/config-nats.yaml
114+
104115 set +x
105116 source ./vendor/knative.dev/hack/infra-library.sh
106117 wait_until_pods_running nats-io
107-
118+
108119 set -x
109120 kubectl get pods -n nats-io
110121 kubectl get svc nats -n nats-io
111122 kubectl get pods -n kube-system -l k8s-app=kube-dns
112123 kubectl logs -n kube-system -l k8s-app=kube-dns
113124
114- - name : Install Knative Eventing
125+ - name : Install released Knative Eventing
126+ if : matrix.eventing-version != 'go.mod'
115127 run : |
116128 set -x
117129
@@ -120,73 +132,88 @@ jobs:
120132 kubectl apply --filename https://github.com/knative/eventing/releases/download/${{ matrix.eventing-version }}/eventing-core.yaml
121133 kubectl apply --filename https://github.com/knative/eventing/releases/download/${{ matrix.eventing-version }}/mt-channel-broker.yaml
122134
123- - name : Install
135+ - name : Build and install Knative Eventing source
136+ if : matrix.eventing-version == 'go.mod'
137+ working-directory : .eventing-source
138+ run : |
139+ set -x
140+
141+ ko apply --platform=linux/amd64 -R -f ./config/core/
142+ ko apply --platform=linux/amd64 -f ./config/brokers/mt-channel-broker/
143+
144+ - name : Install NATS Eventing components
124145 run : |
125146 set -x
126147 # TODO: this should use the release script and then apply the newly created release yaml in the future.
127148
128- # Install the nats channel
129- ko apply -f ./config/webhook
130- ko apply -f ./config/jetstream
131- ko apply -f ./config/broker
149+ ko apply --platform=linux/amd64 -f ./config/webhook
150+ ko apply --platform=linux/amd64 -f ./config/jetstream
151+ ko apply --platform=linux/amd64 -f ./config/broker
132152
133- - name : Wait for Ready
153+ - name : Wait for things to be up
134154 run : |
135155 set -e
136156 source ./vendor/knative.dev/hack/infra-library.sh
137157 wait_until_pods_running ${SYSTEM_NAMESPACE}
138-
158+
139159 # For debugging.
140160 kubectl get pods --all-namespaces
141161
142162 - name : Run e2e Tests
143163 run : |
144- set -x
145-
146164 # Run the tests tagged as e2e on the KinD cluster.
147- go test -v -race -count=1 -timeout=15m -tags=e2e ./test/e2e/...
165+ go test -race -count=1 -parallel=12 -timeout=90m -tags=e2e \
166+ ./test/e2e
148167
149- - name : Gather Failure Data
168+ - name : Collect system diagnostics
150169 if : ${{ failure() }}
151170 run : |
152- set -x
153-
154- echo "===================== Brokers =============================="
171+ echo '::group:: brokers'
155172 kubectl get broker --all-namespaces=true -oyaml
173+ echo '::endgroup::'
156174
157- echo "===================== Channels ============================="
175+ echo '::group:: channels'
158176 kubectl get channel --all-namespaces=true -oyaml
177+ echo '::endgroup::'
159178
160- echo "===================== Triggers ============================="
179+ echo '::group:: triggers'
161180 kubectl get trigger --all-namespaces=true -oyaml
181+ echo '::endgroup::'
162182
163- echo "===================== K8s Events ==========================="
164- kubectl get events --all-namespaces=true -oyaml
183+ echo '::group:: all pods'
184+ kubectl get pods --all-namespaces=true
185+ echo '::endgroup::'
186+
187+ for namespace in ${SYSTEM_NAMESPACE} nats-io; do
188+ echo "::group:: describe ${namespace} pods"
189+ kubectl -n "${namespace}" describe pods || true
190+ echo '::endgroup::'
191+
192+ for pod in $(kubectl -n "${namespace}" get pods -oname); do
193+ echo "::group:: ${namespace} ${pod} logs"
194+ kubectl -n "${namespace}" logs "${pod}" --all-containers || true
195+ echo '::endgroup::'
165196
166- echo "===================== Pod Logs ============================="
167- namespace=knative-eventing
168- for pod in $(kubectl get pod -n $namespace | awk '{print $1}'); do
169- for container in $(kubectl get pod "${pod}" -n $namespace -ojsonpath='{.spec.containers[*].name}'); do
170- echo "Namespace, Pod, Container: ${namespace}, ${pod}, ${container}"
171- kubectl logs -n $namespace "${pod}" -c "${container}" || true
172- echo "----------------------------------------------------------"
173- echo "Namespace, Pod, Container (Previous instance): ${namespace}, ${pod}, ${container}"
174- kubectl logs -p -n $namespace "${pod}" -c "${container}" || true
175- echo "============================================================"
197+ echo "::group:: ${namespace} ${pod} previous logs"
198+ kubectl -n "${namespace}" logs "${pod}" --all-containers --previous || true
199+ echo '::endgroup::'
176200 done
177201 done
178202
203+ echo '::group:: all events'
204+ kubectl get events --all-namespaces=true -oyaml
205+ echo '::endgroup::'
206+
179207 - name : Post failure notice to Slack
180208 # Note: using env.SLACK_WEBHOOK here because secrets are not allowed in the if block.
181209 if : ${{ env.SLACK_WEBHOOK != '' && failure() && github.event_name != 'pull_request' }}
182- uses : rtCamp/action-slack-notify@v2.1 .0
210+ uses : rtCamp/action-slack-notify@v2.4 .0
183211 env :
184- SLACK_ICON : http ://github.com/knative.png?size=48
212+ SLACK_ICON : https ://github.com/knative.png?size=48
185213 SLACK_USERNAME : github-actions
186214 SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
187215 SLACK_CHANNEL : ' eventing-delivery'
188216 MSG_MINIMAL : ' true'
189- SLACK_TITLE : Periodic e2e for Nats on kind on (${{ matrix.k8s-version }}, ${{ matrix.eventing-version }}) failed.
217+ SLACK_TITLE : Periodic e2e for NATS on KinD on (${{ matrix.k8s-version }}, ${{ matrix.eventing-version }}) failed.
190218 SLACK_MESSAGE : |
191219 For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
192-
0 commit comments