Skip to content

Commit b3d6b91

Browse files
author
arpechenin
committed
- rebase master
- fix tests Signed-off-by: arpechenin <[email protected]>
1 parent 35562a6 commit b3d6b91

File tree

11 files changed

+92
-37
lines changed

11 files changed

+92
-37
lines changed

backend/Dockerfile.driver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ RUN GO111MODULE=on go mod download
2727

2828
COPY . .
2929

30-
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -tags netgo -gcflags="${GCFLAGS}" -ldflags '-extldflags "-static"' -o /bin/driver ./backend/src/v2/cmd/driver/*.go
30+
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -tags netgo -gcflags="${GCFLAGS}" -ldflags '-extldflags "-static"' -o /bin/driver ./backend/src/driver/*.go
3131

3232
FROM alpine:3.19
3333

backend/src/driver/api/request.go

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
package api
22

33
type DriverPluginArgs struct {
4-
CachedDecisionPath string `json:"cached_decision_path"`
5-
Component string `json:"component,omitempty"`
6-
Container string `json:"container,omitempty"`
7-
RunMetadata string `json:"run_metadata,omitempty"`
8-
DagExecutionID string `json:"dag_execution_id"`
9-
IterationIndex string `json:"iteration_index"`
10-
HttpProxy string `json:"http_proxy"`
11-
HttpsProxy string `json:"https_proxy"`
12-
NoProxy string `json:"no_proxy"`
13-
KubernetesConfig string `json:"kubernetes_config,omitempty"`
14-
RuntimeConfig string `json:"runtime_config,omitempty"`
15-
PipelineName string `json:"pipeline_name"`
16-
RunID string `json:"run_id"`
17-
RunName string `json:"run_name"`
18-
RunDisplayName string `json:"run_display_name"`
19-
TaskName string `json:"task_name"`
20-
Task string `json:"task"`
21-
Type string `json:"type"`
22-
CacheDisabledFlag bool `json:"cache_disabled"`
23-
PublishLogs string `json:"publish_logs"`
24-
ExecutionIdPath string `json:"execution_id_path"`
25-
IterationCountPath string `json:"iteration_count_path"`
26-
ConditionPath string `json:"condition_path"`
27-
PodSpecPathPath string `json:"pod_spec_patch_path"`
4+
CachedDecisionPath string `json:"cached_decision_path"`
5+
Component string `json:"component,omitempty"`
6+
Container string `json:"container,omitempty"`
7+
DagExecutionID string `json:"dag_execution_id"`
8+
IterationIndex string `json:"iteration_index"`
9+
HttpProxy string `json:"http_proxy"`
10+
HttpsProxy string `json:"https_proxy"`
11+
NoProxy string `json:"no_proxy"`
12+
KubernetesConfig string `json:"kubernetes_config,omitempty"`
13+
RuntimeConfig string `json:"runtime_config,omitempty"`
14+
PipelineName string `json:"pipeline_name"`
15+
PublishLogs string `json:"publish_logs,omitempty"`
16+
RunID string `json:"run_id"`
17+
RunName string `json:"run_name"`
18+
RunDisplayName string `json:"run_display_name"`
19+
TaskName string `json:"task_name"`
20+
Task string `json:"task"`
21+
Type string `json:"type"`
22+
CacheDisabledFlag bool `json:"cache_disabled"`
23+
ExecutionIdPath string `json:"execution_id_path"`
24+
IterationCountPath string `json:"iteration_count_path"`
25+
ConditionPath string `json:"condition_path"`
26+
PodSpecPathPath string `json:"pod_spec_patch_path"`
27+
MlPipelineTLSEnabled bool `json:"ml_pipeline_tls_enabled"`
28+
MetadataTLSEnabled bool `json:"metadata_tls_enabled"`
29+
CACertPath string `json:"ca_cert_path"`
2830
}
2931

3032
type DriverPlugin struct {

backend/src/driver/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ package main
1515

1616
import (
1717
"bytes"
18+
"crypto/tls"
1819
"encoding/json"
1920
"flag"
2021
"fmt"
@@ -168,11 +169,11 @@ func writeFile(path string, data []byte) (err error) {
168169
return os.WriteFile(path, data, 0o644)
169170
}
170171

171-
func newMlmdClient() (*metadata.Client, error) {
172+
func newMlmdClient(tlsCfg *tls.Config) (*metadata.Client, error) {
172173
mlmdConfig := metadata.DefaultConfig()
173174
if *mlmdServerAddress != "" && *mlmdServerPort != "" {
174175
mlmdConfig.Address = *mlmdServerAddress
175176
mlmdConfig.Port = *mlmdServerPort
176177
}
177-
return metadata.NewClient(mlmdConfig.Address, mlmdConfig.Port)
178+
return metadata.NewClient(mlmdConfig.Address, mlmdConfig.Port, tlsCfg)
178179
}

backend/src/driver/rpc_handler.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ package main
22

33
import (
44
"context"
5+
"crypto/tls"
56
"encoding/json"
67
"fmt"
8+
"io"
9+
"net/http"
10+
"strconv"
11+
712
"github.com/golang/glog"
813
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
914
"github.com/kubeflow/pipelines/backend/src/apiserver/config/proxy"
@@ -13,9 +18,6 @@ import (
1318
"github.com/kubeflow/pipelines/backend/src/v2/config"
1419
"github.com/kubeflow/pipelines/backend/src/v2/driver"
1520
"google.golang.org/protobuf/encoding/protojson"
16-
"io"
17-
"net/http"
18-
"strconv"
1921
)
2022

2123
func ExecutePlugin(w http.ResponseWriter, r *http.Request) {
@@ -155,11 +157,16 @@ func drive(args api.DriverPluginArgs) (execution *driver.Execution, err error) {
155157
if err != nil {
156158
return nil, err
157159
}
158-
client, err := newMlmdClient()
160+
var tlsCfg *tls.Config
161+
if args.MetadataTLSEnabled {
162+
tlsCfg, err = util.GetTLSConfig(args.CACertPath)
163+
return nil, fmt.Errorf("unable to drive driver: failed to load TLS configuration: %v", err)
164+
}
165+
client, err := newMlmdClient(tlsCfg)
159166
if err != nil {
160167
return nil, err
161168
}
162-
cacheClient, err := cacheutils.NewClient(args.CacheDisabledFlag)
169+
cacheClient, err := cacheutils.NewClient(args.CacheDisabledFlag, tlsCfg)
163170
if err != nil {
164171
return nil, err
165172
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ func Compile(jobArg *pipelinespec.PipelineJob, kubernetesSpecArg *pipelinespec.S
161161
// TODO(chensun): release process and update the images.
162162
launcherImage: GetLauncherImage(),
163163
launcherCommand: GetLauncherCommand(),
164-
driverImage: GetDriverImage(),
165-
driverCommand: GetDriverCommand(),
166164
job: job,
167165
spec: spec,
168166
executors: deploy.GetExecutors(),

backend/test/compiler/utils/workflow_utils.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import (
3636
v1 "k8s.io/api/core/v1"
3737
)
3838

39+
type driverPlugin map[string]map[string]map[string]interface{}
40+
3941
// LoadPipelineSpecsFromIR - Unmarshall Pipeline Spec IR into a tuple of (pipelinespec.PipelineJob, pipelinespec.SinglePlatformSpec)
4042
func LoadPipelineSpecsFromIR(pipelineIRFilePath string, cacheDisabled bool, defaultWorkspace *v1.PersistentVolumeClaimSpec) (*pipelinespec.PipelineJob, *pipelinespec.SinglePlatformSpec) {
4143
pipelineSpecsFromFile := testutil.ParseFileToSpecs(pipelineIRFilePath, cacheDisabled, defaultWorkspace)
@@ -89,6 +91,31 @@ func CreateCompiledWorkflowFile(compiledWorflow *v1alpha1.Workflow, compiledWork
8991
return testutil.CreateFile(compiledWorkflowFilePath, [][]byte{fileContents})
9092
}
9193

94+
func ConfigurePluginSettings(workflow *v1alpha1.Workflow, remove bool) *v1alpha1.Workflow {
95+
configuredWorkflow := workflow.DeepCopy()
96+
for i, template := range configuredWorkflow.Spec.Templates {
97+
if template.Plugin != nil {
98+
var pluginMap driverPlugin
99+
if err := json.Unmarshal(template.Plugin.Value, &pluginMap); err == nil {
100+
if driverPlugin, ok := pluginMap["driver-plugin"]; ok {
101+
if args, ok := driverPlugin["args"]; ok {
102+
if remove {
103+
args["cache_disabled"] = false
104+
} else {
105+
args["cache_disabled"] = true
106+
}
107+
}
108+
}
109+
jsonPlugin, err := json.Marshal(pluginMap)
110+
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "Failed to marshal plugin map")
111+
configuredWorkflow.Spec.Templates[i].Plugin.Value = jsonPlugin
112+
}
113+
}
114+
}
115+
116+
return configuredWorkflow
117+
}
118+
92119
// ConfigureCacheSettings - Add/Remove cache_disabled args in the workflow
93120
func ConfigureCacheSettings(workflow *v1alpha1.Workflow, remove bool) *v1alpha1.Workflow {
94121
cacheDisabledArg := "--cache_disabled"
@@ -138,5 +165,5 @@ func ConfigureCacheSettings(workflow *v1alpha1.Workflow, remove bool) *v1alpha1.
138165
}
139166
}
140167
}
141-
return configuredWorkflow
168+
return ConfigurePluginSettings(configuredWorkflow, remove)
142169
}

manifests/kustomize/base/pipeline/ml-pipeline-apiserver-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ spec:
129129
# JSON patch to apply to compiled workflow specifications
130130
- name: COMPILED_PIPELINE_SPEC_PATCH
131131
value: "{}"
132-
image: ghcr.io/kubeflow/kfp-api-server:dummy
132+
image: ntny/kfp-api-server:central-driver-beta
133133
imagePullPolicy: IfNotPresent
134134
name: ml-pipeline-api-server
135135
ports:

manifests/kustomize/base/pipeline/ml-pipeline-driver-plugin-cm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
data:
88
sidecar.automountServiceAccountToken: "true"
99
sidecar.container: |
10-
image: ntny/kfp-driver:central-driver-poc
10+
image: ntny/kfp-driver:central-driver-beta
1111
name: driver-plugin
1212
ports:
1313
- containerPort: 8080

manifests/kustomize/third-party/argo/base/workflow-controller-deployment-patch.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ spec:
1616
- workflow-controller-configmap
1717
- --executor-image
1818
- quay.io/argoproj/argoexec:v3.7.3
19+
env:
20+
- name: ARGO_EXECUTOR_PLUGINS
21+
value: "true"
1922
securityContext:
2023
readOnlyRootFilesystem: true
2124
runAsNonRoot: true

manifests/kustomize/third-party/argo/installs/namespace/kustomization.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ patches:
1616
kind: Deployment
1717
name: workflow-controller
1818
version: v1
19+
- path: workflow-controller-argo-role-patch.json
20+
target:
21+
group: rbac.authorization.k8s.io
22+
version: v1
23+
kind: Role
24+
name: argo-role

0 commit comments

Comments
 (0)