1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

Fix kube::codegen::gen_client for v0.30

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
This commit is contained in:
Carlos Eduardo Arango Gutierrez 2024-04-26 11:54:01 +02:00
parent 52445432d5
commit 9931a2a529
No known key found for this signature in database
GPG key ID: F19CDD72A695437A

View file

@ -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