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