Skip to content

Commit 57830bf

Browse files
authored
Merge pull request #19 from gregsheremeta/add-mounts-for-writeable-paths
UPSTREAM: <carry>: feat: mount EmptyDir volumes for launcher write locations
2 parents d48d383 + dfe6edc commit 57830bf

File tree

1 file changed

+84
-18
lines changed

1 file changed

+84
-18
lines changed

backend/src/v2/compiler/argocompiler/container.go

Lines changed: 84 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,21 @@ import (
2323
)
2424

2525
const (
26-
volumeNameKFPLauncher = "kfp-launcher"
27-
DefaultLauncherImage = "gcr.io/ml-pipeline/kfp-launcher@sha256:80cf120abd125db84fa547640fd6386c4b2a26936e0c2b04a7d3634991a850a4"
28-
LauncherImageEnvVar = "V2_LAUNCHER_IMAGE"
29-
DefaultDriverImage = "gcr.io/ml-pipeline/kfp-driver@sha256:8e60086b04d92b657898a310ca9757631d58547e76bbbb8bfc376d654bef1707"
30-
DriverImageEnvVar = "V2_DRIVER_IMAGE"
26+
volumeNameKFPLauncher = "kfp-launcher"
27+
DefaultLauncherImage = "gcr.io/ml-pipeline/kfp-launcher@sha256:80cf120abd125db84fa547640fd6386c4b2a26936e0c2b04a7d3634991a850a4"
28+
LauncherImageEnvVar = "V2_LAUNCHER_IMAGE"
29+
DefaultDriverImage = "gcr.io/ml-pipeline/kfp-driver@sha256:8e60086b04d92b657898a310ca9757631d58547e76bbbb8bfc376d654bef1707"
30+
DriverImageEnvVar = "V2_DRIVER_IMAGE"
31+
gcsScratchLocation = "/gcs"
32+
gcsScratchName = "gcs-scratch"
33+
s3ScratchLocation = "/s3"
34+
s3ScratchName = "s3-scratch"
35+
minioScratchLocation = "/minio"
36+
minioScratchName = "minio-scratch"
37+
dotLocalScratchLocation = "/.local"
38+
dotLocalScratchName = "dot-local-scratch"
39+
dotCacheScratchLocation = "/.cache"
40+
dotCacheScratchName = "dot-cache-scratch"
3141
)
3242

3343
func (c *workflowCompiler) Container(name string, component *pipelinespec.ComponentSpec, container *pipelinespec.PipelineDeploymentConfig_PipelineContainerSpec) error {
@@ -238,21 +248,55 @@ func (c *workflowCompiler) addContainerExecutorTemplate() string {
238248
// args come from. It is treated as a strategic merge patch on
239249
// top of the Pod spec.
240250
PodSpecPatch: inputValue(paramPodSpecPatch),
241-
Volumes: []k8score.Volume{{
242-
Name: volumeNameKFPLauncher,
243-
VolumeSource: k8score.VolumeSource{
244-
EmptyDir: &k8score.EmptyDirVolumeSource{},
251+
Volumes: []k8score.Volume{
252+
{
253+
Name: volumeNameKFPLauncher,
254+
VolumeSource: k8score.VolumeSource{
255+
EmptyDir: &k8score.EmptyDirVolumeSource{},
256+
},
245257
},
246-
}},
258+
{
259+
Name: gcsScratchName,
260+
VolumeSource: k8score.VolumeSource{
261+
EmptyDir: &k8score.EmptyDirVolumeSource{},
262+
},
263+
},
264+
{
265+
Name: s3ScratchName,
266+
VolumeSource: k8score.VolumeSource{
267+
EmptyDir: &k8score.EmptyDirVolumeSource{},
268+
},
269+
},
270+
{
271+
Name: minioScratchName,
272+
VolumeSource: k8score.VolumeSource{
273+
EmptyDir: &k8score.EmptyDirVolumeSource{},
274+
},
275+
},
276+
{
277+
Name: dotLocalScratchName,
278+
VolumeSource: k8score.VolumeSource{
279+
EmptyDir: &k8score.EmptyDirVolumeSource{},
280+
},
281+
},
282+
{
283+
Name: dotCacheScratchName,
284+
VolumeSource: k8score.VolumeSource{
285+
EmptyDir: &k8score.EmptyDirVolumeSource{},
286+
},
287+
},
288+
},
247289
InitContainers: []wfapi.UserContainer{{
248290
Container: k8score.Container{
249291
Name: "kfp-launcher",
250292
Image: GetLauncherImage(),
251293
Command: []string{"launcher-v2", "--copy", component.KFPLauncherPath},
252-
VolumeMounts: []k8score.VolumeMount{{
253-
Name: volumeNameKFPLauncher,
254-
MountPath: component.VolumePathKFPLauncher,
255-
}},
294+
VolumeMounts: []k8score.VolumeMount{
295+
{
296+
Name: volumeNameKFPLauncher,
297+
MountPath: component.VolumePathKFPLauncher,
298+
},
299+
},
256300
Resources: launcherResources,
257301
},
258302
}},
@@ -265,10 +309,32 @@ func (c *workflowCompiler) addContainerExecutorTemplate() string {
265309
// These are added to pass argo workflows linting.
266310
Image: "gcr.io/ml-pipeline/should-be-overridden-during-runtime",
267311
Command: []string{"should-be-overridden-during-runtime"},
268-
VolumeMounts: []k8score.VolumeMount{{
269-
Name: volumeNameKFPLauncher,
270-
MountPath: component.VolumePathKFPLauncher,
271-
}},
312+
VolumeMounts: []k8score.VolumeMount{
313+
{
314+
Name: volumeNameKFPLauncher,
315+
MountPath: component.VolumePathKFPLauncher,
316+
},
317+
{
318+
Name: gcsScratchName,
319+
MountPath: gcsScratchLocation,
320+
},
321+
{
322+
Name: s3ScratchName,
323+
MountPath: s3ScratchLocation,
324+
},
325+
{
326+
Name: minioScratchName,
327+
MountPath: minioScratchLocation,
328+
},
329+
{
330+
Name: dotLocalScratchName,
331+
MountPath: dotLocalScratchLocation,
332+
},
333+
{
334+
Name: dotCacheScratchName,
335+
MountPath: dotCacheScratchLocation,
336+
},
337+
},
272338
EnvFrom: []k8score.EnvFromSource{metadataEnvFrom},
273339
Env: commonEnvs,
274340
},

0 commit comments

Comments
 (0)