diff --git a/hack/update_codegen.sh b/hack/update_codegen.sh index bcd697d9f..fd261d3d3 100755 --- a/hack/update_codegen.sh +++ b/hack/update_codegen.sh @@ -23,7 +23,6 @@ TMP_VENDOR_DIR=gen-vendor function cleanup() { echo "Cleaning up..." rm -rf ${TMP_VENDOR_DIR} - rm sigs.k8s.io # We need to clean up the go.mod file since code-generator adds temporary library to the go.mod file. "${GO_CMD}" mod tidy } @@ -50,23 +49,23 @@ cd $(dirname ${BASH_SOURCE[0]})/.. source "${CODEGEN_PKG}/kube_codegen.sh" -# TODO: https://github.com/kubernetes/code-generator/issues/165 has been closed -# we need to bump the version of code-generator to v0.30.0 once it's released -ln -s .. sigs.k8s.io - # Generating conversion and defaults functions kube::codegen::gen_helpers \ - --input-pkg-root sigs.k8s.io/node-feature-discovery/api/nfd \ - --output-base "${NFD_ROOT}" \ + ${NFD_ROOT}/api/nfd \ --boilerplate ${NFD_ROOT}/hack/boilerplate.go.txt # HACK: manually patching the auto-generated code as code-generator cannot # properly handle deepcopy of MatchExpressionSet. sed s'/out = new(map\[string\]\*MatchExpression)/out = new(MatchExpressionSet)/' -i api/nfd/v1alpha1/zz_generated.deepcopy.go +# Switch to work in the api worktree +pushd "${NFD_ROOT}/api/nfd" > /dev/null + kube::codegen::gen_client \ - --input-pkg-root sigs.k8s.io/node-feature-discovery/api \ - --output-pkg-root sigs.k8s.io/node-feature-discovery/api/generated \ - --output-base "${NFD_ROOT}" \ - --boilerplate ${NFD_ROOT}/hack/boilerplate.go.txt \ - --with-watch + --with-watch \ + --output-dir "${NFD_ROOT}/api/generated" \ + --output-pkg "sigs.k8s.io/node-feature-discovery/api/generated" \ + --boilerplate "${NFD_ROOT}/hack/boilerplate.go.txt" \ + ${NFD_ROOT}/api + +popd > /dev/null