Debian Codegraph @

.github/workflows/e2e.yaml

raw
1 name: e2e
2
3 on:
4 push:
5 branches:
6 - 'master'
7 tags:
8 - 'v*'
9 pull_request:
10 branches: [ master ]
11 workflow_dispatch:
12
13 env:
14 GO_TOOLCHAIN: "golang"
15 # TODO: match BASEIMAGE with Makefile default (nonroot variant)
16 BASEIMAGE: "gcr.io/distroless/static-debian12"
17 KIND_CLUSTER_NAME: "kind"
18 KIND_VERSION: "v0.29.0"
19
20 jobs:
21 build:
22 name: build
23 runs-on: ubuntu-24.04
24 steps:
25 - name: Check out code
26 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
27 - name: Set up Go
28 uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c #v6.4.0
29 with:
30 go-version-file: go.mod
31 id: go
32 - name: Build
33 run: |
34 mkdir _output
35
36 make docker-build/proxy-agent-amd64 REGISTRY=gcr.io/k8s-staging-kas-network-proxy TAG=local BASEIMAGE=${{ env.BASEIMAGE }}
37 docker tag gcr.io/k8s-staging-kas-network-proxy/proxy-agent-amd64:local gcr.io/k8s-staging-kas-network-proxy/proxy-agent:master
38 docker save gcr.io/k8s-staging-kas-network-proxy/proxy-agent:master > _output/konnectivity-agent.tar
39 make docker-build/proxy-server-amd64 REGISTRY=gcr.io/k8s-staging-kas-network-proxy TAG=local BASEIMAGE=${{ env.BASEIMAGE }}
40 docker tag gcr.io/k8s-staging-kas-network-proxy/proxy-server-amd64:local gcr.io/k8s-staging-kas-network-proxy/proxy-server:master
41 docker save gcr.io/k8s-staging-kas-network-proxy/proxy-server:master > _output/konnectivity-server.tar
42
43 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1
44 with:
45 name: konnectivity-server
46 path: _output/konnectivity-server.tar
47
48 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1
49 with:
50 name: konnectivity-agent
51 path: _output/konnectivity-agent.tar
52 kind-e2e:
53 name: kind-e2e
54 runs-on: ubuntu-24.04
55 timeout-minutes: 100
56 needs:
57 - build
58 env:
59 REGISTRY: gcr.io/k8s-staging-kas-network-proxy
60 KIND_IMAGE: kindest/node:${{ matrix.k8s }}
61 TAG: master
62 CONNECTION_MODE: ${{ matrix.connection-mode }}
63 strategy:
64 fail-fast: false
65 matrix:
66 # https://hub.docker.com/r/kindest/node/tags
67 k8s: [ v1.33.7, v1.34.3, v1.35.1 ]
68 connection-mode: [ grpc, http-connect ]
69 steps:
70 - name: Install kind
71 run: |
72 curl -Lo ./kind https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64
73 chmod +x ./kind
74 sudo mv ./kind /usr/local/bin/kind
75 - name: Check out code
76 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
77 - name: Set up Go
78 uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c #v6.4.0
79 with:
80 go-version-file: go.mod
81 id: go
82 - name: Download prebuilt konnectivity-server image
83 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c #v8.0.1
84 with:
85 name: konnectivity-server
86 - name: Download prebuilt konnectivity-agent image
87 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c #v8.0.1
88 with:
89 name: konnectivity-agent
90 - name: Load prebuilt konnectivity images
91 run: |
92 docker load --input konnectivity-server.tar
93 docker load --input konnectivity-agent.tar
94 - name: Fix konnectivity docker image tags
95 run: |
96 docker tag gcr.io/k8s-staging-kas-network-proxy/proxy-server:master gcr.io/k8s-staging-kas-network-proxy/proxy-server-amd64:master
97 docker tag gcr.io/k8s-staging-kas-network-proxy/proxy-agent:master gcr.io/k8s-staging-kas-network-proxy/proxy-agent-amd64:master
98 - name: Run e2e tests
99 run: make test-e2e-ci
100 e2e:
101 name: e2e
102 runs-on: ubuntu-24.04
103 timeout-minutes: 100
104 needs:
105 - build
106 strategy:
107 fail-fast: false
108 matrix:
109 ipFamily: ["ipv4", "ipv6", "dual"]
110 # https://hub.docker.com/r/kindest/node/tags
111 k8s: [ v1.33.7, v1.34.3, v1.35.1 ]
112 env:
113 JOB_NAME: "kindnetd-e2e-${{ matrix.ipFamily }}"
114 IP_FAMILY: ${{ matrix.ipFamily }}
115 steps:
116 - name: Check out code
117 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
118
119 - name: Enable ipv4 and ipv6 forwarding
120 run: |
121 sudo sysctl -w net.ipv6.conf.all.forwarding=1
122 sudo sysctl -w net.ipv4.ip_forward=1
123
124 - name: Set up environment (download dependencies)
125 run: |
126 TMP_DIR=$(mktemp -d)
127 # Test binaries
128 curl -L https://dl.k8s.io/${{ matrix.k8s }}/kubernetes-test-linux-amd64.tar.gz -o ${TMP_DIR}/kubernetes-test-linux-amd64.tar.gz
129 tar xvzf ${TMP_DIR}/kubernetes-test-linux-amd64.tar.gz \
130 --directory ${TMP_DIR} \
131 --strip-components=3 kubernetes/test/bin/ginkgo kubernetes/test/bin/e2e.test
132 # kubectl
133 curl -L https://dl.k8s.io/${{ matrix.k8s }}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl
134 # kind
135 curl -Lo ${TMP_DIR}/kind https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64
136 # Install
137 sudo cp ${TMP_DIR}/ginkgo /usr/local/bin/ginkgo
138 sudo cp ${TMP_DIR}/e2e.test /usr/local/bin/e2e.test
139 sudo cp ${TMP_DIR}/kubectl /usr/local/bin/kubectl
140 sudo cp ${TMP_DIR}/kind /usr/local/bin/kind
141 sudo chmod +x /usr/local/bin/ginkgo /usr/local/bin/e2e.test /usr/local/bin/kubectl /usr/local/bin/kind
142
143 - name: Create multi node cluster
144 run: |
145 # output_dir
146 mkdir -p _artifacts
147 # create cluster
148 cat <<EOF | /usr/local/bin/kind create cluster \
149 --name ${{ env.KIND_CLUSTER_NAME}} \
150 --image kindest/node:${{ matrix.k8s }} \
151 -v7 --wait 1m --retain --config=-
152 kind: Cluster
153 apiVersion: kind.x-k8s.io/v1alpha4
154 networking:
155 ipFamily: ${IP_FAMILY}
156 nodes:
157 - role: control-plane
158 image: ${{ matrix.k8s }}
159 kubeadmConfigPatchesJSON6902:
160 - kind: ClusterConfiguration
161 patch: |
162 - op: add
163 path: /apiServer/certSANs/-
164 value: konnectivity-server.kube-system.svc.cluster.local
165 kubeadmConfigPatches:
166 - |
167 kind: ClusterConfiguration
168 apiServer:
169 extraArgs:
170 "egress-selector-config-file": "/etc/kubernetes/konnectivity-server-config/egress_selector_configuration.yaml"
171 extraVolumes:
172 - name: egress-selector-config-file
173 hostPath: "/etc/kubernetes/konnectivity-server-config/egress_selector_configuration.yaml"
174 mountPath: "/etc/kubernetes/konnectivity-server-config/egress_selector_configuration.yaml"
175 readOnly: true
176 - name: konnectivity-server
177 hostPath: "/etc/kubernetes/konnectivity-server"
178 mountPath: "/etc/kubernetes/konnectivity-server"
179 readOnly: true
180 extraMounts:
181 - hostPath: ./examples/kind/egress_selector_configuration.yaml
182 containerPath: /etc/kubernetes/konnectivity-server-config/egress_selector_configuration.yaml
183 - role: worker
184 image: ${{ matrix.k8s }}
185 - role: worker
186 image: ${{ matrix.k8s }}
187 EOF
188
189 # dump the kubeconfig for later
190 /usr/local/bin/kind get kubeconfig --name ${{ env.KIND_CLUSTER_NAME}} > _artifacts/kubeconfig.conf
191
192 - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c #v8.0.1
193 with:
194 name: konnectivity-server
195
196 - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c #v8.0.1
197 with:
198 name: konnectivity-agent
199
200 - name: Install konnectivity
201 run: |
202 # preload konnectivity images
203 docker load --input konnectivity-server.tar
204 docker load --input konnectivity-agent.tar
205 /usr/local/bin/kind load docker-image gcr.io/k8s-staging-kas-network-proxy/proxy-server:master --name ${{ env.KIND_CLUSTER_NAME}}
206 /usr/local/bin/kind load docker-image gcr.io/k8s-staging-kas-network-proxy/proxy-agent:master --name ${{ env.KIND_CLUSTER_NAME}}
207 kubectl apply -f examples/kind/konnectivity-server.yaml
208 kubectl apply -f examples/kind/konnectivity-agent-ds.yaml
209
210 - name: Get Cluster status
211 run: |
212 # wait network is ready
213 sleep 5
214 /usr/local/bin/kubectl get nodes -o wide
215 /usr/local/bin/kubectl get pods -A
216 /usr/local/bin/kubectl wait --timeout=1m --for=condition=ready pods --namespace=kube-system -l k8s-app=kube-dns
217 # smoke test
218 /usr/local/bin/kubectl run test --image httpd:2
219 /usr/local/bin/kubectl wait --timeout=1m --for=condition=ready pods test
220 /usr/local/bin/kubectl get pods -A -owide
221 /usr/local/bin/kubectl wait --timeout=1m --for=condition=ready pods --namespace=kube-system -l k8s-app=konnectivity-agent
222 /usr/local/bin/kubectl logs test
223
224
225 - name: Workaround CoreDNS for IPv6 airgapped
226 if: ${{ matrix.ipFamily == 'ipv6' }}
227 run: |
228 # Patch CoreDNS to work in Github CI
229 # 1. Github CI doesn´t offer IPv6 connectivity, so CoreDNS should be configured
230 # to work in an offline environment:
231 # https://github.com/coredns/coredns/issues/2494#issuecomment-457215452
232 # 2. Github CI adds following domains to resolv.conf search field:
233 # .net.
234 # CoreDNS should handle those domains and answer with NXDOMAIN instead of SERVFAIL
235 # otherwise pods stops trying to resolve the domain.
236 # Get the current config
237 original_coredns=$(/usr/local/bin/kubectl get -oyaml -n=kube-system configmap/coredns)
238 echo "Original CoreDNS config:"
239 echo "${original_coredns}"
240 # Patch it
241 fixed_coredns=$(
242 printf '%s' "${original_coredns}" | sed \
243 -e 's/^.*kubernetes cluster\.local/& net/' \
244 -e '/^.*upstream$/d' \
245 -e '/^.*fallthrough.*$/d' \
246 -e '/^.*forward . \/etc\/resolv.conf$/d' \
247 -e '/^.*loop$/d' \
248 )
249 echo "Patched CoreDNS config:"
250 echo "${fixed_coredns}"
251 printf '%s' "${fixed_coredns}" | /usr/local/bin/kubectl apply -f -
252
253 - name: Run tests
254 run: |
255 export KUBERNETES_CONFORMANCE_TEST='y'
256 export E2E_REPORT_DIR=${PWD}/_artifacts
257
258 # Run tests
259 /usr/local/bin/ginkgo --nodes=25 \
260 --focus="\[Conformance\]" \
261 --skip="Feature|Federation|machinery|PerformanceDNS|DualStack|Disruptive|Serial|Slow|KubeProxy|LoadBalancer|GCE|Netpol|NetworkPolicy|NodeConformance" \
262 /usr/local/bin/e2e.test \
263 -- \
264 --kubeconfig=${PWD}/_artifacts/kubeconfig.conf \
265 --provider=local \
266 --dump-logs-on-failure=false \
267 --report-dir=${E2E_REPORT_DIR} \
268 --disable-log-dump=true
269
270 - name: Upload Junit Reports
271 if: always()
272 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1
273 with:
274 name: kind-junit-${{ env.JOB_NAME }}-${{ matrix.k8s }}-${{ matrix.ipFamily }}-${{ github.run_id }}
275 path: './_artifacts/*.xml'
276
277 - name: Export logs
278 if: always()
279 run: |
280 /usr/local/bin/kind export logs --name ${KIND_CLUSTER_NAME} -v 4 ./_artifacts/logs
281
282 - name: Upload logs
283 if: always()
284 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1
285 with:
286 name: kind-logs-${{ env.JOB_NAME }}-${{ matrix.k8s }}-${{ matrix.ipFamily }}-${{ github.run_id }}
287 path: ./_artifacts/logs