Adding support for providing version for functions in kube_codegen.sh (#129658)

* adding support for providing version for functions in kube_codegen.sh

* addressed review comments

* addressed review comments
This commit is contained in:
Madhav Bhargava 2025-01-22 13:34:36 +05:30 committed by GitHub
parent 25be4a4bd4
commit a78983906f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,6 +27,11 @@ set -o pipefail
KUBE_CODEGEN_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
# Callers which want a specific tag of the k8s.io/code-generator repo should
# set the KUBE_CODEGEN_TAG to the tag name, e.g. KUBE_CODEGEN_TAG="release-1.32"
# before sourcing this file.
CODEGEN_VERSION_SPEC="${KUBE_CODEGEN_TAG:+"@${KUBE_CODEGEN_TAG}"}"
function kube::codegen::internal::findz() {
# We use `find` rather than `git ls-files` because sometimes external
# projects use this across repos. This is an imperfect wrapper of find,
@ -103,9 +108,9 @@ function kube::codegen::gen_helpers() {
# and then install with forced module mode on and fully qualified name.
cd "${KUBE_CODEGEN_ROOT}"
BINS=(
conversion-gen
deepcopy-gen
defaulter-gen
conversion-gen"${CODEGEN_VERSION_SPEC}"
deepcopy-gen"${CODEGEN_VERSION_SPEC}"
defaulter-gen"${CODEGEN_VERSION_SPEC}"
)
# shellcheck disable=2046 # printf word-splitting is intentional
GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}")
@ -324,7 +329,7 @@ function kube::codegen::gen_openapi() {
# and then install with forced module mode on and fully qualified name.
cd "${KUBE_CODEGEN_ROOT}"
BINS=(
openapi-gen
openapi-gen"${CODEGEN_VERSION_SPEC}"
)
# shellcheck disable=2046 # printf word-splitting is intentional
GO111MODULE=on go install $(printf "k8s.io/kube-openapi/cmd/%s " "${BINS[@]}")
@ -554,10 +559,10 @@ function kube::codegen::gen_client() {
# and then install with forced module mode on and fully qualified name.
cd "${KUBE_CODEGEN_ROOT}"
BINS=(
applyconfiguration-gen
client-gen
informer-gen
lister-gen
applyconfiguration-gen"${CODEGEN_VERSION_SPEC}"
client-gen"${CODEGEN_VERSION_SPEC}"
informer-gen"${CODEGEN_VERSION_SPEC}"
lister-gen"${CODEGEN_VERSION_SPEC}"
)
# shellcheck disable=2046 # printf word-splitting is intentional
GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}")
@ -729,7 +734,7 @@ function kube::codegen::gen_register() {
# and then install with forced module mode on and fully qualified name.
cd "${KUBE_CODEGEN_ROOT}"
BINS=(
register-gen
register-gen"${CODEGEN_VERSION_SPEC}"
)
# shellcheck disable=2046 # printf word-splitting is intentional
GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}")