Merge pull request #123387 from soltysh/kube_codegen

kube_codegen: add plural-exceptions and use grep for finding API types
This commit is contained in:
Kubernetes Prow Robot 2024-02-20 11:58:50 -08:00 committed by GitHub
commit df1803f601
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -460,6 +460,9 @@ function kube::codegen::gen_openapi() {
# --informers-name <string = "informers">
# An optional override for the leaf name of the generated "informers" directory.
#
# --plural-exceptions <string = "">
# An optional list of comma separated plural exception definitions in Type:PluralizedType form.
#
function kube::codegen::gen_client() {
local in_pkg_root=""
local one_input_api=""
@ -473,6 +476,7 @@ function kube::codegen::gen_client() {
local listers_subdir="listers"
local informers_subdir="informers"
local boilerplate="${KUBE_CODEGEN_ROOT}/hack/boilerplate.go.txt"
local plural_exceptions=""
local v="${KUBE_VERBOSE:-0}"
while [ "$#" -gt 0 ]; do
@ -525,6 +529,10 @@ function kube::codegen::gen_client() {
informers_subdir="$2"
shift 2
;;
"--plural-exceptions")
plural_exceptions="$2"
shift 2
;;
*)
echo "unknown argument: $1" >&2
return 1
@ -640,6 +648,7 @@ function kube::codegen::gen_client() {
--output-base "${out_base}" \
--output-package "${out_pkg_root}/${clientset_subdir}" \
--apply-configuration-package "${applyconfig_pkg}" \
--plural-exceptions "${plural_exceptions}" \
"${inputs[@]}"
if [ "${watchable}" == "true" ]; then
@ -661,6 +670,7 @@ function kube::codegen::gen_client() {
--go-header-file "${boilerplate}" \
--output-base "${out_base}" \
--output-package "${out_pkg_root}/${listers_subdir}" \
--plural-exceptions "${plural_exceptions}" \
"${inputs[@]}"
echo "Generating informer code for ${#input_pkgs[@]} targets"
@ -683,6 +693,7 @@ function kube::codegen::gen_client() {
--output-package "${out_pkg_root}/${informers_subdir}" \
--versioned-clientset-package "${out_pkg_root}/${clientset_subdir}/${clientset_versioned_name}" \
--listers-package "${out_pkg_root}/${listers_subdir}" \
--plural-exceptions "${plural_exceptions}" \
"${inputs[@]}"
fi
}