Skip to content

Commit 144547d

Browse files
committed
syz-cluster: use kubectl for one-off fetch kernels run
Refactor the cron job that pulls the base kernels once in a while to enable its manual triggering without installing the Argo CLI utility.
1 parent dc85d66 commit 144547d

File tree

6 files changed

+87
-63
lines changed

6 files changed

+87
-63
lines changed

syz-cluster/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ k8s-config-gke: ensure-spanner-database-uri-env ensure-blob-storage-env ensure-w
8787
migrate-job.yaml: ensure-spanner-database-uri-env
8888
@cat db-mgmt/migrate-job.yaml | IMAGE_PREFIX=${IMAGE_PREFIX} IMAGE_TAG=${IMAGE_TAG} envsubst
8989

90+
fetch-kernels-once.yaml:
91+
@cat kernel-disk/fetch-kernels-once.yaml
92+
9093
ensure-spanner-database-uri-env:
9194
@if [ -z "${SPANNER_DATABASE_URI}" ]; then \
9295
echo "Error: SPANNER_DATABASE_URI must be defined."; \

syz-cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ $ make k8s-config-dev | kubectl apply -f -
2727
```
2828
5. (Optional) Pre-fetch the kernel git repository:
2929
```
30-
$ argo submit --from cronwf/fetch-kernels-cron
30+
$ make fetch-kernels-once.yaml | kubectl create -f -
3131
```
3232

3333
## Developmental tips

syz-cluster/kernel-disk/fetch-kernels-cron.yaml

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,5 @@ spec:
1111
concurrencyPolicy: "Replace"
1212
startingDeadlineSeconds: 0
1313
workflowSpec:
14-
entrypoint: main
15-
podMetadata:
16-
labels:
17-
tier: workflow
18-
serviceAccountName: argo-executor-ksa
19-
templates:
20-
- name: main
21-
parallelism: 1
22-
steps:
23-
- - name: query-trees
24-
template: query-trees-template
25-
- - name: iterate-trees
26-
template: process-tree
27-
arguments:
28-
parameters:
29-
- name: tree
30-
value: "{{item}}"
31-
withParam: "{{=jsonpath(steps['query-trees'].outputs.result, '$.trees')}}"
32-
continueOn:
33-
failed: true
34-
- name: query-trees-template
35-
http:
36-
url: "http://controller-service:8080/trees"
37-
method: "GET"
38-
- name: process-tree
39-
inputs:
40-
parameters:
41-
- name: tree
42-
volumes:
43-
- name: git-repo
44-
persistentVolumeClaim:
45-
claimName: base-kernel-repo-pv-claim
46-
container:
47-
image: alpine/git:latest
48-
imagePullPolicy: IfNotPresent
49-
volumeMounts:
50-
- name: git-repo
51-
mountPath: /repo.git
52-
resources:
53-
requests:
54-
cpu: 4
55-
memory: 8G
56-
limits:
57-
cpu: 8
58-
memory: 16G
59-
command:
60-
- "/bin/sh"
61-
- "-c"
62-
- |
63-
cd /repo.git
64-
if [ ! -d "refs" ]; then
65-
git init --bare
66-
fi
67-
NAME="{{=jsonpath(inputs.parameters.tree, '$.name')}}"
68-
REPO="{{=jsonpath(inputs.parameters.tree, '$.URL')}}"
69-
BRANCH="{{=jsonpath(inputs.parameters.tree, '$.branch')}}"
70-
echo "${NAME}: ${REPO}/${BRANCH}"
71-
if ! git config --get remote.${NAME}.url > /dev/null; then
72-
git remote add ${NAME} ${REPO}
73-
fi
74-
git fetch ${NAME} ${BRANCH} --tags
75-
git tag -f ${NAME}-head ${NAME}/${BRANCH}
14+
workflowTemplateRef:
15+
name: fetch-kernels-workflow-template
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright 2025 syzkaller project authors. All rights reserved.
2+
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
3+
4+
apiVersion: argoproj.io/v1alpha1
5+
kind: Workflow
6+
metadata:
7+
generateName: fetch-kernels-manual-
8+
spec:
9+
workflowTemplateRef:
10+
name: fetch-kernels-workflow-template
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright 2025 syzkaller project authors. All rights reserved.
2+
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
3+
4+
apiVersion: argoproj.io/v1alpha1
5+
kind: WorkflowTemplate
6+
metadata:
7+
name: fetch-kernels-workflow-template
8+
spec:
9+
entrypoint: main
10+
podMetadata:
11+
labels:
12+
tier: workflow
13+
serviceAccountName: argo-executor-ksa
14+
templates:
15+
- name: main
16+
parallelism: 1
17+
steps:
18+
- - name: query-trees
19+
template: query-trees-template
20+
- - name: iterate-trees
21+
template: process-tree
22+
arguments:
23+
parameters:
24+
- name: tree
25+
value: "{{item}}"
26+
withParam: "{{=jsonpath(steps['query-trees'].outputs.result, '$.trees')}}"
27+
continueOn:
28+
failed: true
29+
- name: query-trees-template
30+
http:
31+
url: "http://controller-service:8080/trees"
32+
method: "GET"
33+
- name: process-tree
34+
inputs:
35+
parameters:
36+
- name: tree
37+
volumes:
38+
- name: git-repo
39+
persistentVolumeClaim:
40+
claimName: base-kernel-repo-pv-claim
41+
container:
42+
image: alpine/git:latest
43+
imagePullPolicy: IfNotPresent
44+
volumeMounts:
45+
- name: git-repo
46+
mountPath: /repo.git
47+
resources:
48+
requests:
49+
cpu: 4
50+
memory: 8G
51+
limits:
52+
cpu: 8
53+
memory: 16G
54+
command:
55+
- "/bin/sh"
56+
- "-c"
57+
- |
58+
cd /repo.git
59+
if [ ! -d "refs" ]; then
60+
git init --bare
61+
fi
62+
NAME="{{=jsonpath(inputs.parameters.tree, '$.name')}}"
63+
REPO="{{=jsonpath(inputs.parameters.tree, '$.URL')}}"
64+
BRANCH="{{=jsonpath(inputs.parameters.tree, '$.branch')}}"
65+
echo "${NAME}: ${REPO}/${BRANCH}"
66+
if ! git config --get remote.${NAME}.url > /dev/null; then
67+
git remote add ${NAME} ${REPO}
68+
fi
69+
git fetch ${NAME} ${BRANCH} --tags
70+
git tag -f ${NAME}-head ${NAME}/${BRANCH}

syz-cluster/kernel-disk/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
33

44
resources:
5+
- fetch-kernels-template.yaml
56
- fetch-kernels-cron.yaml

0 commit comments

Comments
 (0)