Skip to content

Commit

Permalink
Align with k8s.io/code-generator@v0.30.0 (#2963)
Browse files Browse the repository at this point in the history
Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
  • Loading branch information
tiraboschi authored May 15, 2024
1 parent 2703387 commit 47a2be3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
2 changes: 0 additions & 2 deletions api/v1beta1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 17 additions & 20 deletions hack/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,36 @@
set -ex

K8S_VER=$(grep "k8s.io/api => k8s.io/api" go.mod | xargs | cut -d" " -f4)
KUBEOPENAPI_VER=$(grep "k8s.io/kube-openapi" go.mod | xargs | cut -d" " -f2)
PROJECT_ROOT="$(readlink -e "$(dirname "${BASH_SOURCE[0]}")"/../)"

# TODO: fix me!
K8S_VER=v0.29.3
PACKAGE=github.com/kubevirt/hyperconverged-cluster-operator
API_FOLDER=api
API_VERSION=v1beta1

go install \
k8s.io/code-generator/cmd/deepcopy-gen@${K8S_VER} \
k8s.io/code-generator/cmd/defaulter-gen@${K8S_VER} \
k8s.io/code-generator/cmd/openapi-gen@${K8S_VER}
k8s.io/code-generator/cmd/deepcopy-gen@${K8S_VER} \
k8s.io/code-generator/cmd/defaulter-gen@${K8S_VER}

go install \
k8s.io/kube-openapi/cmd/openapi-gen@${KUBEOPENAPI_VER}

deepcopy-gen \
--output-file zz_generated.deepcopy.go \
--go-header-file "${PROJECT_ROOT}/hack/boilerplate.go.txt" \
--output-base "${PROJECT_ROOT}" \
--output-file-base zz_generated.deepcopy \
--input-dirs github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1 \
--output-package github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1 \
--trim-path-prefix="${PROJECT_ROOT}/github.com/kubevirt/hyperconverged-cluster-operator/"
"${PACKAGE}/${API_FOLDER}/${API_VERSION}"

defaulter-gen \
--output-file zz_generated.defaults.go \
--go-header-file "${PROJECT_ROOT}/hack/boilerplate.go.txt" \
--output-base "${PROJECT_ROOT}" \
--output-file-base zz_generated.defaults \
--input-dirs github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1 \
--output-package github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1 \
--trim-path-prefix="${PROJECT_ROOT}/github.com/kubevirt/hyperconverged-cluster-operator/"
"${PACKAGE}/${API_FOLDER}/${API_VERSION}"

openapi-gen \
--output-file zz_generated.openapi.go \
--go-header-file "${PROJECT_ROOT}/hack/boilerplate.go.txt" \
--output-base "${PROJECT_ROOT}" \
--output-file-base zz_generated.openapi \
--input-dirs github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1 \
--output-package github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1 \
--trim-path-prefix="${PROJECT_ROOT}/github.com/kubevirt/hyperconverged-cluster-operator/"
--output-dir api/v1beta1/ \
--output-pkg github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1 \
"${PACKAGE}/${API_FOLDER}/${API_VERSION}"

go fmt api/v1beta1/zz_generated.deepcopy.go
go fmt api/v1beta1/zz_generated.defaults.go
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 47a2be3

Please sign in to comment.