Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPSTREAM: <carry>: feat: mount EmptyDir volumes for launcher write locations #19

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 84 additions & 18 deletions backend/src/v2/compiler/argocompiler/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ import (
)

const (
volumeNameKFPLauncher = "kfp-launcher"
DefaultLauncherImage = "gcr.io/ml-pipeline/kfp-launcher@sha256:80cf120abd125db84fa547640fd6386c4b2a26936e0c2b04a7d3634991a850a4"
LauncherImageEnvVar = "V2_LAUNCHER_IMAGE"
DefaultDriverImage = "gcr.io/ml-pipeline/kfp-driver@sha256:8e60086b04d92b657898a310ca9757631d58547e76bbbb8bfc376d654bef1707"
DriverImageEnvVar = "V2_DRIVER_IMAGE"
volumeNameKFPLauncher = "kfp-launcher"
DefaultLauncherImage = "gcr.io/ml-pipeline/kfp-launcher@sha256:80cf120abd125db84fa547640fd6386c4b2a26936e0c2b04a7d3634991a850a4"
LauncherImageEnvVar = "V2_LAUNCHER_IMAGE"
DefaultDriverImage = "gcr.io/ml-pipeline/kfp-driver@sha256:8e60086b04d92b657898a310ca9757631d58547e76bbbb8bfc376d654bef1707"
DriverImageEnvVar = "V2_DRIVER_IMAGE"
gcsScratchLocation = "/gcs"
gcsScratchName = "gcs-scratch"
s3ScratchLocation = "/s3"
s3ScratchName = "s3-scratch"
minioScratchLocation = "/minio"
minioScratchName = "minio-scratch"
dotLocalScratchLocation = "/.local"
dotLocalScratchName = "dot-local-scratch"
dotCacheScratchLocation = "/.cache"
dotCacheScratchName = "dot-cache-scratch"
)

func (c *workflowCompiler) Container(name string, component *pipelinespec.ComponentSpec, container *pipelinespec.PipelineDeploymentConfig_PipelineContainerSpec) error {
Expand Down Expand Up @@ -238,21 +248,55 @@ func (c *workflowCompiler) addContainerExecutorTemplate() string {
// args come from. It is treated as a strategic merge patch on
// top of the Pod spec.
PodSpecPatch: inputValue(paramPodSpecPatch),
Volumes: []k8score.Volume{{
Name: volumeNameKFPLauncher,
VolumeSource: k8score.VolumeSource{
EmptyDir: &k8score.EmptyDirVolumeSource{},
Volumes: []k8score.Volume{
{
Name: volumeNameKFPLauncher,
VolumeSource: k8score.VolumeSource{
EmptyDir: &k8score.EmptyDirVolumeSource{},
},
},
}},
{
Name: gcsScratchName,
VolumeSource: k8score.VolumeSource{
EmptyDir: &k8score.EmptyDirVolumeSource{},
},
},
{
Name: s3ScratchName,
VolumeSource: k8score.VolumeSource{
EmptyDir: &k8score.EmptyDirVolumeSource{},
},
},
{
Name: minioScratchName,
VolumeSource: k8score.VolumeSource{
EmptyDir: &k8score.EmptyDirVolumeSource{},
},
},
{
Name: dotLocalScratchName,
VolumeSource: k8score.VolumeSource{
EmptyDir: &k8score.EmptyDirVolumeSource{},
},
},
{
Name: dotCacheScratchName,
VolumeSource: k8score.VolumeSource{
EmptyDir: &k8score.EmptyDirVolumeSource{},
},
},
},
InitContainers: []wfapi.UserContainer{{
Container: k8score.Container{
Name: "kfp-launcher",
Image: GetLauncherImage(),
Command: []string{"launcher-v2", "--copy", component.KFPLauncherPath},
VolumeMounts: []k8score.VolumeMount{{
Name: volumeNameKFPLauncher,
MountPath: component.VolumePathKFPLauncher,
}},
VolumeMounts: []k8score.VolumeMount{
{
Name: volumeNameKFPLauncher,
MountPath: component.VolumePathKFPLauncher,
},
},
Resources: launcherResources,
},
}},
Expand All @@ -265,10 +309,32 @@ func (c *workflowCompiler) addContainerExecutorTemplate() string {
// These are added to pass argo workflows linting.
Image: "gcr.io/ml-pipeline/should-be-overridden-during-runtime",
Command: []string{"should-be-overridden-during-runtime"},
VolumeMounts: []k8score.VolumeMount{{
Name: volumeNameKFPLauncher,
MountPath: component.VolumePathKFPLauncher,
}},
VolumeMounts: []k8score.VolumeMount{
{
Name: volumeNameKFPLauncher,
MountPath: component.VolumePathKFPLauncher,
},
{
Name: gcsScratchName,
MountPath: gcsScratchLocation,
},
{
Name: s3ScratchName,
MountPath: s3ScratchLocation,
},
{
Name: minioScratchName,
MountPath: minioScratchLocation,
},
{
Name: dotLocalScratchName,
MountPath: dotLocalScratchLocation,
},
{
Name: dotCacheScratchName,
MountPath: dotCacheScratchLocation,
},
},
EnvFrom: []k8score.EnvFromSource{metadataEnvFrom},
Env: commonEnvs,
},
Expand Down
Loading