mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Make code-gen subprojects work on gengo/v2
This commit is contained in:
		@@ -776,17 +776,17 @@ function indent() {
 | 
			
		||||
function codegen::subprojects() {
 | 
			
		||||
    # Call generation on sub-projects.
 | 
			
		||||
    local subs=(
 | 
			
		||||
        vendor/k8s.io/code-generator/examples
 | 
			
		||||
        vendor/k8s.io/kube-aggregator
 | 
			
		||||
        vendor/k8s.io/sample-apiserver
 | 
			
		||||
        vendor/k8s.io/sample-controller
 | 
			
		||||
        vendor/k8s.io/metrics
 | 
			
		||||
        vendor/k8s.io/apiextensions-apiserver
 | 
			
		||||
        vendor/k8s.io/apiextensions-apiserver/examples/client-go
 | 
			
		||||
        staging/src/k8s.io/code-generator/examples
 | 
			
		||||
        staging/src/k8s.io/kube-aggregator
 | 
			
		||||
        staging/src/k8s.io/sample-apiserver
 | 
			
		||||
        staging/src/k8s.io/sample-controller
 | 
			
		||||
        staging/src/k8s.io/metrics
 | 
			
		||||
        staging/src/k8s.io/apiextensions-apiserver
 | 
			
		||||
        staging/src/k8s.io/apiextensions-apiserver/examples/client-go
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    local codegen
 | 
			
		||||
    codegen="$(pwd)/vendor/k8s.io/code-generator"
 | 
			
		||||
    codegen="${KUBE_ROOT}/staging/src/k8s.io/code-generator"
 | 
			
		||||
    for sub in "${subs[@]}"; do
 | 
			
		||||
        kube::log::status "Generating code for subproject ${sub}"
 | 
			
		||||
        pushd "${sub}" >/dev/null
 | 
			
		||||
 
 | 
			
		||||
@@ -23,20 +23,16 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-
 | 
			
		||||
 | 
			
		||||
source "${CODEGEN_PKG}/kube_codegen.sh"
 | 
			
		||||
 | 
			
		||||
# generate the code with:
 | 
			
		||||
# --output-base    because this script should also be able to run inside the vendor dir of
 | 
			
		||||
#                  k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
 | 
			
		||||
#                  instead of the $GOPATH directly. For normal projects this can be dropped.
 | 
			
		||||
THIS_PKG="k8s.io/apiextensions-apiserver/examples/client-go"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_helpers \
 | 
			
		||||
    --input-pkg-root k8s.io/apiextensions-apiserver/examples/client-go/pkg/apis \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --with-watch \
 | 
			
		||||
    --with-applyconfig \
 | 
			
		||||
    --input-pkg-root k8s.io/apiextensions-apiserver/examples/client-go/pkg/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/apiextensions-apiserver/examples/client-go/pkg/client \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/pkg/client" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/pkg/client" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 
 | 
			
		||||
@@ -23,10 +23,11 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-
 | 
			
		||||
 | 
			
		||||
source "${CODEGEN_PKG}/kube_codegen.sh"
 | 
			
		||||
 | 
			
		||||
THIS_PKG="k8s.io/apiextensions-apiserver"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_helpers \
 | 
			
		||||
    --input-pkg-root k8s.io/apiextensions-apiserver/pkg \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg"
 | 
			
		||||
 | 
			
		||||
if [[ -n "${API_KNOWN_VIOLATIONS_DIR:-}" ]]; then
 | 
			
		||||
    report_filename="${API_KNOWN_VIOLATIONS_DIR}/apiextensions_violation_exceptions.list"
 | 
			
		||||
@@ -36,19 +37,19 @@ if [[ -n "${API_KNOWN_VIOLATIONS_DIR:-}" ]]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_openapi \
 | 
			
		||||
    --input-pkg-root k8s.io/apiextensions-apiserver/pkg \
 | 
			
		||||
    --extra-pkgs k8s.io/api/autoscaling/v1 `# needed for Scale type` \
 | 
			
		||||
    --output-pkg-root k8s.io/apiextensions-apiserver/pkg/generated \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/pkg/generated/openapi" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/pkg/generated/openapi" \
 | 
			
		||||
    --report-filename "${report_filename:-"/dev/null"}" \
 | 
			
		||||
    ${update_report:+"${update_report}"} \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --with-watch \
 | 
			
		||||
    --with-applyconfig \
 | 
			
		||||
    --input-pkg-root k8s.io/apiextensions-apiserver/pkg/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/apiextensions-apiserver/pkg/client \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --versioned-name clientset \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/pkg/client" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/pkg/client" \
 | 
			
		||||
    --versioned-name "clientset" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 
 | 
			
		||||
@@ -24,15 +24,11 @@ CODEGEN_PKG="${CODEGEN_PKG:-"${SCRIPT_ROOT}/.."}"
 | 
			
		||||
 | 
			
		||||
source "${CODEGEN_PKG}/kube_codegen.sh"
 | 
			
		||||
 | 
			
		||||
# generate the code with:
 | 
			
		||||
# - --output-base because this script should also be able to run inside the vendor dir of
 | 
			
		||||
#   k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
 | 
			
		||||
#   instead of the $GOPATH directly. For normal projects this can be dropped.
 | 
			
		||||
THIS_PKG="k8s.io/code-generator/examples"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_helpers \
 | 
			
		||||
    --input-pkg-root k8s.io/code-generator/examples \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}"
 | 
			
		||||
 | 
			
		||||
if [[ -n "${API_KNOWN_VIOLATIONS_DIR:-}" ]]; then
 | 
			
		||||
    report_filename="${API_KNOWN_VIOLATIONS_DIR}/codegen_violation_exceptions.list"
 | 
			
		||||
@@ -42,40 +38,40 @@ if [[ -n "${API_KNOWN_VIOLATIONS_DIR:-}" ]]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_openapi \
 | 
			
		||||
    --input-pkg-root k8s.io/code-generator/examples/apiserver/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/code-generator/examples/apiserver \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/apiserver/openapi" \
 | 
			
		||||
    --output-pkg "k8s.io/${THIS_PKG}/apiserver/openapi" \
 | 
			
		||||
    --report-filename "${report_filename:-"/dev/null"}" \
 | 
			
		||||
    ${update_report:+"${update_report}"} \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/apiserver/apis"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --with-watch \
 | 
			
		||||
    --input-pkg-root k8s.io/code-generator/examples/apiserver/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/code-generator/examples/apiserver \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/apiserver" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/apiserver" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/apiserver/apis"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --with-watch \
 | 
			
		||||
    --with-applyconfig \
 | 
			
		||||
    --input-pkg-root k8s.io/code-generator/examples/crd/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/code-generator/examples/crd \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/crd" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/crd" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/crd/apis"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --with-watch \
 | 
			
		||||
    --with-applyconfig \
 | 
			
		||||
    --input-pkg-root k8s.io/code-generator/examples/MixedCase/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/code-generator/examples/MixedCase \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/MixedCase" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/MixedCase" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/MixedCase/apis"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --with-watch \
 | 
			
		||||
    --with-applyconfig \
 | 
			
		||||
    --input-pkg-root k8s.io/code-generator/examples/HyphenGroup/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/code-generator/examples/HyphenGroup \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/HyphenGroup" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/HyphenGroup" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/HyphenGroup/apis"
 | 
			
		||||
 
 | 
			
		||||
@@ -45,15 +45,15 @@ function kube::codegen::internal::grep() {
 | 
			
		||||
 | 
			
		||||
# Generate tagged helper code: conversions, deepcopy, and defaults
 | 
			
		||||
#
 | 
			
		||||
# Args:
 | 
			
		||||
#   --input-pkg-root <string>
 | 
			
		||||
#     The root package under which to search for files which request code to be
 | 
			
		||||
#     generated.  This must be Go package syntax, e.g.  "k8s.io/foo/bar".
 | 
			
		||||
# USAGE: kube::codegen::gen_helpers [FLAGS] <input-dir>
 | 
			
		||||
#
 | 
			
		||||
# <input-dir>
 | 
			
		||||
#   The root directory under which to search for Go files which request code to
 | 
			
		||||
#   be generated.  This must be a local path, not a Go package.
 | 
			
		||||
#
 | 
			
		||||
#   See note at the top about package structure below that.
 | 
			
		||||
#
 | 
			
		||||
#   --output-base <string>
 | 
			
		||||
#     The root directory under which to emit code.  The concatenation of
 | 
			
		||||
#     <output-base> + <input-pkg-root> must be valid.
 | 
			
		||||
# FLAGS:
 | 
			
		||||
#
 | 
			
		||||
#   --boilerplate <string = path_to_kube_codegen_boilerplate>
 | 
			
		||||
#     An optional override for the header file to insert into generated files.
 | 
			
		||||
@@ -63,22 +63,13 @@ function kube::codegen::internal::grep() {
 | 
			
		||||
#     directories to consider during conversion generation.
 | 
			
		||||
#
 | 
			
		||||
function kube::codegen::gen_helpers() {
 | 
			
		||||
    local in_pkg_root=""
 | 
			
		||||
    local out_base="" # gengo needs the output dir must be $out_base/$out_pkg_root
 | 
			
		||||
    local in_dir=""
 | 
			
		||||
    local boilerplate="${KUBE_CODEGEN_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    local v="${KUBE_VERBOSE:-0}"
 | 
			
		||||
    local extra_peers=()
 | 
			
		||||
 | 
			
		||||
    while [ "$#" -gt 0 ]; do
 | 
			
		||||
        case "$1" in
 | 
			
		||||
            "--input-pkg-root")
 | 
			
		||||
                in_pkg_root="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--output-base")
 | 
			
		||||
                out_base="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--boilerplate")
 | 
			
		||||
                boilerplate="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
@@ -88,18 +79,22 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            *)
 | 
			
		||||
                if [[ "$1" =~ ^-- ]]; then
 | 
			
		||||
                    echo "unknown argument: $1" >&2
 | 
			
		||||
                    return 1
 | 
			
		||||
                fi
 | 
			
		||||
                if [ -n "$in_dir" ]; then
 | 
			
		||||
                    echo "too many arguments: $1 (already have $in_dir)" >&2
 | 
			
		||||
                    return 1
 | 
			
		||||
                fi
 | 
			
		||||
                in_dir="$1"
 | 
			
		||||
                shift
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
    done
 | 
			
		||||
 | 
			
		||||
    if [ -z "${in_pkg_root}" ]; then
 | 
			
		||||
        echo "--input-pkg-root is required" >&2
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
    if [ -z "${out_base}" ]; then
 | 
			
		||||
        echo "--output-base is required" >&2
 | 
			
		||||
    if [ -z "${in_dir}" ]; then
 | 
			
		||||
        echo "input-dir argument is required" >&2
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
@@ -118,11 +113,6 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
    # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise
 | 
			
		||||
    gobin="${GOBIN:-$(go env GOPATH)/bin}"
 | 
			
		||||
 | 
			
		||||
    # These tools all assume out-dir == in-dir.
 | 
			
		||||
    root="${out_base}/${in_pkg_root}"
 | 
			
		||||
    mkdir -p "${root}"
 | 
			
		||||
    root="$(cd "${root}" && pwd -P)"
 | 
			
		||||
 | 
			
		||||
    # Deepcopy
 | 
			
		||||
    #
 | 
			
		||||
    local input_pkgs=()
 | 
			
		||||
@@ -132,7 +122,7 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
    done < <(
 | 
			
		||||
        ( kube::codegen::internal::grep -l --null \
 | 
			
		||||
            -e '+k8s:deepcopy-gen=' \
 | 
			
		||||
            -r "${root}" \
 | 
			
		||||
            -r "${in_dir}" \
 | 
			
		||||
            --include '*.go' \
 | 
			
		||||
            || true \
 | 
			
		||||
        ) | while read -r -d $'\0' F; do dirname "${F}"; done \
 | 
			
		||||
@@ -143,7 +133,7 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
        echo "Generating deepcopy code for ${#input_pkgs[@]} targets"
 | 
			
		||||
 | 
			
		||||
        kube::codegen::internal::findz \
 | 
			
		||||
            "${root}" \
 | 
			
		||||
            "${in_dir}" \
 | 
			
		||||
            -type f \
 | 
			
		||||
            -name zz_generated.deepcopy.go \
 | 
			
		||||
            | xargs -0 rm -f
 | 
			
		||||
@@ -156,7 +146,6 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
            -v "${v}" \
 | 
			
		||||
            --output-file-base zz_generated.deepcopy \
 | 
			
		||||
            --go-header-file "${boilerplate}" \
 | 
			
		||||
            --output-base "${out_base}" \
 | 
			
		||||
            "${input_args[@]}"
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
@@ -169,7 +158,7 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
    done < <(
 | 
			
		||||
        ( kube::codegen::internal::grep -l --null \
 | 
			
		||||
            -e '+k8s:defaulter-gen=' \
 | 
			
		||||
            -r "${root}" \
 | 
			
		||||
            -r "${in_dir}" \
 | 
			
		||||
            --include '*.go' \
 | 
			
		||||
            || true \
 | 
			
		||||
        ) | while read -r -d $'\0' F; do dirname "${F}"; done \
 | 
			
		||||
@@ -180,7 +169,7 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
        echo "Generating defaulter code for ${#input_pkgs[@]} targets"
 | 
			
		||||
 | 
			
		||||
        kube::codegen::internal::findz \
 | 
			
		||||
            "${root}" \
 | 
			
		||||
            "${in_dir}" \
 | 
			
		||||
            -type f \
 | 
			
		||||
            -name zz_generated.defaults.go \
 | 
			
		||||
            | xargs -0 rm -f
 | 
			
		||||
@@ -193,7 +182,6 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
            -v "${v}" \
 | 
			
		||||
            --output-file-base zz_generated.defaults \
 | 
			
		||||
            --go-header-file "${boilerplate}" \
 | 
			
		||||
            --output-base "${out_base}" \
 | 
			
		||||
            "${input_args[@]}"
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
@@ -206,7 +194,7 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
    done < <(
 | 
			
		||||
        ( kube::codegen::internal::grep -l --null \
 | 
			
		||||
            -e '+k8s:conversion-gen=' \
 | 
			
		||||
            -r "${root}" \
 | 
			
		||||
            -r "${in_dir}" \
 | 
			
		||||
            --include '*.go' \
 | 
			
		||||
            || true \
 | 
			
		||||
        ) | while read -r -d $'\0' F; do dirname "${F}"; done \
 | 
			
		||||
@@ -217,7 +205,7 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
        echo "Generating conversion code for ${#input_pkgs[@]} targets"
 | 
			
		||||
 | 
			
		||||
        kube::codegen::internal::findz \
 | 
			
		||||
            "${root}" \
 | 
			
		||||
            "${in_dir}" \
 | 
			
		||||
            -type f \
 | 
			
		||||
            -name zz_generated.conversion.go \
 | 
			
		||||
            | xargs -0 rm -f
 | 
			
		||||
@@ -234,7 +222,6 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
            -v "${v}" \
 | 
			
		||||
            --output-file-base zz_generated.conversion \
 | 
			
		||||
            --go-header-file "${boilerplate}" \
 | 
			
		||||
            --output-base "${out_base}" \
 | 
			
		||||
            "${extra_peer_args[@]:+"${extra_peer_args[@]}"}" \
 | 
			
		||||
            "${input_args[@]}"
 | 
			
		||||
    fi
 | 
			
		||||
@@ -242,22 +229,21 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
 | 
			
		||||
# Generate openapi code
 | 
			
		||||
#
 | 
			
		||||
# Args:
 | 
			
		||||
#   --input-pkg-root <string>
 | 
			
		||||
#     The root package under which to search for files which request openapi to
 | 
			
		||||
#     be generated.  This must be Go package syntax, e.g.  "k8s.io/foo/bar".
 | 
			
		||||
# USAGE: kube::codegen::gen_openapi [FLAGS] <input-dir>
 | 
			
		||||
#
 | 
			
		||||
# <input-dir>
 | 
			
		||||
#   The root directory under which to search for Go files which request openapi
 | 
			
		||||
#   to be generated.  This must be a local path, not a Go package.
 | 
			
		||||
#
 | 
			
		||||
#   See note at the top about package structure below that.
 | 
			
		||||
#
 | 
			
		||||
#   --output-pkg-root <string>
 | 
			
		||||
#     The root package under which generated directories and files
 | 
			
		||||
#     will be placed.  This must be go package syntax, e.g. "k8s.io/foo/bar".
 | 
			
		||||
# FLAGS:
 | 
			
		||||
#
 | 
			
		||||
#   --output-base <string>
 | 
			
		||||
#     The root directory under which to emit code.  The concatenation of
 | 
			
		||||
#     <output-base> + <input-pkg-root> must be valid.
 | 
			
		||||
#   --output-dir <string>
 | 
			
		||||
#     The directory into which to emit code.
 | 
			
		||||
#
 | 
			
		||||
#   --openapi-name <string = "openapi">
 | 
			
		||||
#     An optional override for the leaf name of the generated directory.
 | 
			
		||||
#   --output-pkg <string>
 | 
			
		||||
#     The Go package path (import path) of the --output-dir.
 | 
			
		||||
#
 | 
			
		||||
#   --extra-pkgs <string>
 | 
			
		||||
#     An optional list of additional packages to be imported during openapi
 | 
			
		||||
@@ -276,10 +262,9 @@ function kube::codegen::gen_helpers() {
 | 
			
		||||
#     An optional override for the header file to insert into generated files.
 | 
			
		||||
#
 | 
			
		||||
function kube::codegen::gen_openapi() {
 | 
			
		||||
    local in_pkg_root=""
 | 
			
		||||
    local out_pkg_root=""
 | 
			
		||||
    local out_base="" # gengo needs the output dir must be $out_base/$out_pkg_root
 | 
			
		||||
    local openapi_subdir="openapi"
 | 
			
		||||
    local in_dir=""
 | 
			
		||||
    local out_dir=""
 | 
			
		||||
    local out_pkg=""
 | 
			
		||||
    local extra_pkgs=()
 | 
			
		||||
    local report="/dev/null"
 | 
			
		||||
    local update_report=""
 | 
			
		||||
@@ -288,20 +273,12 @@ function kube::codegen::gen_openapi() {
 | 
			
		||||
 | 
			
		||||
    while [ "$#" -gt 0 ]; do
 | 
			
		||||
        case "$1" in
 | 
			
		||||
            "--input-pkg-root")
 | 
			
		||||
                in_pkg_root="$2"
 | 
			
		||||
            "--output-dir")
 | 
			
		||||
                out_dir="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--output-pkg-root")
 | 
			
		||||
                out_pkg_root="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--output-base")
 | 
			
		||||
                out_base="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--openapi-name")
 | 
			
		||||
                openapi_subdir="$2"
 | 
			
		||||
            "--output-pkg")
 | 
			
		||||
                out_pkg="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--extra-pkgs")
 | 
			
		||||
