mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 03:57:41 +00:00
Make hack scripts use go install
and assume PATH
Now that they all call setup_env, we don't need find-binary (I think). That was originally meant to hide the diff between docker and local builds but all these tools do local builds anyway.
This commit is contained in:
parent
ea3696dbcf
commit
8288c06b2b
@ -33,14 +33,12 @@ kube::golang::setup_env
|
|||||||
GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf
|
GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf
|
||||||
GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo
|
GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo
|
||||||
|
|
||||||
gotoprotobuf=$(kube::util::find-binary "go-to-protobuf")
|
|
||||||
|
|
||||||
# requires the 'proto' tag to build (will remove when ready)
|
# requires the 'proto' tag to build (will remove when ready)
|
||||||
# searches for the protoc-gen-gogo extension in the output directory
|
# searches for the protoc-gen-gogo extension in the output directory
|
||||||
# satisfies import of github.com/gogo/protobuf/gogoproto/gogo.proto and the
|
# satisfies import of github.com/gogo/protobuf/gogoproto/gogo.proto and the
|
||||||
# core Google protobuf types
|
# core Google protobuf types
|
||||||
PATH="${KUBE_ROOT}/_output/bin:${PATH}" \
|
PATH="${KUBE_ROOT}/_output/bin:${PATH}" \
|
||||||
"${gotoprotobuf}" \
|
go-to-protobuf \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--go-header-file "${KUBE_ROOT}/hack/boilerplate/boilerplate.generatego.txt" \
|
--go-header-file "${KUBE_ROOT}/hack/boilerplate/boilerplate.generatego.txt" \
|
||||||
--output-dir="${KUBE_ROOT}/staging/src" \
|
--output-dir="${KUBE_ROOT}/staging/src" \
|
||||||
|
@ -142,10 +142,6 @@ function codegen::deepcopy() {
|
|||||||
# The result file, in each pkg, of deep-copy generation.
|
# The result file, in each pkg, of deep-copy generation.
|
||||||
local output_file="${GENERATED_FILE_PREFIX}deepcopy.go"
|
local output_file="${GENERATED_FILE_PREFIX}deepcopy.go"
|
||||||
|
|
||||||
# The tool used to generate deep copies.
|
|
||||||
local gen_deepcopy_bin
|
|
||||||
gen_deepcopy_bin="$(kube::util::find-binary "deepcopy-gen")"
|
|
||||||
|
|
||||||
# Find all the directories that request deep-copy generation.
|
# Find all the directories that request deep-copy generation.
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: finding all +k8s:deepcopy-gen tags"
|
kube::log::status "DBG: finding all +k8s:deepcopy-gen tags"
|
||||||
@ -166,7 +162,7 @@ function codegen::deepcopy() {
|
|||||||
|
|
||||||
kube::log::status "Generating deepcopy code for ${#tag_pkgs[@]} targets"
|
kube::log::status "Generating deepcopy code for ${#tag_pkgs[@]} targets"
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${gen_deepcopy_bin} for:"
|
kube::log::status "DBG: running deepcopy-gen for:"
|
||||||
for dir in "${tag_dirs[@]}"; do
|
for dir in "${tag_dirs[@]}"; do
|
||||||
kube::log::status "DBG: $dir"
|
kube::log::status "DBG: $dir"
|
||||||
done
|
done
|
||||||
@ -174,7 +170,7 @@ function codegen::deepcopy() {
|
|||||||
|
|
||||||
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
||||||
|
|
||||||
"${gen_deepcopy_bin}" \
|
deepcopy-gen \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||||
--output-file "${output_file}" \
|
--output-file "${output_file}" \
|
||||||
@ -192,17 +188,13 @@ function codegen::deepcopy() {
|
|||||||
# $2: Path to the directory where types.go for that group version exists. This
|
# $2: Path to the directory where types.go for that group version exists. This
|
||||||
# is the directory where the file will be generated.
|
# is the directory where the file will be generated.
|
||||||
function gen_types_swagger_doc() {
|
function gen_types_swagger_doc() {
|
||||||
# The tool used to generate swagger code.
|
|
||||||
local swagger_bin
|
|
||||||
swagger_bin="$(kube::util::find-binary "genswaggertypedocs")"
|
|
||||||
|
|
||||||
local group_version="$1"
|
local group_version="$1"
|
||||||
local gv_dir="$2"
|
local gv_dir="$2"
|
||||||
local tmpfile
|
local tmpfile
|
||||||
tmpfile="${TMPDIR:-/tmp}/types_swagger_doc_generated.$(date +%s).go"
|
tmpfile="${TMPDIR:-/tmp}/types_swagger_doc_generated.$(date +%s).go"
|
||||||
|
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${swagger_bin} for ${group_version} at ${gv_dir}"
|
kube::log::status "DBG: running genswaggertypedocs for ${group_version} at ${gv_dir}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -227,7 +219,7 @@ function gen_types_swagger_doc() {
|
|||||||
EOF
|
EOF
|
||||||
} > "${tmpfile}"
|
} > "${tmpfile}"
|
||||||
|
|
||||||
"${swagger_bin}" \
|
genswaggertypedocs \
|
||||||
-s \
|
-s \
|
||||||
"${gv_dir}/types.go" \
|
"${gv_dir}/types.go" \
|
||||||
-f - \
|
-f - \
|
||||||
@ -274,10 +266,6 @@ function codegen::prerelease() {
|
|||||||
# The result file, in each pkg, of prerelease-lifecycle generation.
|
# The result file, in each pkg, of prerelease-lifecycle generation.
|
||||||
local output_file="${GENERATED_FILE_PREFIX}prerelease-lifecycle.go"
|
local output_file="${GENERATED_FILE_PREFIX}prerelease-lifecycle.go"
|
||||||
|
|
||||||
# The tool used to generate prerelease-lifecycle code.
|
|
||||||
local gen_prerelease_bin
|
|
||||||
gen_prerelease_bin="$(kube::util::find-binary "prerelease-lifecycle-gen")"
|
|
||||||
|
|
||||||
# Find all the directories that request prerelease-lifecycle generation.
|
# Find all the directories that request prerelease-lifecycle generation.
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: finding all +k8s:prerelease-lifecycle-gen tags"
|
kube::log::status "DBG: finding all +k8s:prerelease-lifecycle-gen tags"
|
||||||
@ -298,7 +286,7 @@ function codegen::prerelease() {
|
|||||||
|
|
||||||
kube::log::status "Generating prerelease-lifecycle code for ${#tag_pkgs[@]} targets"
|
kube::log::status "Generating prerelease-lifecycle code for ${#tag_pkgs[@]} targets"
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${gen_prerelease_bin} for:"
|
kube::log::status "DBG: running prerelease-lifecycle-gen for:"
|
||||||
for dir in "${tag_dirs[@]}"; do
|
for dir in "${tag_dirs[@]}"; do
|
||||||
kube::log::status "DBG: $dir"
|
kube::log::status "DBG: $dir"
|
||||||
done
|
done
|
||||||
@ -306,7 +294,7 @@ function codegen::prerelease() {
|
|||||||
|
|
||||||
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
||||||
|
|
||||||
"${gen_prerelease_bin}" \
|
prerelease-lifecycle-gen \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||||
--output-file "${output_file}" \
|
--output-file "${output_file}" \
|
||||||
@ -342,10 +330,6 @@ function codegen::defaults() {
|
|||||||
# The result file, in each pkg, of defaulter generation.
|
# The result file, in each pkg, of defaulter generation.
|
||||||
local output_file="${GENERATED_FILE_PREFIX}defaults.go"
|
local output_file="${GENERATED_FILE_PREFIX}defaults.go"
|
||||||
|
|
||||||
# The tool used to generate defaulters.
|
|
||||||
local gen_defaulter_bin
|
|
||||||
gen_defaulter_bin="$(kube::util::find-binary "defaulter-gen")"
|
|
||||||
|
|
||||||
# All directories that request any form of defaulter generation.
|
# All directories that request any form of defaulter generation.
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: finding all +k8s:defaulter-gen tags"
|
kube::log::status "DBG: finding all +k8s:defaulter-gen tags"
|
||||||
@ -366,7 +350,7 @@ function codegen::defaults() {
|
|||||||
|
|
||||||
kube::log::status "Generating defaulter code for ${#tag_pkgs[@]} targets"
|
kube::log::status "Generating defaulter code for ${#tag_pkgs[@]} targets"
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${gen_defaulter_bin} for:"
|
kube::log::status "DBG: running defaulter-gen for:"
|
||||||
for dir in "${tag_dirs[@]}"; do
|
for dir in "${tag_dirs[@]}"; do
|
||||||
kube::log::status "DBG: $dir"
|
kube::log::status "DBG: $dir"
|
||||||
done
|
done
|
||||||
@ -374,7 +358,7 @@ function codegen::defaults() {
|
|||||||
|
|
||||||
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
||||||
|
|
||||||
"${gen_defaulter_bin}" \
|
defaulter-gen \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||||
--output-file "${output_file}" \
|
--output-file "${output_file}" \
|
||||||
@ -415,10 +399,6 @@ function codegen::conversions() {
|
|||||||
# The result file, in each pkg, of conversion generation.
|
# The result file, in each pkg, of conversion generation.
|
||||||
local output_file="${GENERATED_FILE_PREFIX}conversion.go"
|
local output_file="${GENERATED_FILE_PREFIX}conversion.go"
|
||||||
|
|
||||||
# The tool used to generate conversions.
|
|
||||||
local gen_conversion_bin
|
|
||||||
gen_conversion_bin="$(kube::util::find-binary "conversion-gen")"
|
|
||||||
|
|
||||||
# All directories that request any form of conversion generation.
|
# All directories that request any form of conversion generation.
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: finding all +k8s:conversion-gen tags"
|
kube::log::status "DBG: finding all +k8s:conversion-gen tags"
|
||||||
@ -445,7 +425,7 @@ function codegen::conversions() {
|
|||||||
|
|
||||||
kube::log::status "Generating conversion code for ${#tag_pkgs[@]} targets"
|
kube::log::status "Generating conversion code for ${#tag_pkgs[@]} targets"
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${gen_conversion_bin} for:"
|
kube::log::status "DBG: running conversion-gen for:"
|
||||||
for dir in "${tag_dirs[@]}"; do
|
for dir in "${tag_dirs[@]}"; do
|
||||||
kube::log::status "DBG: $dir"
|
kube::log::status "DBG: $dir"
|
||||||
done
|
done
|
||||||
@ -453,7 +433,7 @@ function codegen::conversions() {
|
|||||||
|
|
||||||
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
git_find -z ':(glob)**'/"${output_file}" | xargs -0 rm -f
|
||||||
|
|
||||||
"${gen_conversion_bin}" \
|
conversion-gen \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||||
--output-file "${output_file}" \
|
--output-file "${output_file}" \
|
||||||
@ -497,10 +477,6 @@ function codegen::openapi() {
|
|||||||
# The result file, in each pkg, of open-api generation.
|
# The result file, in each pkg, of open-api generation.
|
||||||
local output_file="${GENERATED_FILE_PREFIX}openapi.go"
|
local output_file="${GENERATED_FILE_PREFIX}openapi.go"
|
||||||
|
|
||||||
# The tool used to generate open apis.
|
|
||||||
local gen_openapi_bin
|
|
||||||
gen_openapi_bin="$(kube::util::find-binary "openapi-gen")"
|
|
||||||
|
|
||||||
local output_dir="pkg/generated/openapi"
|
local output_dir="pkg/generated/openapi"
|
||||||
local output_pkg="k8s.io/kubernetes/${output_dir}"
|
local output_pkg="k8s.io/kubernetes/${output_dir}"
|
||||||
local known_violations_file="${API_KNOWN_VIOLATIONS_DIR}/violation_exceptions.list"
|
local known_violations_file="${API_KNOWN_VIOLATIONS_DIR}/violation_exceptions.list"
|
||||||
@ -540,7 +516,7 @@ function codegen::openapi() {
|
|||||||
|
|
||||||
kube::log::status "Generating openapi code"
|
kube::log::status "Generating openapi code"
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${gen_openapi_bin} for:"
|
kube::log::status "DBG: running openapi-gen for:"
|
||||||
for dir in "${tag_dirs[@]}"; do
|
for dir in "${tag_dirs[@]}"; do
|
||||||
kube::log::status "DBG: $dir"
|
kube::log::status "DBG: $dir"
|
||||||
done
|
done
|
||||||
@ -548,7 +524,7 @@ function codegen::openapi() {
|
|||||||
|
|
||||||
git_find -z ':(glob)pkg/generated/**'/"${output_file}" | xargs -0 rm -f
|
git_find -z ':(glob)pkg/generated/**'/"${output_file}" | xargs -0 rm -f
|
||||||
|
|
||||||
"${gen_openapi_bin}" \
|
openapi-gen \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||||
--output-file "${output_file}" \
|
--output-file "${output_file}" \
|
||||||
@ -576,11 +552,6 @@ function codegen::applyconfigs() {
|
|||||||
k8s.io/kubernetes/pkg/generated/openapi/cmd/models-schema \
|
k8s.io/kubernetes/pkg/generated/openapi/cmd/models-schema \
|
||||||
k8s.io/code-generator/cmd/applyconfiguration-gen
|
k8s.io/code-generator/cmd/applyconfiguration-gen
|
||||||
|
|
||||||
local modelsschema
|
|
||||||
modelsschema=$(kube::util::find-binary "models-schema")
|
|
||||||
local applyconfigurationgen
|
|
||||||
applyconfigurationgen=$(kube::util::find-binary "applyconfiguration-gen")
|
|
||||||
|
|
||||||
local ext_apis=()
|
local ext_apis=()
|
||||||
kube::util::read-array ext_apis < <(
|
kube::util::read-array ext_apis < <(
|
||||||
cd "${KUBE_ROOT}/staging/src"
|
cd "${KUBE_ROOT}/staging/src"
|
||||||
@ -591,7 +562,7 @@ function codegen::applyconfigs() {
|
|||||||
|
|
||||||
kube::log::status "Generating apply-config code for ${#ext_apis[@]} targets"
|
kube::log::status "Generating apply-config code for ${#ext_apis[@]} targets"
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${applyconfigurationgen} for:"
|
kube::log::status "DBG: running applyconfiguration-gen for:"
|
||||||
for api in "${ext_apis[@]}"; do
|
for api in "${ext_apis[@]}"; do
|
||||||
kube::log::status "DBG: $api"
|
kube::log::status "DBG: $api"
|
||||||
done
|
done
|
||||||
@ -604,9 +575,9 @@ function codegen::applyconfigs() {
|
|||||||
|| true) \
|
|| true) \
|
||||||
| xargs -0 rm -f
|
| xargs -0 rm -f
|
||||||
|
|
||||||
"${applyconfigurationgen}" \
|
applyconfiguration-gen \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--openapi-schema <("${modelsschema}") \
|
--openapi-schema <(models-schema) \
|
||||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||||
--output-dir "${KUBE_ROOT}/staging/src/${APPLYCONFIG_PKG}" \
|
--output-dir "${KUBE_ROOT}/staging/src/${APPLYCONFIG_PKG}" \
|
||||||
--output-pkg "${APPLYCONFIG_PKG}" \
|
--output-pkg "${APPLYCONFIG_PKG}" \
|
||||||
@ -622,9 +593,6 @@ function codegen::clients() {
|
|||||||
GOPROXY=off go install \
|
GOPROXY=off go install \
|
||||||
k8s.io/code-generator/cmd/client-gen
|
k8s.io/code-generator/cmd/client-gen
|
||||||
|
|
||||||
local clientgen
|
|
||||||
clientgen=$(kube::util::find-binary "client-gen")
|
|
||||||
|
|
||||||
IFS=" " read -r -a group_versions <<< "${KUBE_AVAILABLE_GROUP_VERSIONS}"
|
IFS=" " read -r -a group_versions <<< "${KUBE_AVAILABLE_GROUP_VERSIONS}"
|
||||||
local gv_dirs=()
|
local gv_dirs=()
|
||||||
for gv in "${group_versions[@]}"; do
|
for gv in "${group_versions[@]}"; do
|
||||||
@ -645,7 +613,7 @@ function codegen::clients() {
|
|||||||
|
|
||||||
kube::log::status "Generating client code for ${#gv_dirs[@]} targets"
|
kube::log::status "Generating client code for ${#gv_dirs[@]} targets"
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${clientgen} for:"
|
kube::log::status "DBG: running client-gen for:"
|
||||||
for dir in "${gv_dirs[@]}"; do
|
for dir in "${gv_dirs[@]}"; do
|
||||||
kube::log::status "DBG: $dir"
|
kube::log::status "DBG: $dir"
|
||||||
done
|
done
|
||||||
@ -658,7 +626,7 @@ function codegen::clients() {
|
|||||||
|| true) \
|
|| true) \
|
||||||
| xargs -0 rm -f
|
| xargs -0 rm -f
|
||||||
|
|
||||||
"${clientgen}" \
|
client-gen \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||||
--output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go" \
|
--output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go" \
|
||||||
@ -678,9 +646,6 @@ function codegen::listers() {
|
|||||||
GOPROXY=off go install \
|
GOPROXY=off go install \
|
||||||
k8s.io/code-generator/cmd/lister-gen
|
k8s.io/code-generator/cmd/lister-gen
|
||||||
|
|
||||||
local listergen
|
|
||||||
listergen=$(kube::util::find-binary "lister-gen")
|
|
||||||
|
|
||||||
local ext_apis=()
|
local ext_apis=()
|
||||||
kube::util::read-array ext_apis < <(
|
kube::util::read-array ext_apis < <(
|
||||||
cd "${KUBE_ROOT}/staging/src"
|
cd "${KUBE_ROOT}/staging/src"
|
||||||
@ -690,7 +655,7 @@ function codegen::listers() {
|
|||||||
|
|
||||||
kube::log::status "Generating lister code for ${#ext_apis[@]} targets"
|
kube::log::status "Generating lister code for ${#ext_apis[@]} targets"
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${listergen} for:"
|
kube::log::status "DBG: running lister-gen for:"
|
||||||
for api in "${ext_apis[@]}"; do
|
for api in "${ext_apis[@]}"; do
|
||||||
kube::log::status "DBG: $api"
|
kube::log::status "DBG: $api"
|
||||||
done
|
done
|
||||||
@ -703,7 +668,7 @@ function codegen::listers() {
|
|||||||
|| true) \
|
|| true) \
|
||||||
| xargs -0 rm -f
|
| xargs -0 rm -f
|
||||||
|
|
||||||
"${listergen}" \
|
lister-gen \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||||
--output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go/listers" \
|
--output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go/listers" \
|
||||||
@ -720,9 +685,6 @@ function codegen::informers() {
|
|||||||
GOPROXY=off go install \
|
GOPROXY=off go install \
|
||||||
k8s.io/code-generator/cmd/informer-gen
|
k8s.io/code-generator/cmd/informer-gen
|
||||||
|
|
||||||
local informergen
|
|
||||||
informergen=$(kube::util::find-binary "informer-gen")
|
|
||||||
|
|
||||||
local ext_apis=()
|
local ext_apis=()
|
||||||
kube::util::read-array ext_apis < <(
|
kube::util::read-array ext_apis < <(
|
||||||
cd "${KUBE_ROOT}/staging/src"
|
cd "${KUBE_ROOT}/staging/src"
|
||||||
@ -732,7 +694,7 @@ function codegen::informers() {
|
|||||||
|
|
||||||
kube::log::status "Generating informer code for ${#ext_apis[@]} targets"
|
kube::log::status "Generating informer code for ${#ext_apis[@]} targets"
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: running ${informergen} for:"
|
kube::log::status "DBG: running informer-gen for:"
|
||||||
for api in "${ext_apis[@]}"; do
|
for api in "${ext_apis[@]}"; do
|
||||||
kube::log::status "DBG: $api"
|
kube::log::status "DBG: $api"
|
||||||
done
|
done
|
||||||
@ -745,7 +707,7 @@ function codegen::informers() {
|
|||||||
|| true) \
|
|| true) \
|
||||||
| xargs -0 rm -f
|
| xargs -0 rm -f
|
||||||
|
|
||||||
"${informergen}" \
|
informer-gen \
|
||||||
-v "${KUBE_VERBOSE}" \
|
-v "${KUBE_VERBOSE}" \
|
||||||
--go-header-file "${BOILERPLATE_FILENAME}" \
|
--go-header-file "${BOILERPLATE_FILENAME}" \
|
||||||
--output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go/informers" \
|
--output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go/informers" \
|
||||||
|
@ -18,8 +18,10 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
source hack/lib/util.sh
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
|
kube::golang::setup_env
|
||||||
kube::util::require-jq
|
kube::util::require-jq
|
||||||
kube::util::ensure_clean_working_dir
|
kube::util::ensure_clean_working_dir
|
||||||
|
|
||||||
@ -62,9 +64,11 @@ git add .
|
|||||||
git commit -a -m "Update kubectl kustomize to kyaml/$LATEST_KYAML, cmd/config/$LATEST_CONFIG, api/$LATEST_API, kustomize/$LATEST_KUSTOMIZE"
|
git commit -a -m "Update kubectl kustomize to kyaml/$LATEST_KYAML, cmd/config/$LATEST_CONFIG, api/$LATEST_API, kustomize/$LATEST_KUSTOMIZE"
|
||||||
|
|
||||||
echo -e "\n${color_blue:?}Verifying kubectl kustomize version${color_norm:?}"
|
echo -e "\n${color_blue:?}Verifying kubectl kustomize version${color_norm:?}"
|
||||||
make WHAT=cmd/kubectl
|
# We use `make` here intead of `go install` to ensure that all of the
|
||||||
|
# linker-defined values are set.
|
||||||
|
make -C "${KUBE_ROOT}" WHAT=./cmd/kubectl
|
||||||
|
|
||||||
if [[ $(_output/bin/kubectl version --client -o json | jq -r '.kustomizeVersion') != "$LATEST_KUSTOMIZE" ]]; then
|
if [[ $(kubectl version --client -o json | jq -r '.kustomizeVersion') != "$LATEST_KUSTOMIZE" ]]; then
|
||||||
echo -e "${color_red:?}Unexpected kubectl kustomize version${color_norm:?}"
|
echo -e "${color_red:?}Unexpected kubectl kustomize version${color_norm:?}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -30,6 +30,8 @@ kube::util::require-jq
|
|||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
kube::etcd::install
|
kube::etcd::install
|
||||||
|
|
||||||
|
# We need to call `make` here because that includes all of the compile and link
|
||||||
|
# flags that we use for a production build, which we need for this script.
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
||||||
|
|
||||||
function cleanup()
|
function cleanup()
|
||||||
@ -70,7 +72,7 @@ fi
|
|||||||
# Start kube-apiserver
|
# Start kube-apiserver
|
||||||
# omit enums from static openapi snapshots used to generate clients until #109177 is resolved
|
# omit enums from static openapi snapshots used to generate clients until #109177 is resolved
|
||||||
kube::log::status "Starting kube-apiserver"
|
kube::log::status "Starting kube-apiserver"
|
||||||
"${THIS_PLATFORM_BIN}/kube-apiserver" \
|
kube-apiserver \
|
||||||
--bind-address="${API_HOST}" \
|
--bind-address="${API_HOST}" \
|
||||||
--secure-port="${API_PORT}" \
|
--secure-port="${API_PORT}" \
|
||||||
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
||||||
|
@ -27,7 +27,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
|
|
||||||
hack/make-rules/build.sh ./cmd/clicheck
|
GOPROXY=off go install ./cmd/clicheck
|
||||||
|
|
||||||
if ! output=$(clicheck 2>&1)
|
if ! output=$(clicheck 2>&1)
|
||||||
then
|
then
|
||||||
|
@ -28,12 +28,7 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
|
|||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
|
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/genswaggertypedocs
|
GOPROXY=off go install ./cmd/genswaggertypedocs
|
||||||
|
|
||||||
# Find binary
|
|
||||||
genswaggertypedocs=$(kube::util::find-binary "genswaggertypedocs")
|
|
||||||
|
|
||||||
result=0
|
|
||||||
|
|
||||||
find_files() {
|
find_files() {
|
||||||
find . -not \( \
|
find . -not \( \
|
||||||
@ -69,10 +64,11 @@ kube::util::check-file-in-alphabetical-order "${failure_file}"
|
|||||||
failing_files=()
|
failing_files=()
|
||||||
while IFS='' read -r line; do failing_files+=("$line"); done < <(cat "$failure_file")
|
while IFS='' read -r line; do failing_files+=("$line"); done < <(cat "$failure_file")
|
||||||
|
|
||||||
|
result=0
|
||||||
for file in $versioned_api_files; do
|
for file in $versioned_api_files; do
|
||||||
if ! kube::util::array_contains "$file" "${failing_files[@]}"; then
|
if ! kube::util::array_contains "$file" "${failing_files[@]}"; then
|
||||||
gen_swagger_result=0
|
gen_swagger_result=0
|
||||||
$genswaggertypedocs -v -s "${file}" -f - || gen_swagger_result=$?
|
genswaggertypedocs -v -s "${file}" -f - || gen_swagger_result=$?
|
||||||
if [[ "${gen_swagger_result}" -ne 0 ]]; then
|
if [[ "${gen_swagger_result}" -ne 0 ]]; then
|
||||||
echo "API file: ${file} is missing: ${gen_swagger_result} descriptions"
|
echo "API file: ${file} is missing: ${gen_swagger_result} descriptions"
|
||||||
result=1
|
result=1
|
||||||
|
@ -28,12 +28,7 @@ source "${KUBE_ROOT}/hack/lib/util.sh"
|
|||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
|
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/fieldnamedocscheck
|
GOPROXY=off go install ./cmd/fieldnamedocscheck
|
||||||
|
|
||||||
# Find binary
|
|
||||||
fieldnamedocscheck=$(kube::util::find-binary "fieldnamedocscheck")
|
|
||||||
|
|
||||||
result=0
|
|
||||||
|
|
||||||
find_files() {
|
find_files() {
|
||||||
find . -not \( \
|
find . -not \( \
|
||||||
@ -55,10 +50,11 @@ find_files() {
|
|||||||
|
|
||||||
versioned_api_files=$(find_files) || true
|
versioned_api_files=$(find_files) || true
|
||||||
|
|
||||||
|
result=0
|
||||||
for file in ${versioned_api_files}; do
|
for file in ${versioned_api_files}; do
|
||||||
package="${file%"/types.go"}"
|
package="${file%"/types.go"}"
|
||||||
echo "Checking ${package}"
|
echo "Checking ${package}"
|
||||||
${fieldnamedocscheck} -s "${file}" || result=$?
|
fieldnamedocscheck -s "${file}" || result=$?
|
||||||
done
|
done
|
||||||
|
|
||||||
exit ${result}
|
exit ${result}
|
||||||
|
@ -28,12 +28,12 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
|
|
||||||
BINS=(
|
BINS=(
|
||||||
cmd/gendocs
|
./cmd/gendocs
|
||||||
cmd/genkubedocs
|
./cmd/genkubedocs
|
||||||
cmd/genman
|
./cmd/genman
|
||||||
cmd/genyaml
|
./cmd/genyaml
|
||||||
)
|
)
|
||||||
make -C "${KUBE_ROOT}" WHAT="${BINS[*]}"
|
GOPROXY=off go install "${BINS[@]}"
|
||||||
|
|
||||||
kube::util::ensure-temp-dir
|
kube::util::ensure-temp-dir
|
||||||
|
|
||||||
|
@ -28,19 +28,6 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
|
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/importverifier
|
GOPROXY=off go install ./cmd/importverifier
|
||||||
|
|
||||||
# Find binary
|
importverifier "k8s.io/" "${KUBE_ROOT}/staging/publishing/import-restrictions.yaml"
|
||||||
importverifier=$(kube::util::find-binary "importverifier")
|
|
||||||
|
|
||||||
if [[ ! -x "$importverifier" ]]; then
|
|
||||||
{
|
|
||||||
echo "It looks as if you don't have a compiled importverifier binary"
|
|
||||||
echo
|
|
||||||
echo "If you are running from a clone of the git repo, please run"
|
|
||||||
echo "'make WHAT=cmd/importverifier'."
|
|
||||||
} >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
"${importverifier}" "k8s.io/" "${KUBE_ROOT}/staging/publishing/import-restrictions.yaml"
|
|
||||||
|
@ -29,7 +29,9 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
kube::etcd::install
|
kube::etcd::install
|
||||||
|
|
||||||
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
# We use `make` here intead of `go install` to ensure that all of the
|
||||||
|
# linker-defined values are set.
|
||||||
|
make -C "${KUBE_ROOT}" WHAT=./cmd/kube-apiserver
|
||||||
|
|
||||||
SPECROOT="${KUBE_ROOT}/api/openapi-spec"
|
SPECROOT="${KUBE_ROOT}/api/openapi-spec"
|
||||||
SPECV3PATH="${SPECROOT}/v3"
|
SPECV3PATH="${SPECROOT}/v3"
|
||||||
|
Loading…
Reference in New Issue
Block a user