Skip to content

Commit af3fef8

Browse files
Merge pull request #77 from adambkaplan/update-build-volumes
SHIP-0022: Clarify API for Build Strategy Volumes
2 parents 6362115 + c1e8689 commit af3fef8

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

ships/0022-build-strategy-volumes.md

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ reviewers:
1212
- "@otaviof"
1313
- "@HeavyWombat"
1414
- "@imjasonh"
15+
- "@alicerum"
1516
approvers:
1617
- "@sbose78"
1718
- "@SaschaSchwarze0"
1819
creation-date: 2021-08-18
19-
last-updated: 2021-10-19
20+
last-updated: 2022-04-07
2021
status: implementable
2122
see-also: []
2223
replaces: []
@@ -100,7 +101,7 @@ If a `BuildRun` references a volume that does not exist (either directly or in i
100101
#### Deprecate Implicit emptyDir Volumes
101102

102103
Shipwright currently creates an implicit `emtpyDir` volume if one or more build steps declare a volume mount.
103-
This behavior should be deprecated as a prerequsite to releasing this feature.
104+
This behavior should be deprecated as a prerequisite to releasing this feature.
104105
Implicit emptyDir volumes can then be removed when this feature is released.
105106

106107
#### Strategy Volumes API
@@ -114,7 +115,7 @@ spec:
114115
buildSteps:
115116
- name: build
116117
image: quay.io/my-org/my-builder:latest
117-
volumeMounts:
118+
volumeMounts: # Existing k8s container volume mounts
118119
- name: build-metadata
119120
mountPath: /home/build/metadata
120121
- name: image-cache
@@ -123,23 +124,19 @@ spec:
123124
mountPath: /path/for/artifact/credentials.xml
124125
readOnly: true
125126
volumes:
126-
- name: build-metadata
127-
description: "Build metadata"
128-
optional: true
129-
volumeSource:
130-
type: EmptyDir # Type discriminator, this wil let us support new volume sources over time.
127+
- name: build-metadata # Name of the volume. Required, must be unique
128+
description: "Build metadata" # Description of the volume. Optional
129+
volumeSource: # Volume source specification - inherited from k8s VolumeSource API
131130
emptyDir: {}
132131
- name: image-cache
133-
description: "Container image cache"
132+
description: "Container image cache"
133+
overridable: true # If true, the volume source can be changed in a Build or BuildRun. Optional
134134
volumeSource:
135-
overridable: true # indicates the volume source can be different in a Build or BuildRun
136-
type: EmptyDir
137135
emptyDir: {}
138136
- name: artifact-creds
139137
description: "Private artifact repository credentials"
138+
overridable: true
140139
volumeSource:
141-
overridable: true
142-
type: EmptyDir
143140
emptyDir: {}
144141
```
145142
@@ -154,12 +151,10 @@ spec:
154151
volumes:
155152
- name: image-cache
156153
volumeSource:
157-
type: PersistentVolumeClaim # When overriding, the type can be changed
158154
persistentVolumeClaim:
159155
name: pvc-image-cache
160156
- name: artifact-creds
161157
volumeSource:
162-
type: Secret
163158
secret:
164159
secretName: artifact-creds # Inherited from Kubernetes VolumeSource API
165160
```
@@ -202,9 +197,8 @@ spec:
202197
...
203198
volumes:
204199
- name: var-lib-containers
200+
overridable: true
205201
volumeSource:
206-
overridable: true
207-
type: EmptyDir
208202
emtpyDir: {}
209203
```
210204

@@ -224,7 +218,6 @@ spec:
224218
volumes:
225219
- name: var-lib-containers
226220
volumeSource:
227-
type: PersistentVolumeClaim
228221
persistentVolumeClaim:
229222
name: shipwright-build-cache
230223
```
@@ -238,7 +231,7 @@ Testing will ensure that basic scenarios are covered:
238231

239232
1. Volume mounting Secrets and ConfigMaps
240233
2. Volume mounting Persistent Volumes
241-
3. Verifying BuildRuns succeed or fail of the `overridible` attribute is set to true/false.
234+
3. Verifying BuildRuns succeed or fail of the `overridable` attribute is set to true/false.
242235

243236
### Release Criteria
244237

@@ -257,6 +250,10 @@ Security is a concern with volumes, especially if arbitrary `HostPath` volume mo
257250
The [Pod Security Admission plugin](https://kubernetes.io/docs/concepts/security/pod-security-admission/)
258251
is a means to mitigate this issue, as it allows risky volume mounts to be blocked per namespace.
259252
Shipwright builds should document how this admission plugin and the volumes feature interact.
253+
This plugin graduated to beta in Kubernetes 1.23 (enabled by default).
254+
255+
If a TaskRun cannot create a Pod because the volume mount is denied, the `BuildRun` should report
256+
the failure reason in its status.
260257

261258
## Drawbacks
262259

@@ -302,3 +299,4 @@ No new infrastructure.
302299

303300
2021-08-18: Provisional SHIP proposal
304301
2021-10-19: Updated to implementable
302+
2022-04-07: Remove the `optional` and `type` fields in the API

0 commit comments

Comments
 (0)