Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Commit

Permalink
Update openapi-gen to not rely on vendor (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffwan authored Jul 9, 2020
1 parent 7c4dd8d commit 61fefa8
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 281 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ COPY --from=build-image /go/src/github.com/kubeflow/pytorch-operator/pytorch-ope

COPY third_party/library/license.txt /license.txt

RUN mkdir -p /vendor

ENTRYPOINT ["/pytorch-operator.v1", "-alsologtostderr"]
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ replace (
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.15.9
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.15.9
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.15.9
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30
k8s.io/kube-proxy => k8s.io/kube-proxy v0.15.9
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.15.9
k8s.io/kubectl => k8s.io/kubectl v0.15.13-beta.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,6 @@ k8s.io/klog v0.4.0 h1:lCJCxf/LIowc2IGS9TPjWDyXY4nOmdGdfcwwDQCOURQ=
k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/kube-aggregator v0.15.9/go.mod h1:0qkV3is34K22a6LzgE0+85HGp+V84d7jabS6alqUomU=
k8s.io/kube-controller-manager v0.15.9/go.mod h1:W4Hi0ISvsMECIvYCbP/eYHp0/niHkDF7hIfS0c7xWjQ=
k8s.io/kube-openapi v0.0.0-20180509051136-39cb288412c4 h1:gW+EUB2I96nbxVenV/8ctfbACsHP+yxlT2dhMCsiy+s=
k8s.io/kube-openapi v0.0.0-20180509051136-39cb288412c4/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc=
k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30 h1:TRb4wNWoBVrH9plmkp2q86FIDppkbrEXdXlxU3a3BMI=
k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc=
k8s.io/kube-proxy v0.15.9/go.mod h1:Pee8FfheAGfwSE/WVhzle0YAYJaJ8D9O36HlBmSlbjA=
Expand Down
16 changes: 15 additions & 1 deletion hack/python-sdk/gen-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,22 @@ if [ -z "${GOPATH:-}" ]; then
export GOPATH=$(go env GOPATH)
fi

# Grab kube-openapi version from go.sum
OPENAPI_VERSION=$(grep 'k8s.io/kube-openapi' go.sum | awk '{print $2}' | head -1)
OPENAPI_PKG=$(echo `go env GOPATH`"/pkg/mod/k8s.io/kube-openapi@${OPENAPI_VERSION}")

if [[ ! -d ${OPENAPI_PKG} ]]; then
echo "${OPENAPI_PKG} is missing. Running 'go mod download'."
go mod download
fi

echo ">> Using ${OPENAPI_PKG}"

echo "Building openapi-gen"
go build -o openapi-gen ${OPENAPI_PKG}/cmd/openapi-gen

echo "Generating OpenAPI specification ..."
go run vendor/k8s.io/code-generator/cmd/openapi-gen/main.go --input-dirs github.com/kubeflow/pytorch-operator/pkg/apis/pytorch/v1,github.com/kubeflow/common/job_controller/api/v1 --output-package github.com/kubeflow/pytorch-operator/pkg/apis/pytorch/v1 --go-header-file hack/boilerplate/boilerplate.go.txt
./openapi-gen --input-dirs github.com/kubeflow/pytorch-operator/pkg/apis/pytorch/v1 --output-package github.com/kubeflow/pytorch-operator/pkg/apis/pytorch/v1 --go-header-file hack/boilerplate/boilerplate.go.txt

echo "Generating swagger file ..."
go run hack/python-sdk/main.go 0.1 > ${SWAGGER_CODEGEN_FILE}
Expand Down
Loading

0 comments on commit 61fefa8

Please sign in to comment.