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