@@ -17,6 +17,8 @@ We can mitigate this by providing a script that will wait for all ongoing builds
17
17
18
18
## Usage
19
19
20
+ ### Option 1: Bake the script into your BuildKit image
21
+
20
22
1 . Add [ the ` buildkit-prestop.sh ` script] ( ./buildkit-prestop.sh ) to your BuildKit pod's container image. For example:
21
23
22
24
``` Dockerfile
@@ -34,10 +36,34 @@ We can mitigate this by providing a script that will wait for all ongoing builds
34
36
command: ["/usr/local/bin/buildkit-prestop.sh"]
35
37
```
36
38
37
- #### Alternative usage via configmap
38
- Instead of extending the buildkit docker image, it' s also possible to mount the preStop script inside the pod, via a configmap:
39
- 1. Add this to your BuildKit deployment manifest:
39
+ ### Option 2: Mount the script with a ConfigMap
40
+
41
+ Instead of extending the buildkit docker image, it' s also possible to mount the preStop script inside the pod via a `ConfigMap`:
42
+
43
+ 1. Download [the `buildkit-prestop.sh` script](./buildkit-prestop.sh) to your local machine.
44
+
45
+ 2. Create a `ConfigMap` from that file:
46
+
47
+ ```bash
48
+ kubectl create configmap buildkit-prestop-script --from-file=buildkit-prestop.sh
49
+ ```
50
+
51
+ Which should create a ` ConfigMap ` named ` buildkit-prestop-script ` :
52
+
40
53
```
54
+ apiVersion: v1
55
+ kind: ConfigMap
56
+ metadata:
57
+ name: buildkit-prestop-script
58
+ data:
59
+ buildkit-prestop.sh: |
60
+ #!/bin/bash
61
+ ...
62
+ ```
63
+
64
+ 3 . Update your BuildKit ` Deployment ` manifest to mount the ` ConfigMap ` as a volume and reference the script:
65
+
66
+ ``` yaml
41
67
apiVersion : apps/v1
42
68
kind : Deployment
43
69
metadata :
@@ -69,17 +95,6 @@ Instead of extending the buildkit docker image, it's also possible to mount the
69
95
name : buildkit-prestop-script
70
96
defaultMode : 0777 # Ensure the script is executable
71
97
` ` `
72
- 2. Create the configmap with the script in this repo:
73
- ```
74
- apiVersion: v1
75
- kind: ConfigMap
76
- metadata:
77
- name: buildkit-prestop-script
78
- data:
79
- buildkit-prestop.sh: |
80
- #!/bin/bash
81
- ...
82
- ```
83
98
84
99
## How it works
85
100
0 commit comments