@@ -321,22 +298,30 @@ function kube::codegen::gen_openapi() {
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            *)
 | 
			
		||||
                if [[ "$1" =~ ^-- ]]; then
 | 
			
		||||
                    echo "unknown argument: $1" >&2
 | 
			
		||||
                    return 1
 | 
			
		||||
                fi
 | 
			
		||||
                if [ -n "$in_dir" ]; then
 | 
			
		||||
                    echo "too many arguments: $1 (already have $in_dir)" >&2
 | 
			
		||||
                    return 1
 | 
			
		||||
                fi
 | 
			
		||||
                in_dir="$1"
 | 
			
		||||
                shift
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
    done
 | 
			
		||||
 | 
			
		||||
    if [ -z "${in_pkg_root}" ]; then
 | 
			
		||||
        echo "--input-pkg-root is required" >&2
 | 
			
		||||
    if [ -z "${in_dir}" ]; then
 | 
			
		||||
        echo "input-dir argument is required" >&2
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
    if [ -z "${out_pkg_root}" ]; then
 | 
			
		||||
        echo "--output-pkg-root is required" >&2
 | 
			
		||||
    if [ -z "${out_dir}" ]; then
 | 
			
		||||
        echo "--output-dir is required" >&2
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
    if [ -z "${out_base}" ]; then
 | 
			
		||||
        echo "--output-base is required" >&2
 | 
			
		||||
    if [ -z "${out_pkg}" ]; then
 | 
			
		||||
        echo "--output-pkg is required" >&2
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
@@ -359,11 +344,6 @@ function kube::codegen::gen_openapi() {
 | 
			
		||||
    # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise
 | 
			
		||||
    gobin="${GOBIN:-$(go env GOPATH)/bin}"
 | 
			
		||||
 | 
			
		||||
    # These tools all assume out-dir == in-dir.
 | 
			
		||||
    root="${out_base}/${in_pkg_root}"
 | 
			
		||||
    mkdir -p "${root}"
 | 
			
		||||
    root="$(cd "${root}" && pwd -P)"
 | 
			
		||||
 | 
			
		||||
    local input_pkgs=( "${extra_pkgs[@]:+"${extra_pkgs[@]}"}")
 | 
			
		||||
    while read -r dir; do
 | 
			
		||||
        pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)"
 | 
			
		||||
