Repository navigation
149 lines (131 loc) · 5.77 KB
/
Copy pathe2e-test.yaml
File metadata and controls
149 lines (131 loc) · 5.77 KB
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
name: e2e-test
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REPOSITORY: koperator_e2e_test
jobs:
build:
runs-on: ubuntu-26.04
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Clean workspace
run: |
# Remove any existing go.work files to ensure clean module resolution
rm -f go.work go.work.sum
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Setup Helm
uses: azure/setup-helm@v5
with:
version: '4.3.0' # renovate: datasource=github-releases depName=helm/helm
- name: Clean Go module cache
run: |
# Clean any existing Go module cache to avoid conflicts
# Use sudo to handle permission issues and force removal
sudo rm -rf ~/go/pkg/mod || true
sudo rm -rf ~/.cache/go-build || true
mkdir -p ~/go/pkg/mod
mkdir -p ~/.cache/go-build
# Ensure proper permissions
chmod -R 755 ~/go/pkg/mod
chmod -R 755 ~/.cache/go-build
# Enable Tmate Session to debug the E2E Kind Cluster
# Only activates when re-running the workflow in debug mode
- name: Setup tmate session
if: ${{ runner.debug == '1' }}
continue-on-error: true
uses: mxschmitt/action-tmate@v3
with:
detached: true
limit-access-to-actor: true
- name: Build docker image
run: |
IMG=$REPOSITORY:$GITHUB_SHA make docker-build
- name: Setup Kind cluster
id: setup-kind
uses: ./.github/actions/kind-create
- name: Load image into kind cluster
run: |
kind load docker-image $REPOSITORY:$GITHUB_SHA --name e2e-kind
- name: Download dependencies
run: |
# Download dependencies for all modules
go mod download
cd api && go mod download && cd ..
cd properties && go mod download && cd ..
cd tests/e2e && go mod download && cd ../..
- name: Run E2E tests
env:
KUBECONFIG: ${{ steps.setup-kind.outputs.kubeconfig }}
run: |
# Clean any existing go.work files to avoid workspace conflicts
rm -f go.work go.work.sum
IMG_E2E=$REPOSITORY:$GITHUB_SHA make test-e2e
# Dump cluster diagnostics on failure so e2e failures (e.g. a dependency Helm
# install that times out under `--atomic`) are debuggable from the job log
# without needing a live tmate session.
- name: Dump diagnostics on failure
if: failure()
env:
KUBECONFIG: ${{ steps.setup-kind.outputs.kubeconfig }}
run: |
set +e
echo "::group::nodes"
kubectl get nodes -o wide
echo "::endgroup::"
echo "::group::all pods"
kubectl get pods -A -o wide
echo "::endgroup::"
for ns in cert-manager projectcontour zookeeper prometheus kafka; do
echo "::group::namespace ${ns}"
kubectl get pods -n "${ns}" -o wide
echo "----- events (${ns}) -----"
kubectl get events -n "${ns}" --sort-by=.lastTimestamp | tail -50
echo "----- describe pods (${ns}) -----"
kubectl describe pods -n "${ns}"
echo "----- container logs (${ns}) -----"
for pod in $(kubectl get pods -n "${ns}" -o name); do
echo ">>> ${pod} (current) <<<"
kubectl logs -n "${ns}" "${pod}" --all-containers --tail=150 --timestamps
echo ">>> ${pod} (previous, if the container restarted) <<<"
kubectl logs -n "${ns}" "${pod}" --all-containers --previous --tail=150 --timestamps
done
echo "::endgroup::"
done
echo "::group::warning events (all namespaces)"
kubectl get events -A --field-selector type=Warning --sort-by=.lastTimestamp | tail -80
echo "::endgroup::"
# Broker/disk removal stalls are almost always a Cruise Control problem: a stuck CC
# Deployment rollout (two revisions racing) or a remove_broker task wedged InExecution.
# None of that is visible in the per-namespace pod dump above, so capture the koperator
# CRs and the CC rollout state explicitly.
echo "::group::kafka CRs + cruisecontrol rollout"
kubectl -n kafka get kafkacluster,cruisecontroloperation -o wide
echo "----- kafkacluster status.state -----"
kubectl -n kafka get kafkacluster -o jsonpath='{range .items[*]}{.metadata.name}{": "}{.status.state}{"\n"}{end}'
echo "----- cruisecontroloperation (yaml: currentTask.state / errorMessage) -----"
kubectl -n kafka get cruisecontroloperation -o yaml
echo "----- cruisecontrol deployment + replicasets (exposes stuck/duplicate revisions) -----"
kubectl -n kafka get deploy,rs -l app=cruisecontrol -o wide
kubectl -n kafka describe deploy -l app=cruisecontrol
echo "::endgroup::"
# Disk-removal stalls can also leave orphaned PVCs behind: a broker's old volume
# gets deleted once Cruise Control confirms removal, but the delete only completes
# once the pvc-protection finalizer clears (i.e. nothing still mounts it). `get -o wide`
# surfaces a stuck `Terminating` STATUS at a glance; `describe` shows the finalizers/
# deletionTimestamp and any FailedAttachVolume/VolumeFailedDelete events explaining why.
echo "::group::persistentvolumeclaims (kafka)"
kubectl -n kafka get pvc -o wide
echo "----- describe pvc (kafka) -----"
kubectl -n kafka describe pvc
echo "::endgroup::"
exit 0