Skip to content

Commit

Permalink
chore(backend): Merge v2 code into backend/src/ (#7173)
Browse files Browse the repository at this point in the history
* merge v2 code

* update go-licenses tool and base licenses files

* clean up unused files

* fix dockerfiles

* fix path to sdk folder

* fix path
  • Loading branch information
chensun committed Jan 25, 2022
1 parent 6fac617 commit 1b107eb
Show file tree
Hide file tree
Showing 83 changed files with 291 additions and 4,136 deletions.
7 changes: 3 additions & 4 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@
# limitations under the License.

# 1. Build api server application
# Use golang:1.13.1-stretch to keep GLIBC at 2.24 https://github.com/gotify/server/issues/225
FROM golang:1.13.1-stretch as builder
FROM golang:1.17.6-stretch as builder
RUN apt-get update && apt-get install -y cmake clang musl-dev openssl
WORKDIR /go/src/github.com/kubeflow/pipelines
COPY . .
RUN GO111MODULE=on go build -o /bin/apiserver backend/src/apiserver/*.go
# Check licenses and comply with license terms.
RUN ./hack/install-go-licenses.sh
RUN go-licenses csv /bin/apiserver > /tmp/licenses.csv && \
RUN go-licenses csv ./backend/src/apiserver > /tmp/licenses.csv && \
diff /tmp/licenses.csv backend/third_party_licenses/apiserver.csv && \
go-licenses save /tmp/licenses.csv --save_path /tmp/NOTICES
go-licenses save ./backend/src/apiserver --save_path /tmp/NOTICES

# 2. Compile preloaded pipeline samples
FROM python:3.7 as compiler
Expand Down
6 changes: 3 additions & 3 deletions backend/Dockerfile.cacheserver
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Dockerfile for building the source code of cache_server
FROM golang:1.13.15-alpine3.12 as builder
FROM golang:1.17.6-alpine3.15 as builder

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh gcc musl-dev
Expand All @@ -25,9 +25,9 @@ RUN GO111MODULE=on go build -o /bin/cache_server backend/src/cache/*.go

# Check licenses and comply with license terms.
RUN ./hack/install-go-licenses.sh
RUN go-licenses csv /bin/cache_server > /tmp/licenses.csv && \
RUN go-licenses csv ./backend/src/cache > /tmp/licenses.csv && \
diff /tmp/licenses.csv backend/third_party_licenses/cache_server.csv && \
go-licenses save /tmp/licenses.csv --save_path /tmp/NOTICES
go-licenses save ./backend/src/cache --save_path /tmp/NOTICES

FROM alpine:3.8
WORKDIR /bin
Expand Down
6 changes: 3 additions & 3 deletions backend/Dockerfile.persistenceagent
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.13.15-alpine3.12 as builder
FROM golang:1.17.6-alpine3.15 as builder

WORKDIR /go/src/github.com/kubeflow/pipelines
COPY . .
Expand All @@ -24,9 +24,9 @@ RUN apk update && apk upgrade && \
RUN GO111MODULE=on go build -o /bin/persistence_agent backend/src/agent/persistence/*.go
# Check licenses and comply with license terms.
RUN ./hack/install-go-licenses.sh
RUN go-licenses csv /bin/persistence_agent > /tmp/licenses.csv && \
RUN go-licenses csv ./backend/src/agent/persistence > /tmp/licenses.csv && \
diff /tmp/licenses.csv backend/third_party_licenses/persistence_agent.csv && \
go-licenses save /tmp/licenses.csv --save_path /tmp/NOTICES
go-licenses save ./backend/src/agent/persistence --save_path /tmp/NOTICES

FROM alpine:3.8
WORKDIR /bin
Expand Down
6 changes: 3 additions & 3 deletions backend/Dockerfile.scheduledworkflow
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.13.15-alpine3.12 as builder
FROM golang:1.17.6-alpine3.15 as builder

WORKDIR /go/src/github.com/kubeflow/pipelines
COPY . .
Expand All @@ -24,9 +24,9 @@ RUN apk update && apk upgrade && \
RUN GO111MODULE=on go build -o /bin/controller backend/src/crd/controller/scheduledworkflow/*.go
# Check licenses and comply with license terms.
RUN ./hack/install-go-licenses.sh
RUN go-licenses csv /bin/controller > /tmp/licenses.csv && \
RUN go-licenses csv ./backend/src/crd/controller/scheduledworkflow > /tmp/licenses.csv && \
diff /tmp/licenses.csv backend/third_party_licenses/swf.csv && \
go-licenses save /tmp/licenses.csv --save_path /tmp/NOTICES
go-licenses save ./backend/src/crd/controller/scheduledworkflow --save_path /tmp/NOTICES

FROM alpine:3.8
WORKDIR /bin
Expand Down
6 changes: 3 additions & 3 deletions backend/Dockerfile.viewercontroller
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:alpine as builder
FROM golang:1.17.6-alpine3.15 as builder

RUN apk update && apk upgrade
RUN apk add --no-cache git gcc musl-dev
Expand All @@ -23,9 +23,9 @@ COPY . .
RUN GO111MODULE=on go build -o /bin/controller backend/src/crd/controller/viewer/*.go
# Check licenses and comply with license terms.
RUN ./hack/install-go-licenses.sh
RUN go-licenses csv /bin/controller > /tmp/licenses.csv && \
RUN go-licenses csv ./backend/src/crd/controller/viewer > /tmp/licenses.csv && \
diff /tmp/licenses.csv backend/third_party_licenses/viewer.csv && \
go-licenses save /tmp/licenses.csv --save_path /tmp/NOTICES
go-licenses save ./backend/src/crd/controller/viewer --save_path /tmp/NOTICES

FROM alpine
WORKDIR /bin
Expand Down
10 changes: 5 additions & 5 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ $(BUILD)/viewer:
# See README.md#updating-licenses-info section for more details.
.PHONY: license_apiserver
license_apiserver: $(BUILD)/apiserver
cd $(MOD_ROOT) && go-licenses csv backend/$(BUILD)/apiserver > $(CSV_PATH)/apiserver.csv
cd $(MOD_ROOT) && go-licenses csv ./backend/src/apiserver > $(CSV_PATH)/apiserver.csv
.PHONY: license_persistence_agent
license_persistence_agent: $(BUILD)/persistence_agent
cd $(MOD_ROOT) && go-licenses csv backend/$(BUILD)/persistence_agent > $(CSV_PATH)/persistence_agent.csv
cd $(MOD_ROOT) && go-licenses csv ./backend/src/agent/persistence > $(CSV_PATH)/persistence_agent.csv
.PHONY: license_cache_server
license_cache_server: $(BUILD)/cache_server
cd $(MOD_ROOT) && go-licenses csv backend/$(BUILD)/cache_server > $(CSV_PATH)/cache_server.csv
cd $(MOD_ROOT) && go-licenses csv ./backend/src/cache > $(CSV_PATH)/cache_server.csv
.PHONY: license_swf
license_swf: $(BUILD)/swf
cd $(MOD_ROOT) && go-licenses csv backend/$(BUILD)/swf > $(CSV_PATH)/swf.csv
cd $(MOD_ROOT) && go-licenses csv ./backend/src/crd/controller/scheduledworkflow > $(CSV_PATH)/swf.csv
.PHONY: license_viewer
license_viewer: $(BUILD)/viewer
cd $(MOD_ROOT) && go-licenses csv backend/$(BUILD)/viewer > $(CSV_PATH)/viewer.csv
cd $(MOD_ROOT) && go-licenses csv ./backend/src/crd/controller/viewer > $(CSV_PATH)/viewer.csv

.PHONY: image_all
image_all: image_apiserver image_persistence_agent image_cache image_swf image_viewer image_visualization
Expand Down
9 changes: 5 additions & 4 deletions backend/src/apiserver/template/v2_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package template

import (
"fmt"
structpb "github.com/golang/protobuf/ptypes/struct"
"regexp"

structpb "github.com/golang/protobuf/ptypes/struct"

"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
api "github.com/kubeflow/pipelines/backend/api/go_client"
"github.com/kubeflow/pipelines/backend/src/common/util"
scheduledworkflow "github.com/kubeflow/pipelines/backend/src/crd/pkg/apis/scheduledworkflow/v1beta1"
"github.com/kubeflow/pipelines/v2/compiler"
"github.com/kubeflow/pipelines/backend/src/v2/compiler/argocompiler"
"google.golang.org/protobuf/encoding/protojson"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -33,7 +34,7 @@ func (t *V2Spec) ScheduledWorkflow(apiJob *api.Job) (*scheduledworkflow.Schedule
return nil, util.Wrap(err, "Failed to convert to PipelineJob RuntimeConfig")
}
job.RuntimeConfig = jobRuntimeConfig
wf, err := compiler.Compile(job, nil)
wf, err := argocompiler.Compile(job, nil)
if err != nil {
return nil, util.Wrap(err, "Failed to compile job")
}
Expand Down Expand Up @@ -140,7 +141,7 @@ func (t *V2Spec) RunWorkflow(apiRun *api.Run, options RunWorkflowOptions) (*util
return nil, util.Wrap(err, "Failed to convert to PipelineJob RuntimeConfig")
}
job.RuntimeConfig = jobRuntimeConfig
wf, err := compiler.Compile(job, nil)
wf, err := argocompiler.Compile(job, nil)
if err != nil {
return nil, util.Wrap(err, "Failed to compile job")
}
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion v2/Makefile → backend/src/v2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pipeline/%: build/compiler image-dev
# always rebuild, it's hard to set up exact dependencies
# For build/launcher-v2, $@ will be build/launcher-v2, $* will be launcher-v2.
build/%: FORCE
$(GO_FLAGS) go build $(GO_BUILD_FLAGS) -o $@ github.com/kubeflow/pipelines/v2/cmd/$*
$(GO_FLAGS) go build $(GO_BUILD_FLAGS) -o $@ github.com/kubeflow/pipelines/backend/src/v2/cmd/$*
image-%-dev: FORCE
@KO_DOCKER_REPO=$(DEV_IMAGE_PREFIX)$* ko publish ./cmd/$* --bare
install-ko: FORCE
Expand Down
2 changes: 1 addition & 1 deletion v2/README.md → backend/src/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Note, this is currently outdated instructions for v2 compatible mode. We haven't
gcloud auth login
gcloud auth configure-docker
cd kubeflow/pipelines/v2
cd kubeflow/pipelines/backend/src/v2
TAG_NAME=1.6.0
LAUNCHER_IMAGE="gcr.io/ml-pipeline/kfp-launcher:${TAG_NAME}" make push-launcher
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/golang/glog"
"github.com/kubeflow/pipelines/api/v2alpha1/go/cachekey"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
api "github.com/kubeflow/pipelines/v2/kfp-api"
api "github.com/kubeflow/pipelines/backend/api/go_client"
)

const (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/golang/glog"
structpb "github.com/golang/protobuf/ptypes/struct"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/compiler/argocompiler"
"github.com/kubeflow/pipelines/backend/src/v2/compiler/argocompiler"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)
Expand Down
8 changes: 4 additions & 4 deletions v2/cmd/driver/main.go → backend/src/v2/cmd/driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import (
"path/filepath"
"strconv"

"github.com/kubeflow/pipelines/v2/cacheutils"
"github.com/kubeflow/pipelines/v2/driver"
"github.com/kubeflow/pipelines/backend/src/v2/cacheutils"
"github.com/kubeflow/pipelines/backend/src/v2/driver"

"github.com/golang/glog"
"github.com/golang/protobuf/jsonpb"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/config"
"github.com/kubeflow/pipelines/v2/metadata"
"github.com/kubeflow/pipelines/backend/src/v2/config"
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"fmt"

"github.com/golang/glog"
"github.com/kubeflow/pipelines/v2/component"
"github.com/kubeflow/pipelines/v2/config"
"github.com/kubeflow/pipelines/backend/src/v2/component"
"github.com/kubeflow/pipelines/backend/src/v2/config"
)

// TODO: use https://github.com/spf13/cobra as a framework to create more complex CLI tools with subcommands.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

wfapi "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/compiler"
"github.com/kubeflow/pipelines/backend/src/v2/compiler"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/structpb"
k8score "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/ghodss/yaml"
"github.com/google/go-cmp/cmp"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/compiler/argocompiler"
"github.com/kubeflow/pipelines/backend/src/v2/compiler/argocompiler"
"google.golang.org/protobuf/encoding/protojson"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package argocompiler
import (
wfapi "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/component"
"github.com/kubeflow/pipelines/backend/src/v2/component"
k8score "k8s.io/api/core/v1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

wfapi "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/compiler"
"github.com/kubeflow/pipelines/backend/src/v2/compiler"
k8score "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

wfapi "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/component"
"github.com/kubeflow/pipelines/backend/src/v2/component"
k8score "k8s.io/api/core/v1"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/golang/protobuf/jsonpb"
"github.com/google/go-cmp/cmp"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/compiler"
"github.com/kubeflow/pipelines/backend/src/v2/compiler"
)

type testVisitor struct {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
pb "github.com/kubeflow/pipelines/third_party/ml-metadata/go/ml_metadata"

"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/metadata"
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
"google.golang.org/protobuf/encoding/protojson"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import (

"github.com/golang/glog"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/kubeflow/pipelines/v2/cacheutils"
api "github.com/kubeflow/pipelines/v2/kfp-api"
api "github.com/kubeflow/pipelines/backend/api/go_client"
"github.com/kubeflow/pipelines/backend/src/v2/cacheutils"

"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
"github.com/kubeflow/pipelines/backend/src/v2/objectstore"
pb "github.com/kubeflow/pipelines/third_party/ml-metadata/go/ml_metadata"
"github.com/kubeflow/pipelines/v2/metadata"
"github.com/kubeflow/pipelines/v2/objectstore"
"gocloud.dev/blob"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/types/known/structpb"
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions v2/driver/driver.go → backend/src/v2/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (

"github.com/golang/glog"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/backend/src/v2/cacheutils"
"github.com/kubeflow/pipelines/backend/src/v2/component"
"github.com/kubeflow/pipelines/backend/src/v2/config"
"github.com/kubeflow/pipelines/backend/src/v2/expression"
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
pb "github.com/kubeflow/pipelines/third_party/ml-metadata/go/ml_metadata"
"github.com/kubeflow/pipelines/v2/cacheutils"
"github.com/kubeflow/pipelines/v2/component"
"github.com/kubeflow/pipelines/v2/config"
"github.com/kubeflow/pipelines/v2/expression"
"github.com/kubeflow/pipelines/v2/metadata"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/types/known/structpb"
k8score "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/google/cel-go/common/types/ref"
"github.com/google/cel-go/interpreter/functions"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/metadata"
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/kubeflow/pipelines/api/v2alpha1/go/pipelinespec"
"github.com/kubeflow/pipelines/v2/expression"
"github.com/kubeflow/pipelines/backend/src/v2/expression"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/testing/protocmp"
"google.golang.org/protobuf/types/known/structpb"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid"
"github.com/kubeflow/pipelines/backend/src/v2/metadata"
pb "github.com/kubeflow/pipelines/third_party/ml-metadata/go/ml_metadata"
"github.com/kubeflow/pipelines/v2/metadata"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/testing/protocmp"
Expand Down Expand Up @@ -71,6 +71,8 @@ func Test_schemaToArtifactType(t *testing.T) {
}

func Test_GetPipeline(t *testing.T) {
t.Skip("Temporarily disable the test that requires cluster connection.")

fatalIf := func(err error) {
if err != nil {
debug.PrintStack()
Expand Down Expand Up @@ -120,6 +122,8 @@ func Test_GetPipeline(t *testing.T) {
}

func Test_GetPipelineFromExecution(t *testing.T) {
t.Skip("Temporarily disable the test that requires cluster connection.")

fatalIf := func(err error) {
if err != nil {
debug.PrintStack()
Expand All @@ -143,6 +147,8 @@ func Test_GetPipelineFromExecution(t *testing.T) {
}

func Test_GetPipelineConcurrently(t *testing.T) {
t.Skip("Temporarily disable the test that requires cluster connection.")

// This test depends on a MLMD grpc server running at localhost:8080.
client, err := metadata.NewClient("localhost", "8080")
if err != nil {
Expand Down Expand Up @@ -182,6 +188,8 @@ func Test_GetPipelineConcurrently(t *testing.T) {
}

func Test_DAG(t *testing.T) {
t.Skip("Temporarily disable the test that requires cluster connection.")

client := newLocalClientOrFatal(t)
ctx := context.Background()
// These parameters do not matter.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 1b107eb

Please sign in to comment.