Skip to content

Commit

Permalink
feat(Tekton-compiler): Add env vars in kfp-driver to parametrize Obje…
Browse files Browse the repository at this point in the history
…ct storage host and port (#1378)

Co-authored-by: Tommy Li <[email protected]>
  • Loading branch information
rimolive and Tomcli authored Oct 19, 2023
1 parent 5ac8032 commit 7a14e32
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 1 deletion.
33 changes: 32 additions & 1 deletion backend/src/v2/compiler/tektoncompiler/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const (
MLPipelineServiceHost = "ml-pipeline.kubeflow.svc.cluster.local"
MLPipelineServicePort = "8887"
LauncherImage = "gcr.io/ml-pipeline/kfp-launcher@sha256:6641bf94acaeec03ee7e231241800fce2f0ad92eee25371bd5248ca800a086d7"
MinioServiceHost = "minio-service.kubeflow.svc.cluster.local"
MinioServicePort = "9000"
)

var (
Expand All @@ -47,6 +49,8 @@ var (
mlPipelineServiceHost = MLPipelineServiceHost
mlPipelineServicePort = MLPipelineServicePort
launcherImage = LauncherImage
minioServiceHost = MinioServiceHost
minioServicePort = MinioServicePort
)

func initEnvVars() {
Expand All @@ -70,11 +74,18 @@ func initEnvVars() {
if metadataGRPCServicePort == "" {
metadataGRPCServicePort = MetadataGPRCServicePort
}

launcherImage = os.Getenv("V2_LAUNCHER_IMAGE")
if launcherImage == "" {
launcherImage = LauncherImage
}
minioServiceHost = os.Getenv("MINIO_SERVICE_SERVICE_HOST")
if minioServiceHost == "" {
minioServiceHost = MinioServiceHost
}
minioServicePort = os.Getenv("MINIO_SERVICE_SERVICE_PORT")
if minioServicePort == "" {
minioServicePort = MinioServicePort
}
envVarInit = true
}

Expand Down Expand Up @@ -113,6 +124,20 @@ func GetLauncherImage() string {
return launcherImage
}

func GetMinioHost() string {
if !envVarInit {
initEnvVars()
}
return minioServiceHost
}

func GetMinioPort() string {
if !envVarInit {
initEnvVars()
}
return minioServicePort
}

// add KubernetesSpec for the container of the component
func (c *pipelinerunCompiler) AddKubernetesSpec(name string, kubernetesSpec *structpb.Struct) error {
err := c.saveKubernetesSpec(name, kubernetesSpec)
Expand Down Expand Up @@ -438,6 +463,12 @@ func (c *pipelinerunCompiler) containerExecutorTemplate(
}, {
Name: "ML_PIPELINE_SERVICE_PORT_GRPC",
Value: GetMLPipelinePort(),
}, {
Name: "MINIO_SERVICE_SERVICE_HOST",
Value: GetMinioHost(),
}, {
Name: "MINIO_SERVICE_SERVICE_PORT",
Value: GetMinioPort(),
}},
},
},
Expand Down
12 changes: 12 additions & 0 deletions backend/src/v2/compiler/tektoncompiler/testdata/exit_handler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -351,6 +355,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -507,6 +515,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down
12 changes: 12 additions & 0 deletions backend/src/v2/compiler/tektoncompiler/testdata/loop_static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -386,6 +390,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -587,6 +595,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -343,6 +347,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -477,6 +485,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -815,6 +827,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -1032,6 +1048,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -1193,6 +1213,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -1379,6 +1403,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -1506,6 +1534,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -1687,6 +1719,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down
16 changes: 16 additions & 0 deletions backend/src/v2/compiler/tektoncompiler/testdata/nestedloop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -399,6 +403,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -611,6 +619,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down Expand Up @@ -827,6 +839,10 @@ spec:
value: ml-pipeline.kubeflow.svc.cluster.local
- name: ML_PIPELINE_SERVICE_PORT_GRPC
value: "8887"
- name: MINIO_SERVICE_SERVICE_HOST
value: "minio-service.kubeflow.svc.cluster.local"
- name: MINIO_SERVICE_SERVICE_PORT
value: "9000"
envFrom:
- configMapRef:
name: metadata-grpc-configmap
Expand Down

0 comments on commit 7a14e32

Please sign in to comment.