Skip to content

Commit 6cd6f81

Browse files
committed
feat(backend): Allow the launcher command to be configurable (kubeflow#11888)
This allows the launcher command to be overridden with the V2_LAUNCHER_COMMAND environment variable. This is useful if you need to override the command to launch Delve for debugging or you have a situation that requires using a different binary in the container image based on the environment. Signed-off-by: mprahl <[email protected]> (cherry picked from commit 70d2888)
1 parent c654567 commit 6cd6f81

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import (
1919
"encoding/hex"
2020
"encoding/json"
2121
"fmt"
22-
"github.com/kubeflow/pipelines/backend/src/apiserver/common"
2322
"strings"
2423

24+
"github.com/kubeflow/pipelines/backend/src/apiserver/common"
25+
2526
wfapi "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
2627
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
2728
"github.com/kubeflow/pipelines/backend/src/v2/compiler"
@@ -134,12 +135,13 @@ func Compile(jobArg *pipelinespec.PipelineJob, kubernetesSpecArg *pipelinespec.S
134135
wf: wf,
135136
templates: make(map[string]*wfapi.Template),
136137
// TODO(chensun): release process and update the images.
137-
launcherImage: GetLauncherImage(),
138-
driverImage: GetDriverImage(),
139-
driverCommand: GetDriverCommand(),
140-
job: job,
141-
spec: spec,
142-
executors: deploy.GetExecutors(),
138+
launcherImage: GetLauncherImage(),
139+
launcherCommand: GetLauncherCommand(),
140+
driverImage: GetDriverImage(),
141+
driverCommand: GetDriverCommand(),
142+
job: job,
143+
spec: spec,
144+
executors: deploy.GetExecutors(),
143145
}
144146

145147
mlPipelineTLSEnabled, err := GetMLPipelineServiceTLSEnabled()
@@ -182,6 +184,7 @@ type workflowCompiler struct {
182184
driverImage string
183185
driverCommand []string
184186
launcherImage string
187+
launcherCommand []string
185188
mlPipelineServiceTLSEnabled bool
186189
}
187190

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const (
3535
volumeNameCABundle = "ca-bundle"
3636
DefaultLauncherImage = "ghcr.io/kubeflow/kfp-launcher:2.4.0"
3737
LauncherImageEnvVar = "V2_LAUNCHER_IMAGE"
38+
LauncherCommandEnvVar = "V2_LAUNCHER_COMMAND"
39+
DefaultLauncherCommand = "launcher-v2"
3840
DefaultDriverImage = "ghcr.io/kubeflow/kfp-driver:2.4.0"
3941
DriverImageEnvVar = "V2_DRIVER_IMAGE"
4042
DefaultDriverCommand = "driver"
@@ -106,6 +108,14 @@ func GetDriverCommand() []string {
106108
return strings.Split(driverCommand, " ")
107109
}
108110

111+
func GetLauncherCommand() []string {
112+
launcherCommand := os.Getenv(LauncherCommandEnvVar)
113+
if launcherCommand == "" {
114+
launcherCommand = DefaultLauncherCommand
115+
}
116+
return strings.Split(launcherCommand, " ")
117+
}
118+
109119
func GetPipelineRunAsUser() *int64 {
110120
runAsUserStr := os.Getenv(PipelineRunAsUserEnvVar)
111121
if runAsUserStr == "" {
@@ -370,7 +380,7 @@ func (c *workflowCompiler) addContainerExecutorTemplate(refName string) string {
370380
Container: k8score.Container{
371381
Name: "kfp-launcher",
372382
Image: c.launcherImage,
373-
Command: []string{"launcher-v2"},
383+
Command: c.launcherCommand,
374384
Args: args,
375385
VolumeMounts: []k8score.VolumeMount{
376386
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (c *workflowCompiler) addImporterTemplate() string {
9999
},
100100
Container: &k8score.Container{
101101
Image: c.launcherImage,
102-
Command: []string{"launcher-v2"},
102+
Command: c.launcherCommand,
103103
Args: args,
104104
EnvFrom: []k8score.EnvFromSource{metadataEnvFrom},
105105
Env: commonEnvs,

0 commit comments

Comments
 (0)