From 52445432d5dd035b50661c06056aa5e61084245a Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Arango Gutierrez Date: Fri, 26 Apr 2024 10:55:58 +0200 Subject: [PATCH 1/2] Fix kube::codegen::gen_helpers for v0.30 Signed-off-by: Carlos Eduardo Arango Gutierrez --- hack/update_codegen.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hack/update_codegen.sh b/hack/update_codegen.sh index bcd697d9f..c5dc5645d 100755 --- a/hack/update_codegen.sh +++ b/hack/update_codegen.sh @@ -56,8 +56,7 @@ 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}" \ + sigs.k8s.io/node-feature-discovery/api/nfd \ --boilerplate ${NFD_ROOT}/hack/boilerplate.go.txt # HACK: manually patching the auto-generated code as code-generator cannot From 9931a2a529d266345858066ad19fa25d9565652b Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Arango Gutierrez Date: Fri, 26 Apr 2024 11:54:01 +0200 Subject: [PATCH 2/2] Fix kube::codegen::gen_client for v0.30 Signed-off-by: Carlos Eduardo Arango Gutierrez --- hack/update_codegen.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hack/update_codegen.sh b/hack/update_codegen.sh index c5dc5645d..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,22 +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 \ - sigs.k8s.io/node-feature-discovery/api/nfd \ + ${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