@@ -371,7 +351,7 @@ function kube::codegen::gen_openapi() {
 | 
			
		||||
    done < <(
 | 
			
		||||
        ( kube::codegen::internal::grep -l --null \
 | 
			
		||||
            -e '+k8s:openapi-gen=' \
 | 
			
		||||
            -r "${root}" \
 | 
			
		||||
            -r "${in_dir}" \
 | 
			
		||||
            --include '*.go' \
 | 
			
		||||
            || true \
 | 
			
		||||
        ) | while read -r -d $'\0' F; do dirname "${F}"; done \
 | 
			
		||||
@@ -382,7 +362,7 @@ function kube::codegen::gen_openapi() {
 | 
			
		||||
        echo "Generating openapi code for ${#input_pkgs[@]} targets"
 | 
			
		||||
 | 
			
		||||
        kube::codegen::internal::findz \
 | 
			
		||||
            "${root}" \
 | 
			
		||||
            "${in_dir}" \
 | 
			
		||||
            -type f \
 | 
			
		||||
            -name zz_generated.openapi.go \
 | 
			
		||||
            | xargs -0 rm -f
 | 
			
		||||
@@ -395,8 +375,8 @@ function kube::codegen::gen_openapi() {
 | 
			
		||||
            -v "${v}" \
 | 
			
		||||
            --output-file-base zz_generated.openapi \
 | 
			
		||||
            --go-header-file "${boilerplate}" \
 | 
			
		||||
            --output-base "${out_base}" \
 | 
			
		||||
            --output-package "${out_pkg_root}/${openapi_subdir}" \
 | 
			
		||||
            --output-base "${out_dir}" \
 | 
			
		||||
            --output-package "${out_pkg}" \
 | 
			
		||||
            --report-filename "${new_report}" \
 | 
			
		||||
            --input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1" \
 | 
			
		||||
            --input-dirs "k8s.io/apimachinery/pkg/runtime" \
 | 
			
		||||
@@ -415,25 +395,27 @@ function kube::codegen::gen_openapi() {
 | 
			
		||||
 | 
			
		||||
# Generate client code
 | 
			
		||||
#
 | 
			
		||||
# Args:
 | 
			
		||||
#   --input-pkg-root <string>
 | 
			
		||||
#     The root package under which to search for *.go files which request
 | 
			
		||||
#     clients to be generated.  This must be Go package syntax, e.g.
 | 
			
		||||
#     "k8s.io/foo/bar".
 | 
			
		||||
# USAGE: kube::codegen::gen_client [FLAGS] <input-dir>
 | 
			
		||||
#
 | 
			
		||||
# <input-dir>
 | 
			
		||||
#   The root package under which to search for Go files which request clients
 | 
			
		||||
#   to be generated. This must be a local path, not a Go package.
 | 
			
		||||
#
 | 
			
		||||
#   See note at the top about package structure below that.
 | 
			
		||||
#
 | 
			
		||||
# FLAGS:
 | 
			
		||||
#   --one-input-api <string>
 | 
			
		||||
#     A specific API (a directory) under the --input-pkg-root for which to
 | 
			
		||||
#     generate a client.  If this is not set, clients for all APIs under the
 | 
			
		||||
#     input root will be generated (under the --output-pkg-root).
 | 
			
		||||
#     A specific API (a directory) under the input-dir for which to generate a
 | 
			
		||||
#     client.  If this is not set, clients for all APIs under the input-dir
 | 
			
		||||
#     will be generated (under the --output-pkg).
 | 
			
		||||
#
 | 
			
		||||
#   --output-pkg-root <string>
 | 
			
		||||
#     The root package into which generated directories and files will be
 | 
			
		||||
#     placed.  This must be Go package syntax, e.g. "k8s.io/foo/bar".
 | 
			
		||||
#   --output-dir <string>
 | 
			
		||||
#     The root directory under which to emit code.  Each aspect of client
 | 
			
		||||
#     generation will make one or more subdirectories.
 | 
			
		||||
#
 | 
			
		||||
#   --output-base <string>
 | 
			
		||||
#     The root directory under which to emit code.  The concatenation of
 | 
			
		||||
#     <output-base> + <output-pkg-root> must be valid.
 | 
			
		||||
#   --output-pkg <string>
 | 
			
		||||
#     The Go package path (import path) of the --output-dir.  Each aspect of
 | 
			
		||||
#     client generation will make one or more sub-packages.
 | 
			
		||||
#
 | 
			
		||||
#   --boilerplate <string = path_to_kube_codegen_boilerplate>
 | 
			
		||||
#     An optional override for the header file to insert into generated files.
 | 
			
		||||
@@ -468,10 +450,10 @@ function kube::codegen::gen_openapi() {
 | 
			
		||||
#     An optional list of comma separated plural exception definitions in Type:PluralizedType form.
 | 
			
		||||
#
 | 
			
		||||
function kube::codegen::gen_client() {
 | 
			
		||||
    local in_pkg_root=""
 | 
			
		||||
    local in_dir=""
 | 
			
		||||
    local one_input_api=""
 | 
			
		||||
    local out_pkg_root=""
 | 
			
		||||
    local out_base="" # gengo needs the output dir must be $out_base/$out_pkg_root
 | 
			
		||||
    local out_dir=""
 | 
			
		||||
    local out_pkg=""
 | 
			
		||||
    local clientset_subdir="clientset"
 | 
			
		||||
    local clientset_versioned_name="versioned"
 | 
			
		||||
    local applyconfig="false"
 | 
			
		||||
@@ -486,20 +468,16 @@ function kube::codegen::gen_client() {
 | 
			
		||||
 | 
			
		||||
    while [ "$#" -gt 0 ]; do
 | 
			
		||||
        case "$1" in
 | 
			
		||||
            "--input-pkg-root")
 | 
			
		||||
                in_pkg_root="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--one-input-api")
 | 
			
		||||
                one_input_api="/$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--output-pkg-root")
 | 
			
		||||
                out_pkg_root="$2"
 | 
			
		||||
            "--output-dir")
 | 
			
		||||
                out_dir="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--output-base")
 | 
			
		||||
                out_base="$2"
 | 
			
		||||
            "--output-pkg")
 | 
			
		||||
                out_pkg="$2"
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            "--boilerplate")
 | 
			
		||||
@@ -543,25 +521,34 @@ function kube::codegen::gen_client() {
 | 
			
		||||
                shift 2
 | 
			
		||||
                ;;
 | 
			
		||||
            *)
 | 
			
		||||
                if [[ "$1" =~ ^-- ]]; then
 | 
			
		||||
                    echo "unknown argument: $1" >&2
 | 
			
		||||
                    return 1
 | 
			
		||||
                fi
 | 
			
		||||
                if [ -n "$in_dir" ]; then
 | 
			
		||||
                    echo "too many arguments: $1 (already have $in_dir)" >&2
 | 
			
		||||
                    return 1
 | 
			
		||||
                fi
 | 
			
		||||
                in_dir="$1"
 | 
			
		||||
                shift
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
    done
 | 
			
		||||
 | 
			
		||||
    if [ -z "${in_pkg_root}" ]; then
 | 
			
		||||
        echo "--input-pkg-root is required" >&2
 | 
			
		||||
    if [ -z "${in_dir}" ]; then
 | 
			
		||||
        echo "input-dir argument is required" >&2
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
    if [ -z "${out_pkg_root}" ]; then
 | 
			
		||||
        echo "--output-pkg-root is required" >&2
 | 
			
		||||
    if [ -z "${out_dir}" ]; then
 | 
			
		||||
        echo "--output-dir is required" >&2
 | 
			
		||||
        return 1
 | 
			
		||||
    fi
 | 
			
		||||
    if [ -z "${out_base}" ]; then
 | 
			
		||||
        echo "--output-base is required" >&2
 | 
			
		||||
        return 1
 | 
			
		||||
    if [ -z "${out_pkg}" ]; then
 | 
			
		||||
        echo "--output-pkg is required" >&2
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    mkdir -p "${out_dir}"
 | 
			
		||||
 | 
			
		||||
    (
 | 
			
		||||
        # To support running this from anywhere, first cd into this directory,
 | 
			
		||||
        # and then install with forced module mode on and fully qualified name.
 | 
			
		||||
@@ -578,13 +565,6 @@ function kube::codegen::gen_client() {
 | 
			
		||||
    # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise
 | 
			
		||||
    gobin="${GOBIN:-$(go env GOPATH)/bin}"
 | 
			
		||||
 | 
			
		||||
    in_root="${out_base}/${in_pkg_root}"
 | 
			
		||||
    mkdir -p "${in_root}"
 | 
			
		||||
    in_root="$(cd "${in_root}" && pwd -P)"
 | 
			
		||||
    out_root="${out_base}/${out_pkg_root}"
 | 
			
		||||
    mkdir -p "${out_root}"
 | 
			
		||||
    out_root="$(cd "${out_root}" && pwd -P)"
 | 
			
		||||
 | 
			
		||||
    local group_versions=()
 | 
			
		||||
    local input_pkgs=()
 | 
			
		||||
    while read -r dir; do
 | 
			
		||||
@@ -600,7 +580,7 @@ function kube::codegen::gen_client() {
 | 
			
		||||
    done < <(
 | 
			
		||||
        ( kube::codegen::internal::grep -l --null \
 | 
			
		||||
            -e '+genclient' \
 | 
			
		||||
            -r "${in_root}${one_input_api}" \
 | 
			
		||||
            -r "${in_dir}${one_input_api}" \
 | 
			
		||||
            --include '*.go' \
 | 
			
		||||
            || true \
 | 
			
		||||
        ) | while read -r -d $'\0' F; do dirname "${F}"; done \
 | 
			
		||||
@@ -613,13 +593,13 @@ function kube::codegen::gen_client() {
 | 
			
		||||
 | 
			
		||||
    applyconfig_pkg="" # set this for later use, iff enabled
 | 
			
		||||
    if [ "${applyconfig}" == "true" ]; then
 | 
			
		||||
        applyconfig_pkg="${out_pkg_root}/${applyconfig_subdir}"
 | 
			
		||||
        applyconfig_pkg="${out_pkg}/${applyconfig_subdir}"
 | 
			
		||||
 | 
			
		||||
        echo "Generating applyconfig code for ${#input_pkgs[@]} targets"
 | 
			
		||||
 | 
			
		||||
        ( kube::codegen::internal::grep -l --null \
 | 
			
		||||
            -e '^// Code generated by applyconfiguration-gen. DO NOT EDIT.$' \
 | 
			
		||||
            -r "${out_root}/${applyconfig_subdir}" \
 | 
			
		||||
            -r "${out_dir}/${applyconfig_subdir}" \
 | 
			
		||||
            --include '*.go' \
 | 
			
		||||
            || true \
 | 
			
		||||
        ) | xargs -0 rm -f
 | 
			
		||||
@@ -631,8 +611,8 @@ function kube::codegen::gen_client() {
 | 
			
		||||
        "${gobin}/applyconfiguration-gen" \
 | 
			
		||||
            -v "${v}" \
 | 
			
		||||
            --go-header-file "${boilerplate}" \
 | 
			
		||||
            --output-base "${out_base}" \
 | 
			
		||||
            --output-package "${out_pkg_root}/${applyconfig_subdir}" \
 | 
			
		||||
            --output-base "${out_dir}/${applyconfig_subdir}" \
 | 
			
		||||
            --output-package "${applyconfig_pkg}" \
 | 
			
		||||
            --external-applyconfigurations "${applyconfig_external}" \
 | 
			
		||||
            "${inputs[@]}"
 | 
			
		||||
    fi
 | 
			
		||||
@@ -641,7 +621,7 @@ function kube::codegen::gen_client() {
 | 
			
		||||
 | 
			
		||||
    ( kube::codegen::internal::grep -l --null \
 | 
			
		||||
        -e '^// Code generated by client-gen. DO NOT EDIT.$' \
 | 
			
		||||
        -r "${out_root}/${clientset_subdir}" \
 | 
			
		||||
        -r "${out_dir}/${clientset_subdir}" \
 | 
			
		||||
        --include '*.go' \
 | 
			
		||||
        || true \
 | 
			
		||||
    ) | xargs -0 rm -f
 | 
			
		||||
@@ -653,11 +633,11 @@ function kube::codegen::gen_client() {
 | 
			
		||||
     "${gobin}/client-gen" \
 | 
			
		||||
        -v "${v}" \
 | 
			
		||||
        --go-header-file "${boilerplate}" \
 | 
			
		||||
        --output-base "${out_dir}/${clientset_subdir}" \
 | 
			
		||||
        --output-package "${out_pkg}/${clientset_subdir}" \
 | 
			
		||||
        --clientset-name "${clientset_versioned_name}" \
 | 
			
		||||
        --input-base "${in_pkg_root}" \
 | 
			
		||||
        --output-base "${out_base}" \
 | 
			
		||||
        --output-package "${out_pkg_root}/${clientset_subdir}" \
 | 
			
		||||
        --apply-configuration-package "${applyconfig_pkg}" \
 | 
			
		||||
        --input-base "$(cd "${in_dir}" && pwd -P)" `# must be absolute path or Go import path"` \
 | 
			
		||||
        --plural-exceptions "${plural_exceptions}" \
 | 
			
		||||
        "${inputs[@]}"
 | 
			
		||||
 | 
			
		||||
@@ -666,7 +646,7 @@ function kube::codegen::gen_client() {
 | 
			
		||||
 | 
			
		||||
        ( kube::codegen::internal::grep -l --null \
 | 
			
		||||
            -e '^// Code generated by lister-gen. DO NOT EDIT.$' \
 | 
			
		||||
            -r "${out_root}/${listers_subdir}" \
 | 
			
		||||
            -r "${out_dir}/${listers_subdir}" \
 | 
			
		||||
            --include '*.go' \
 | 
			
		||||
            || true \
 | 
			
		||||
        ) | xargs -0 rm -f
 | 
			
		||||
@@ -678,8 +658,8 @@ function kube::codegen::gen_client() {
 | 
			
		||||
        "${gobin}/lister-gen" \
 | 
			
		||||
            -v "${v}" \
 | 
			
		||||
            --go-header-file "${boilerplate}" \
 | 
			
		||||
            --output-base "${out_base}" \
 | 
			
		||||
            --output-package "${out_pkg_root}/${listers_subdir}" \
 | 
			
		||||
            --output-base "${out_dir}/${listers_subdir}" \
 | 
			
		||||
            --output-package "${out_pkg}/${listers_subdir}" \
 | 
			
		||||
            --plural-exceptions "${plural_exceptions}" \
 | 
			
		||||
            "${inputs[@]}"
 | 
			
		||||
 | 
			
		||||
@@ -687,7 +667,7 @@ function kube::codegen::gen_client() {
 | 
			
		||||
 | 
			
		||||
        ( kube::codegen::internal::grep -l --null \
 | 
			
		||||
            -e '^// Code generated by informer-gen. DO NOT EDIT.$' \
 | 
			
		||||
            -r "${out_root}/${informers_subdir}" \
 | 
			
		||||
            -r "${out_dir}/${informers_subdir}" \
 | 
			
		||||
            --include '*.go' \
 | 
			
		||||
            || true \
 | 
			
		||||
        ) | xargs -0 rm -f
 | 
			
		||||
@@ -699,10 +679,10 @@ function kube::codegen::gen_client() {
 | 
			
		||||
        "${gobin}/informer-gen" \
 | 
			
		||||
            -v "${v}" \
 | 
			
		||||
            --go-header-file "${boilerplate}" \
 | 
			
		||||
            --output-base "${out_base}" \
 | 
			
		||||
            --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}" \
 | 
			
		||||
            --output-base "${out_dir}/${informers_subdir}" \
 | 
			
		||||
            --output-package "${out_pkg}/${informers_subdir}" \
 | 
			
		||||
            --versioned-clientset-package "${out_pkg}/${clientset_subdir}/${clientset_versioned_name}" \
 | 
			
		||||
            --listers-package "${out_pkg}/${listers_subdir}" \
 | 
			
		||||
            --plural-exceptions "${plural_exceptions}" \
 | 
			
		||||
            "${inputs[@]}"
 | 
			
		||||
    fi
 | 
			
		||||
 
 | 
			
		||||
@@ -23,10 +23,11 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-
 | 
			
		||||
 | 
			
		||||
source "${CODEGEN_PKG}/kube_codegen.sh"
 | 
			
		||||
 | 
			
		||||
THIS_PKG="k8s.io/kube-aggregator"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_helpers \
 | 
			
		||||
    --input-pkg-root k8s.io/kube-aggregator/pkg/apis \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 | 
			
		||||
if [[ -n "${API_KNOWN_VIOLATIONS_DIR:-}" ]]; then
 | 
			
		||||
    report_filename="${API_KNOWN_VIOLATIONS_DIR}/aggregator_violation_exceptions.list"
 | 
			
		||||
@@ -36,18 +37,18 @@ if [[ -n "${API_KNOWN_VIOLATIONS_DIR:-}" ]]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_openapi \
 | 
			
		||||
    --input-pkg-root k8s.io/kube-aggregator/pkg/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/kube-aggregator/pkg/generated \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/pkg/generated/openapi" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/pkg/generated/openapi" \
 | 
			
		||||
    --report-filename "${report_filename:-"/dev/null"}" \
 | 
			
		||||
    ${update_report:+"${update_report}"} \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --with-watch \
 | 
			
		||||
    --input-pkg-root k8s.io/kube-aggregator/pkg/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/kube-aggregator/pkg/client \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --clientset-name clientset_generated \
 | 
			
		||||
    --versioned-name clientset \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/pkg/client" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/pkg/client" \
 | 
			
		||||
    --clientset-name "clientset_generated" \
 | 
			
		||||
    --versioned-name "clientset" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 
 | 
			
		||||
@@ -23,21 +23,17 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-
 | 
			
		||||
 | 
			
		||||
source "${CODEGEN_PKG}/kube_codegen.sh"
 | 
			
		||||
 | 
			
		||||
# generate the code with:
 | 
			
		||||
# --output-base    because this script should also be able to run inside the vendor dir of
 | 
			
		||||
#                  k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
 | 
			
		||||
#                  instead of the $GOPATH directly. For normal projects this can be dropped.
 | 
			
		||||
#
 | 
			
		||||
THIS_PKG="k8s.io/metrics"
 | 
			
		||||
 | 
			
		||||
# we skip informers and listers for metrics, because we don't quite support the requisite operations yet
 | 
			
		||||
# we skip generating the internal clientset as it's not really needed
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_helpers \
 | 
			
		||||
    --input-pkg-root k8s.io/metrics/pkg/apis \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --input-pkg-root k8s.io/metrics/pkg/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/metrics/pkg/client \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/pkg/client" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/pkg/client" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 
 | 
			
		||||
@@ -23,15 +23,11 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-
 | 
			
		||||
 | 
			
		||||
source "${CODEGEN_PKG}/kube_codegen.sh"
 | 
			
		||||
 | 
			
		||||
# generate the code with:
 | 
			
		||||
# --output-base    because this script should also be able to run inside the vendor dir of
 | 
			
		||||
#                  k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
 | 
			
		||||
#                  instead of the $GOPATH directly. For normal projects this can be dropped.
 | 
			
		||||
THIS_PKG="k8s.io/sample-apiserver"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_helpers \
 | 
			
		||||
    --input-pkg-root k8s.io/sample-apiserver/pkg/apis \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 | 
			
		||||
if [[ -n "${API_KNOWN_VIOLATIONS_DIR:-}" ]]; then
 | 
			
		||||
    report_filename="${API_KNOWN_VIOLATIONS_DIR}/sample_apiserver_violation_exceptions.list"
 | 
			
		||||
@@ -41,17 +37,17 @@ if [[ -n "${API_KNOWN_VIOLATIONS_DIR:-}" ]]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_openapi \
 | 
			
		||||
    --input-pkg-root k8s.io/sample-apiserver/pkg/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/sample-apiserver/pkg/generated \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/pkg/generated/openapi" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/pkg/generated/openapi" \
 | 
			
		||||
    --report-filename "${report_filename:-"/dev/null"}" \
 | 
			
		||||
    ${update_report:+"${update_report}"} \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --with-watch \
 | 
			
		||||
    --with-applyconfig \
 | 
			
		||||
    --input-pkg-root k8s.io/sample-apiserver/pkg/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/sample-apiserver/pkg/generated \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/pkg/generated" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/pkg/generated" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 
 | 
			
		||||
@@ -23,19 +23,15 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-
 | 
			
		||||
 | 
			
		||||
source "${CODEGEN_PKG}/kube_codegen.sh"
 | 
			
		||||
 | 
			
		||||
# generate the code with:
 | 
			
		||||
# --output-base    because this script should also be able to run inside the vendor dir of
 | 
			
		||||
#                  k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
 | 
			
		||||
#                  instead of the $GOPATH directly. For normal projects this can be dropped.
 | 
			
		||||
THIS_PKG="k8s.io/sample-controller"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_helpers \
 | 
			
		||||
    --input-pkg-root k8s.io/sample-controller/pkg/apis \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 | 
			
		||||
kube::codegen::gen_client \
 | 
			
		||||
    --with-watch \
 | 
			
		||||
    --input-pkg-root k8s.io/sample-controller/pkg/apis \
 | 
			
		||||
    --output-pkg-root k8s.io/sample-controller/pkg/generated \
 | 
			
		||||
    --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt"
 | 
			
		||||
    --output-dir "${SCRIPT_ROOT}/pkg/generated" \
 | 
			
		||||
    --output-pkg "${THIS_PKG}/pkg/generated" \
 | 
			
		||||
    --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
 | 
			
		||||
    "${SCRIPT_ROOT}/pkg/apis"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user