From 2fae2b5a5b73119af99ea250c8b7017a1d8d11ef Mon Sep 17 00:00:00 2001 From: Rafal Skolasinski Date: Wed, 27 Jan 2021 18:52:42 +0000 Subject: [PATCH] use local copy of _operator instead of symlink (like in master) --- executor/.gitignore | 1 + executor/Dockerfile | 22 +++++++++++----------- executor/Dockerfile.redhat | 22 +++++++++++----------- executor/Makefile | 16 +++++++++++----- executor/go.mod | 2 +- executor/go.sum | 2 ++ 6 files changed, 37 insertions(+), 28 deletions(-) diff --git a/executor/.gitignore b/executor/.gitignore index 38ddfd3301..7917ee8b90 100644 --- a/executor/.gitignore +++ b/executor/.gitignore @@ -7,3 +7,4 @@ cover.out executor.tar openapi/ executor/api/rest/openapi/ +_operator diff --git a/executor/Dockerfile b/executor/Dockerfile index 3eedb39c71..4f03e1a24a 100644 --- a/executor/Dockerfile +++ b/executor/Dockerfile @@ -3,20 +3,20 @@ FROM golang:1.13 as builder WORKDIR /workspace # Copy the Go Modules manifests -COPY executor/go.mod go.mod -COPY executor/go.sum go.sum -COPY executor/proto/ proto/ +COPY go.mod go.mod +COPY go.sum go.sum +COPY proto/ proto/ # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer -COPY executor/operator/ operator/ +COPY _operator/ _operator/ RUN go mod download # Copy the go source -COPY executor/main.go main.go -COPY executor/api/ api/ -COPY executor/predictor/ predictor/ -COPY executor/logger/ logger/ -COPY executor/k8s/ k8s/ +COPY main.go main.go +COPY api/ api/ +COPY predictor/ predictor/ +COPY logger/ logger/ +COPY k8s/ k8s/ # Build RUN go build -a -o executor main.go @@ -27,7 +27,7 @@ RUN wget -O armon-consul-api.tar.gz https://github.com/armon/consul-api/archive/ RUN wget -O hasicorp-hcl.tar.gz https://github.com/hashicorp/hcl/archive/master.tar.gz # Copy OpenAPI folder and change the permissions -COPY executor/api/rest/openapi/ /openapi/ +COPY api/rest/openapi/ /openapi/ RUN chmod -R 660 /openapi/ # Use distroless as minimal base image to package the manager binary @@ -35,7 +35,7 @@ RUN chmod -R 660 /openapi/ FROM gcr.io/distroless/base:latest WORKDIR / COPY --from=builder /workspace/executor . -COPY executor/licenses/license.txt licenses/license.txt +COPY licenses/license.txt licenses/license.txt COPY --from=builder /workspace/hashicorp-golang-lru.tar.gz licenses/mpl_source/hashicorp-golang-lru.tar.gz COPY --from=builder /workspace/armon-consul-api.tar.gz licenses/mpl_source/armon-consul-api.tar.gz COPY --from=builder /workspace/hasicorp-hcl.tar.gz licenses/mpl_source/hasicorp-hcl.tar.gz diff --git a/executor/Dockerfile.redhat b/executor/Dockerfile.redhat index e0fc9b3204..88fa9e9f4b 100644 --- a/executor/Dockerfile.redhat +++ b/executor/Dockerfile.redhat @@ -3,20 +3,20 @@ FROM golang:1.13 as builder WORKDIR /workspace # Copy the Go Modules manifests -COPY executor/go.mod go.mod -COPY executor/go.sum go.sum -COPY executor/proto/ proto/ +COPY go.mod go.mod +COPY go.sum go.sum +COPY proto/ proto/ # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer -COPY executor/operator/ operator/ +COPY _operator/ _operator/ RUN go mod download # Copy the go source -COPY executor/main.go main.go -COPY executor/api/ api/ -COPY executor/predictor/ predictor/ -COPY executor/logger/ logger/ -COPY executor/k8s/ k8s/ +COPY main.go main.go +COPY api/ api/ +COPY predictor/ predictor/ +COPY logger/ logger/ +COPY k8s/ k8s/ # Build RUN go build -a -o executor main.go @@ -27,7 +27,7 @@ RUN wget -O armon-consul-api.tar.gz https://github.com/armon/consul-api/archive/ RUN wget -O hasicorp-hcl.tar.gz https://github.com/hashicorp/hcl/archive/master.tar.gz # Copy OpenAPI folder and change the permissions -COPY executor/api/rest/openapi/ /openapi/ +COPY api/rest/openapi/ /openapi/ RUN chmod -R 660 /openapi/ FROM registry.access.redhat.com/ubi8/ubi-minimal @@ -40,7 +40,7 @@ LABEL name="Seldon Executor" \ WORKDIR / COPY --from=builder /workspace/executor . -COPY executor/licenses/license.txt licenses/license.txt +COPY licenses/license.txt licenses/license.txt COPY --from=builder /workspace/hashicorp-golang-lru.tar.gz licenses/mpl_source/hashicorp-golang-lru.tar.gz COPY --from=builder /workspace/armon-consul-api.tar.gz licenses/mpl_source/armon-consul-api.tar.gz COPY --from=builder /workspace/hasicorp-hcl.tar.gz licenses/mpl_source/hasicorp-hcl.tar.gz diff --git a/executor/Makefile b/executor/Makefile index 1237ac2592..c1215072c9 100644 --- a/executor/Makefile +++ b/executor/Makefile @@ -27,10 +27,16 @@ vet: # Build manager binary -executor: fmt vet +executor: copy_operator fmt vet go build -o executor main.go +.PHONY: copy_operator +copy_operator: + rm -rf _operator + cp -r ../operator _operator + + .PHONY: copy_protos copy_protos: cp -r ../proto/tensorflow/tensorflow/** proto/tensorflow @@ -59,7 +65,7 @@ add_protos: cd serving && find ./tensorflow_serving -name '*.proto' | cpio -pdm ../proto # Run tests -test: fmt vet +test: copy_operator fmt vet go test ${EXECUTOR_FOLDERS} -coverprofile cover.out copy_openapi_resources: @@ -69,11 +75,11 @@ copy_openapi_resources: # Build the docker image docker-build: test copy_openapi_resources - cd .. && docker build -f executor/Dockerfile -t ${IMG} . + docker build -f Dockerfile -t ${IMG} . # Build the docker image for Redhat docker-build-redhat: test copy_openapi_resources - cd .. && docker build -f executor/Dockerfile.redhat -t ${IMG_REDHAT} . + docker build -f Dockerfile.redhat -t ${IMG_REDHAT} . # Push the docker image docker-push: @@ -127,7 +133,7 @@ licenses: licenses/dep.txt concatenate-license -o licenses/license.txt licenses/license_info.csv -lint: licenses/dep.txt +lint: copy_operator licenses/dep.txt # Check if licenses have changed git \ --no-pager diff \ diff --git a/executor/go.mod b/executor/go.mod index 6d5590545c..3528d1a9f0 100644 --- a/executor/go.mod +++ b/executor/go.mod @@ -31,4 +31,4 @@ require ( replace github.com/tensorflow/tensorflow/tensorflow/go/core => ./proto/tensorflow/core -replace github.com/seldonio/seldon-core/operator => ./operator +replace github.com/seldonio/seldon-core/operator => ./_operator diff --git a/executor/go.sum b/executor/go.sum index e245162521..dc0f089fb5 100644 --- a/executor/go.sum +++ b/executor/go.sum @@ -99,6 +99,7 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= @@ -344,6 +345,7 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=