Skip to content

Commit 67fa96f

Browse files
Merge pull request #158 from mprahl/kfp-launcher-binary-location-odh
Cherry-pick: Allow the launcher command to be configurable (kubeflow#11888)
2 parents c654567 + 141697f commit 67fa96f

File tree

6 files changed

+29
-112
lines changed

6 files changed

+29
-112
lines changed

.github/workflows/backend.yml

Lines changed: 0 additions & 96 deletions
This file was deleted.

backend/Dockerfile.driver

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
# Build arguments
1616
ARG SOURCE_CODE=.
1717

18-
# Use ubi8/nodejs-14 as base image
19-
FROM registry.access.redhat.com/ubi8/go-toolset:1.22 as builder
18+
FROM registry.access.redhat.com/ubi9/go-toolset:1.22 as builder
2019

2120

2221
## Build args to be used at this step
@@ -37,7 +36,7 @@ COPY ${SOURCE_CODE}/ ./
3736

3837
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-extldflags "-static"' -o /bin/driver ./backend/src/v2/cmd/driver/*.go
3938

40-
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
39+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5
4140

4241
WORKDIR /bin
4342

backend/Dockerfile.launcher

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ ARG SOURCE_CODE=.
1717
ARG CI_CONTAINER_VERSION="unknown"
1818

1919

20-
# Use ubi8/nodejs-14 as base image
21-
FROM registry.access.redhat.com/ubi8/go-toolset:1.22 as builder
20+
FROM registry.access.redhat.com/ubi9/go-toolset:1.22 as builder
2221

2322

2423
## Build args to be used at this step
@@ -38,13 +37,15 @@ RUN GO111MODULE=on go mod download
3837
COPY ${SOURCE_CODE}/ ./
3938

4039
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-extldflags "-static"' -o /bin/launcher-v2 ./backend/src/v2/cmd/launcher-v2/*.go
40+
RUN GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=amd64 GOEXPERIMENT=strictfipsruntime go build -tags 'netgo strictfipsruntime' -o /bin/launcher-v2-fips ./backend/src/v2/cmd/launcher-v2/*.go
4141

42-
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
42+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5
4343

4444
WORKDIR /bin
4545

4646
COPY --from=builder /bin/launcher-v2 /bin/launcher-v2
47-
RUN chmod +x /bin/launcher-v2
47+
COPY --from=builder /bin/launcher-v2-fips /bin/launcher-v2-fips
48+
RUN chmod +x /bin/launcher-v2 && chmod +x /bin/launcher-v2-fips
4849

4950
ENTRYPOINT ["/bin/launcher-v2"]
5051

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)