@@ -18,19 +18,34 @@ set -o errexit
18
18
set -o nounset
19
19
set -o pipefail
20
20
21
- SCRIPT_ROOT=$( dirname " ${BASH_SOURCE[0]} " ) /..
22
- pushd " ${SCRIPT_ROOT} "
23
- SCRIPT_ROOT=$( pwd)
24
- popd
25
-
26
- # Note that we use code-generator from `${GOPATH}/pkg/mod/` because we cannot vendor it
27
- # via `go mod vendor` to the project's /vendor directory.
28
- # Reference: https://github.com/kubernetes/code-generator/issues/57
29
- CODEGEN_VERSION=$( grep ' k8s.io/code-generator' go.sum | awk ' {print $2}' | sed ' s/\/go.mod//g' | head -1)
30
- CODEGEN_PKG=$( echo ` go env GOPATH` " /pkg/mod/k8s.io/code-generator@${CODEGEN_VERSION} " )
31
- chmod +x " ${CODEGEN_PKG} /generate-groups.sh"
32
- chmod +x " ${CODEGEN_PKG} /generate-internal-groups.sh"
33
-
34
- " ${CODEGEN_PKG} /generate-groups.sh" " deepcopy,client,informer,lister,applyconfiguration" \
35
- github.com/kubeflow/mpi-operator/pkg/client github.com/kubeflow/mpi-operator/pkg/apis \
36
- kubeflow:v2beta1 --go-header-file " ${SCRIPT_ROOT} /hack/custom-boilerplate.go.txt"
21
+ CURRENT_DIR=$( dirname " ${BASH_SOURCE[0]} " )
22
+ MPI_OPERATOR_ROOT=$( realpath " ${CURRENT_DIR} /.." )
23
+ MPI_OPERATOR_PKG=" github.com/kubeflow/mpi-operator"
24
+ CODEGEN_PKG=$( go list -m -mod=readonly -f " {{.Dir}}" k8s.io/code-generator)
25
+
26
+ cd " ${CURRENT_DIR} /.."
27
+
28
+ source " ${CODEGEN_PKG} /kube_codegen.sh"
29
+
30
+ kube::codegen::gen_helpers \
31
+ --boilerplate " ${MPI_OPERATOR_ROOT} /hack/custom-boilerplate.go.txt" \
32
+ " ${MPI_OPERATOR_ROOT} /pkg/apis"
33
+
34
+ # Generating OpenAPI
35
+ cp " ${MPI_OPERATOR_ROOT} /pkg/apis/kubeflow/v2beta1/zz_generated.openapi.go" \
36
+ " ${MPI_OPERATOR_ROOT} /pkg/apis/kubeflow/v2beta1/zz_generated.openapi.go.backup"
37
+
38
+ kube::codegen::gen_openapi \
39
+ --boilerplate " ${MPI_OPERATOR_ROOT} /hack/custom-boilerplate.go.txt" \
40
+ --output-dir " ${MPI_OPERATOR_ROOT} /pkg/apis/kubeflow/v2beta1" \
41
+ --output-pkg " ${MPI_OPERATOR_PKG} /pkg/apis/kubeflow/v2beta1" \
42
+ --update-report \
43
+ " ${MPI_OPERATOR_ROOT} /pkg/apis/kubeflow/v2beta1"
44
+
45
+ kube::codegen::gen_client \
46
+ --with-watch \
47
+ --with-applyconfig \
48
+ --output-dir " ${MPI_OPERATOR_ROOT} /pkg/client" \
49
+ --output-pkg " ${MPI_OPERATOR_PKG} /pkg/client" \
50
+ --boilerplate " ${MPI_OPERATOR_ROOT} /hack/custom-boilerplate.go.txt" \
51
+ " ${MPI_OPERATOR_ROOT} /pkg/apis"
0 commit comments