Skip to content

Commit 39e021e

Browse files
committed
Enhance the README instructions
1 parent 0c13431 commit 39e021e

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

README.md

+29-14
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ We can mitigate this by providing a script that will wait for all ongoing builds
1717

1818
## Usage
1919

20+
### Option 1: Bake the script into your BuildKit image
21+
2022
1. Add [the `buildkit-prestop.sh` script](./buildkit-prestop.sh) to your BuildKit pod's container image. For example:
2123

2224
```Dockerfile
@@ -34,10 +36,34 @@ We can mitigate this by providing a script that will wait for all ongoing builds
3436
command: ["/usr/local/bin/buildkit-prestop.sh"]
3537
```
3638
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+
4053
```
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
4167
apiVersion: apps/v1
4268
kind: Deployment
4369
metadata:
@@ -69,17 +95,6 @@ Instead of extending the buildkit docker image, it's also possible to mount the
6995
name: buildkit-prestop-script
7096
defaultMode: 0777 # Ensure the script is executable
7197
```
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-
```
8398
8499
## How it works
85100

0 commit comments

Comments
 (0)