forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 7
379 lines (336 loc) · 15.6 KB
/
Copy pathconformance-mcs-api.yaml
File metadata and controls
379 lines (336 loc) · 15.6 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
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: Conformance MCS API (ci-mcs-api)
# Any change in triggers needs to be reflected in the concurrency group.
on:
workflow_dispatch:
inputs:
PR-number:
description: "Pull request number."
required: true
context-ref:
description: "Context in which the workflow runs. If PR is from a fork, will be the PR target branch (general case). If PR is NOT from a fork, will be the PR branch itself (this allows committers to test changes to workflows directly from PRs)."
required: true
SHA:
description: "SHA under test (head of the PR branch)."
required: true
base-SHA:
description: "SHA of the base branch (target branch of the PR)."
required: false
extra-args:
description: "[JSON object] Arbitrary arguments passed from the trigger comment via regex capture group. Parse with 'fromJson(inputs.extra-args).argName' in workflow."
required: false
default: "{}"
schedule:
- cron: '0 5/8 * * *'
# By specifying the access of one of the scopes, all of those that are not
# specified are set to 'none'.
permissions:
# To read actions state with cilium/workflow-telemetry-action
actions: read
# To be able to access the repository with actions/checkout
contents: read
# To allow retrieving information from the PR API
pull-requests: read
# To be able to set commit status
statuses: write
concurrency:
# Structure:
# - Workflow name
# - Event type
# - A unique identifier depending on event type:
# - schedule: SHA
# - workflow_dispatch: PR number
#
# This structure ensures a unique concurrency group name is generated for each
# type of testing, such that re-runs will cancel the previous run.
group: |
${{ github.workflow }}
${{ github.event_name }}
${{
(github.event_name == 'push' && github.sha) ||
(github.event_name == 'schedule' && github.sha) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.PR-number)
}}
cancel-in-progress: true
env:
clusterName1: cluster1-${{ github.run_id }}
clusterName2: cluster2-${{ github.run_id }}
contextName1: kind-cluster1-${{ github.run_id }}
contextName2: kind-cluster2-${{ github.run_id }}
timeout: 5m
jobs:
echo-inputs:
if: ${{ github.event_name == 'workflow_dispatch' }}
name: Echo Workflow Dispatch Inputs
runs-on: ${{ vars.UBUNTU_2404_2CPU_1GB || 'ubuntu-24.04' }}
steps:
- name: Echo Workflow Dispatch Inputs
run: |
echo '${{ tojson(inputs) }}'
commit-status-start:
name: Commit Status Start
runs-on: ${{ vars.UBUNTU_2404_2CPU_1GB || 'ubuntu-24.04' }}
steps:
- name: Set initial commit status
uses: cilium/actions/set-commit-status@fe0702f5df0d8e44d48f1baa226c023b73ff6b5e # main
with:
sha: ${{ inputs.SHA || github.sha }}
wait-for-images:
name: Wait for images
runs-on: ${{ vars.UBUNTU_2404_2CPU_1GB || 'ubuntu-24.04' }}
timeout-minutes: 30
steps:
- name: Checkout context ref (trusted)
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.context-ref || github.sha }}
persist-credentials: false
- name: Wait for images
uses: ./.github/actions/wait-for-images
with:
SHA: ${{ inputs.SHA || github.sha }}
images: cilium-ci operator-generic-ci clustermesh-apiserver-ci cilium-cli-ci
login-host: ${{ vars.DOCKER_READ_HOST }}
login-username: ${{ vars.DOCKER_READ_USERNAME }}
login-password: ${{ secrets.DOCKER_READ_PASSWORD }}
auth-required: ${{ vars.DOCKER_AUTH_REQUIRED }}
mcs-api-conformance-test:
name: MCS API Conformance Test
env:
job_name: "MCS API Conformance Test"
needs: [wait-for-images]
runs-on: ${{ vars.UBUNTU_2404_4CPU_16GB || 'ubuntu-24.04' }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
- name: '1'
steps:
- name: Set commit status to pending
uses: cilium/actions/set-commit-status@fe0702f5df0d8e44d48f1baa226c023b73ff6b5e # main
with:
sha: ${{ inputs.SHA || github.sha }}
- name: Collect Workflow Telemetry
uses: cilium/workflow-telemetry-action@b1a318f80a08acede58027afe1455d037379966f # v2.2.0
with:
comment_on_pr: false
- name: Checkout context ref (trusted)
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.context-ref || github.sha }}
persist-credentials: false
- name: Set Environment Variables
uses: ./.github/actions/set-env-variables
- name: Get Cilium's default values
id: default_vars
uses: ./.github/actions/helm-default
with:
image-tag: ${{ inputs.SHA || github.sha }}
registry_host: ${{ vars.DOCKER_READ_HOST }}
registry_organization: ${{ vars.DOCKER_READ_ORG }}
chart-dir: ./untrusted/install/kubernetes/cilium
image-pull-secret: "cilium-registry"
- name: Set up job variables for GHA environment
id: vars
run: |
echo sha=${{ steps.default_vars.outputs.sha }} >> $GITHUB_OUTPUT
CILIUM_INSTALL_DEFAULTS="${{ steps.default_vars.outputs.cilium_install_defaults }} \
--helm-set=kubeProxyReplacement=true \
--helm-set=clustermesh.useAPIServer=true \
--helm-set=clustermesh.config.enabled=true \
--helm-set=clustermesh.mcsapi.enabled=true \
--helm-set=clustermesh.mcsapi.corednsAutoConfigure.enabled=true \
--helm-set=clustermesh.enableEndpointSliceSynchronization=true \
"
echo cilium_install_defaults=${CILIUM_INSTALL_DEFAULTS} >> $GITHUB_OUTPUT
# Warning: since this is a privileged workflow, subsequent workflow job
# steps must take care not to execute untrusted code.
- name: Checkout pull request branch (NOT TRUSTED)
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.vars.outputs.sha }}
persist-credentials: false
# Required by checkout v7+ to fetch fork PR code; see the NOT TRUSTED warning above.
allow-unsafe-pr-checkout: true
path: untrusted
sparse-checkout: |
install/kubernetes/cilium
- name: Generate Kind configuration files
run: |
PODCIDR=10.242.0.0/16 \
SVCCIDR=10.243.0.0/16 \
IPFAMILY=ipv4 \
KUBEPROXYMODE=none \
envsubst < ./.github/kind-config.yaml.tmpl > ./.github/kind-config-cluster1.yaml
PODCIDR=10.244.0.0/16 \
SVCCIDR=10.245.0.0/16 \
IPFAMILY=ipv4 \
KUBEPROXYMODE=none \
envsubst < ./.github/kind-config.yaml.tmpl > ./.github/kind-config-cluster2.yaml
- name: Create Kind cluster 1
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
with:
cluster_name: ${{ env.clusterName1 }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ./.github/kind-config-cluster1.yaml
wait: 0 # The control-plane never becomes ready, since no CNI is present
- name: Create Kind cluster 2
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
with:
cluster_name: ${{ env.clusterName2 }}
version: ${{ env.KIND_VERSION }}
node_image: ${{ env.KIND_K8S_IMAGE }}
kubectl_version: ${{ env.KIND_K8S_VERSION }}
config: ./.github/kind-config-cluster2.yaml
wait: 0 # The control-plane never becomes ready, since no CNI is present
- name: Create imagePullSecrets
if: ${{ vars.DOCKER_AUTH_REQUIRED == 'true' }}
run: |
for context in ${{ env.contextName1 }} ${{ env.contextName2 }}; do
kubectl --context $context create secret docker-registry cilium-registry \
--namespace kube-system \
--docker-server=${{ vars.DOCKER_READ_HOST }} \
--docker-username="${{ vars.DOCKER_READ_USERNAME }}" \
--docker-password="${{ secrets.DOCKER_READ_PASSWORD }}"
done
- name: Install Cilium CLI
uses: cilium/cilium-cli@7ca7fc53c20275f5c10ef5f3557076691fd1d720 # v0.19.7
with:
skip-build: ${{ env.CILIUM_CLI_SKIP_BUILD }}
image-repo: ${{ env.CILIUM_CLI_IMAGE_REPO }}
image-tag: ${{ steps.vars.outputs.sha }}
repository: ${{ env.CILIUM_CLI_RELEASE_REPO }}
release-version: ${{ env.CILIUM_CLI_VERSION }}
- name: Install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
# renovate: datasource=golang-version depName=go
go-version: 1.26.5
- name: Install go-junit-report
timeout-minutes: 15
run: |
# renovate: datasource=github-releases depName=cilium/go-junit-report/v2/cmd/go-junit-report
go install github.com/cilium/go-junit-report/v2/cmd/go-junit-report@4cdc5c96cb4e406fccf943536b5bfcae7a0fb826 # v2.3.1
- name: Install Cilium in cluster1
id: install-cilium
run: |
# Let the NodePort to be selected randomly, to prevent the risk of conflicts.
cilium --context ${{ env.contextName1 }} install \
${{ steps.vars.outputs.cilium_install_defaults }} \
--helm-set cluster.name=${{ env.clusterName1 }} \
--helm-set cluster.id=1 \
--helm-set clustermesh.apiserver.service.nodePort=0
- name: Copy the Cilium CA secret to cluster2, as they must match
run: |
kubectl --context ${{ env.contextName1 }} get secret -n kube-system cilium-ca -o yaml |
kubectl --context ${{ env.contextName2 }} create -f -
- name: Install Cilium in cluster2
run: |
# Let the NodePort to be selected randomly, to prevent the risk of conflicts.
cilium --context ${{ env.contextName2 }} install \
${{ steps.vars.outputs.cilium_install_defaults }} \
--helm-set cluster.name=${{ env.clusterName2 }} \
--helm-set cluster.id=2 \
--helm-set clustermesh.apiserver.service.nodePort=0
- name: Wait for Cilium status to be ready
run: |
cilium --context ${{ env.contextName1 }} status --wait --interactive=false
cilium --context ${{ env.contextName2 }} status --wait --interactive=false
cilium --context ${{ env.contextName1 }} clustermesh status --wait
cilium --context ${{ env.contextName2 }} clustermesh status --wait
- name: Connect clusters
run: |
cilium --context ${{ env.contextName1 }} clustermesh connect --destination-context ${{ env.contextName2 }}
- name: Wait for cluster mesh status to be ready
run: |
cilium --context ${{ env.contextName1 }} status --wait --interactive=false
cilium --context ${{ env.contextName2 }} status --wait --interactive=false
cilium --context ${{ env.contextName1 }} clustermesh status --wait
cilium --context ${{ env.contextName2 }} clustermesh status --wait
- name: Run MCS API conformance test
id: mcs-api-conformance
timeout-minutes: 30
run: |
mkdir -p cilium-junits
LOG_CODEOWNERS=1 \
JUNIT_PATH="cilium-junits/${{ env.job_name }} (${{ join(matrix.*, ', ') }}) - mcs-api-conformance.xml" \
CODEOWNERS_PATH="${CILIUM_CLI_CODE_OWNERS_PATHS}" \
MCS_API_TEST_FLAGS="-contexts ${{ env.contextName1 }},${{ env.contextName2 }}" \
make mcs-api-conformance
- name: Run basic CLI tests (${{ join(matrix.*, ', ') }})
shell: bash
id: run-tests
run: |
mkdir -p cilium-junits
cilium connectivity test --include-unsafe-tests --collect-sysdump-on-failure \
--context=${{ env.contextName1 }} --multi-cluster=${{ env.contextName2 }} \
--sysdump-hubble-flows-count=1000000 --sysdump-hubble-flows-timeout=5m \
--sysdump-output-filename "cilium-sysdump-${{ join(matrix.*, '-') }}-<ts>" \
--junit-file "cilium-junits/${{ env.job_name }} (${{ join(matrix.*, ', ') }}).xml" \
--junit-property github_job_step="Run tests (${{ join(matrix.*, ', ') }})" \
--log-code-owners --code-owners=${CILIUM_CLI_CODE_OWNERS_PATHS} \
--exclude-code-owners=${CILIUM_CLI_EXCLUDE_OWNERS} \
--test 'allow-all-except-world,encryption,packet-drops'
- name: Post-test information gathering
if: ${{ !success() && steps.install-cilium.outcome != 'skipped' }}
run: |
cilium --context ${{ env.contextName1 }} status
cilium --context ${{ env.contextName1 }} clustermesh status
cilium --context ${{ env.contextName2 }} status
cilium --context ${{ env.contextName2 }} clustermesh status
kubectl config use-context ${{ env.contextName1 }}
kubectl get pods --all-namespaces -o wide
cilium sysdump --output-filename cilium-sysdump-context1-final-${{ matrix.name }}
kubectl config use-context ${{ env.contextName2 }}
kubectl get pods --all-namespaces -o wide
cilium sysdump --output-filename cilium-sysdump-context2-final-${{ matrix.name }}
shell: bash {0} # Disable default fail-fast behaviour so that all commands run independently
- name: Upload the HTML report artifact
if: ${{ always() && steps.mcs-api-conformance.outcome != 'skipped' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: report-${{ matrix.name }}.html
path: pkg/clustermesh/mcsapi/conformance/report.html
archive: false
retention-days: 5
if-no-files-found: ignore
- name: Upload the yaml report artifact
if: ${{ always() && steps.mcs-api-conformance.outcome != 'skipped' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: report-${{ matrix.name }}.yaml
path: pkg/clustermesh/mcsapi/conformance/report.yaml
archive: false
retention-days: 5
if-no-files-found: ignore
- name: Features tested on cluster 1
uses: ./.github/actions/feature-status
with:
cilium-cli: "cilium --context ${{ env.contextName1 }}"
title: "Summary of all features tested on cluster 1"
json-filename: "${{ env.job_name }} (${{ join(matrix.*, ', ') }}) - cluster 1"
- name: Features tested on cluster 2
uses: ./.github/actions/feature-status
with:
cilium-cli: "cilium --context ${{ env.contextName2 }}"
title: "Summary of all features tested on cluster 2"
json-filename: "${{ env.job_name }} (${{ join(matrix.*, ', ') }}) - cluster 2"
- name: Run common post steps
if: ${{ always() && steps.install-cilium.outcome != 'skipped' }}
uses: ./.github/actions/post-logic
with:
artifacts_suffix: "${{ env.job_name }} (${{ join(matrix.*, ', ') }})"
job_status: "${{ job.status }}"
capture_features_tested: false
merge-upload-and-status:
name: Merge Upload and Status
if: ${{ always() }}
needs: mcs-api-conformance-test
uses: ./.github/workflows/common-post-jobs.yaml
secrets: inherit
with:
context-ref: ${{ inputs.context-ref || github.sha }}
sha: ${{ inputs.SHA || github.sha }}
success: ${{ needs.mcs-api-conformance-test.result == 'success' }}