mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 22:05:59 +00:00
Codegen subprojects: deprecate "all" in scripts
Replace "all" with the historical meaning of it in the generate-groups scripts.
This commit is contained in:
parent
a94ed5b8ac
commit
95e614b371
@ -25,7 +25,7 @@ if [ "$#" -lt 4 ] || [ "${1}" == "--help" ]; then
|
|||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $(basename "$0") <generators> <output-package> <apis-package> <groups-versions> ...
|
Usage: $(basename "$0") <generators> <output-package> <apis-package> <groups-versions> ...
|
||||||
|
|
||||||
<generators> the generators comma separated to run (deepcopy, defaulter,applyconfiguration,client,lister,informer) or "all".
|
<generators> the generators comma separated to run (deepcopy, defaulter,applyconfiguration,client,lister,informer).
|
||||||
<output-package> the output package name (e.g. github.com/example/project/pkg/generated).
|
<output-package> the output package name (e.g. github.com/example/project/pkg/generated).
|
||||||
<apis-package> the external types dir (e.g. github.com/example/api or github.com/example/project/pkg/apis).
|
<apis-package> the external types dir (e.g. github.com/example/api or github.com/example/project/pkg/apis).
|
||||||
<groups-versions> the groups and their versions in the format "groupA:v1,v2 groupB:v1 groupC:v2", relative
|
<groups-versions> the groups and their versions in the format "groupA:v1,v2 groupB:v1 groupC:v2", relative
|
||||||
@ -33,9 +33,12 @@ Usage: $(basename "$0") <generators> <output-package> <apis-package> <groups-ver
|
|||||||
... arbitrary flags passed to all generator binaries.
|
... arbitrary flags passed to all generator binaries.
|
||||||
|
|
||||||
|
|
||||||
Examples:
|
Example:
|
||||||
$(basename "$0") all github.com/example/project/pkg/client github.com/example/project/pkg/apis "foo:v1 bar:v1alpha1,v1beta1"
|
$(basename "$0") \
|
||||||
$(basename "$0") deepcopy,client github.com/example/project/pkg/client github.com/example/project/pkg/apis "foo:v1 bar:v1alpha1,v1beta1"
|
deepcopy,client \
|
||||||
|
github.com/example/project/pkg/client \
|
||||||
|
github.com/example/project/pkg/apis \
|
||||||
|
"foo:v1 bar:v1alpha1,v1beta1"
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -46,6 +49,15 @@ APIS_PKG="$3"
|
|||||||
GROUPS_WITH_VERSIONS="$4"
|
GROUPS_WITH_VERSIONS="$4"
|
||||||
shift 4
|
shift 4
|
||||||
|
|
||||||
|
if [ "${GENS}" = "all" ] || grep -qw "all" <<<"${GENS}"; then
|
||||||
|
ALL="applyconfiguration,client,deepcopy,informer,lister"
|
||||||
|
echo "WARNING: Specifying \"all\" as a generator is deprecated."
|
||||||
|
echo "WARNING: Please list the specific generators needed."
|
||||||
|
echo "WARNING: \"all\" is now an alias for \"${ALL}\""
|
||||||
|
echo
|
||||||
|
GENS="${ALL}"
|
||||||
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
# To support running this script from anywhere, first cd into this directory,
|
# To support running this script 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.
|
||||||
@ -69,7 +81,7 @@ for GVs in ${GROUPS_WITH_VERSIONS}; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then
|
if grep -qw "deepcopy" <<<"${GENS}"; then
|
||||||
echo "Generating deepcopy funcs"
|
echo "Generating deepcopy funcs"
|
||||||
"${gobin}/deepcopy-gen" \
|
"${gobin}/deepcopy-gen" \
|
||||||
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
||||||
@ -77,7 +89,7 @@ if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "defaulter" <<<"${GENS}"; then
|
if grep -qw "defaulter" <<<"${GENS}"; then
|
||||||
echo "Generating defaulters"
|
echo "Generating defaulters"
|
||||||
"${gobin}/defaulter-gen" \
|
"${gobin}/defaulter-gen" \
|
||||||
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
||||||
@ -85,7 +97,7 @@ if [ "${GENS}" = "all" ] || grep -qw "defaulter" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "applyconfiguration" <<<"${GENS}"; then
|
if grep -qw "applyconfiguration" <<<"${GENS}"; then
|
||||||
echo "Generating apply configuration for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${APPLYCONFIGURATION_PKG_NAME:-applyconfiguration}"
|
echo "Generating apply configuration for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${APPLYCONFIGURATION_PKG_NAME:-applyconfiguration}"
|
||||||
"${gobin}/applyconfiguration-gen" \
|
"${gobin}/applyconfiguration-gen" \
|
||||||
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
||||||
@ -93,9 +105,9 @@ if [ "${GENS}" = "all" ] || grep -qw "applyconfiguration" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then
|
if grep -qw "client" <<<"${GENS}"; then
|
||||||
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
|
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "applyconfiguration" <<<"${GENS}"; then
|
if grep -qw "applyconfiguration" <<<"${GENS}"; then
|
||||||
APPLY_CONFIGURATION_PACKAGE="${OUTPUT_PKG}/${APPLYCONFIGURATION_PKG_NAME:-applyconfiguration}"
|
APPLY_CONFIGURATION_PACKAGE="${OUTPUT_PKG}/${APPLYCONFIGURATION_PKG_NAME:-applyconfiguration}"
|
||||||
fi
|
fi
|
||||||
"${gobin}/client-gen" \
|
"${gobin}/client-gen" \
|
||||||
@ -107,7 +119,7 @@ if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "lister" <<<"${GENS}"; then
|
if grep -qw "lister" <<<"${GENS}"; then
|
||||||
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
|
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
|
||||||
"${gobin}/lister-gen" \
|
"${gobin}/lister-gen" \
|
||||||
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
||||||
@ -115,7 +127,7 @@ if [ "${GENS}" = "all" ] || grep -qw "lister" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "informer" <<<"${GENS}"; then
|
if grep -qw "informer" <<<"${GENS}"; then
|
||||||
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
|
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
|
||||||
"${gobin}/informer-gen" \
|
"${gobin}/informer-gen" \
|
||||||
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
||||||
|
@ -25,7 +25,7 @@ if [ "$#" -lt 5 ] || [ "${1}" == "--help" ]; then
|
|||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $(basename "$0") <generators> <output-package> <internal-apis-package> <extensiona-apis-package> <groups-versions> ...
|
Usage: $(basename "$0") <generators> <output-package> <internal-apis-package> <extensiona-apis-package> <groups-versions> ...
|
||||||
|
|
||||||
<generators> the generators comma separated to run (deepcopy,defaulter,conversion,client,lister,informer,openapi) or "all".
|
<generators> the generators comma separated to run (deepcopy,defaulter,conversion,client,lister,informer,openapi).
|
||||||
<output-package> the output package name (e.g. github.com/example/project/pkg/generated).
|
<output-package> the output package name (e.g. github.com/example/project/pkg/generated).
|
||||||
<int-apis-package> the internal types dir (e.g. github.com/example/project/pkg/apis).
|
<int-apis-package> the internal types dir (e.g. github.com/example/project/pkg/apis).
|
||||||
<ext-apis-package> the external types dir (e.g. github.com/example/project/pkg/apis or githubcom/example/apis).
|
<ext-apis-package> the external types dir (e.g. github.com/example/project/pkg/apis or githubcom/example/apis).
|
||||||
@ -33,9 +33,13 @@ Usage: $(basename "$0") <generators> <output-package> <internal-apis-package> <e
|
|||||||
to <api-package>.
|
to <api-package>.
|
||||||
... arbitrary flags passed to all generator binaries.
|
... arbitrary flags passed to all generator binaries.
|
||||||
|
|
||||||
Examples:
|
Example:
|
||||||
$(basename "$0") all github.com/example/project/pkg/client github.com/example/project/pkg/apis github.com/example/project/pkg/apis "foo:v1 bar:v1alpha1,v1beta1"
|
$(basename "$0") \
|
||||||
$(basename "$0") deepcopy,defaulter,conversion github.com/example/project/pkg/client github.com/example/project/pkg/apis github.com/example/project/apis "foo:v1 bar:v1alpha1,v1beta1"
|
deepcopy,defaulter,conversion \
|
||||||
|
github.com/example/project/pkg/client \
|
||||||
|
github.com/example/project/pkg/apis \
|
||||||
|
github.com/example/project/apis \
|
||||||
|
"foo:v1 bar:v1alpha1,v1beta1"
|
||||||
EOF
|
EOF
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -47,6 +51,15 @@ EXT_APIS_PKG="$4"
|
|||||||
GROUPS_WITH_VERSIONS="$5"
|
GROUPS_WITH_VERSIONS="$5"
|
||||||
shift 5
|
shift 5
|
||||||
|
|
||||||
|
if [ "${GENS}" = "all" ] || grep -qw "all" <<<"${GENS}"; then
|
||||||
|
ALL="client,conversion,deepcopy,defaulter,informer,lister,openapi"
|
||||||
|
echo "WARNING: Specifying \"all\" as a generator is deprecated."
|
||||||
|
echo "WARNING: Please list the specific generators needed."
|
||||||
|
echo "WARNING: \"all\" is now an alias for \"${ALL}\""
|
||||||
|
echo
|
||||||
|
GENS="${ALL}"
|
||||||
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
# To support running this script from anywhere, first cd into this directory,
|
# To support running this script 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.
|
||||||
@ -77,7 +90,7 @@ for GVs in ${GROUPS_WITH_VERSIONS}; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then
|
if grep -qw "deepcopy" <<<"${GENS}"; then
|
||||||
echo "Generating deepcopy funcs"
|
echo "Generating deepcopy funcs"
|
||||||
"${gobin}/deepcopy-gen" \
|
"${gobin}/deepcopy-gen" \
|
||||||
--input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" \
|
||||||
@ -85,7 +98,7 @@ if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "defaulter" <<<"${GENS}"; then
|
if grep -qw "defaulter" <<<"${GENS}"; then
|
||||||
echo "Generating defaulters"
|
echo "Generating defaulters"
|
||||||
"${gobin}/defaulter-gen" \
|
"${gobin}/defaulter-gen" \
|
||||||
--input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}")" \
|
||||||
@ -93,7 +106,7 @@ if [ "${GENS}" = "all" ] || grep -qw "defaulter" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "conversion" <<<"${GENS}"; then
|
if grep -qw "conversion" <<<"${GENS}"; then
|
||||||
echo "Generating conversions"
|
echo "Generating conversions"
|
||||||
"${gobin}/conversion-gen" \
|
"${gobin}/conversion-gen" \
|
||||||
--input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" \
|
||||||
@ -101,7 +114,7 @@ if [ "${GENS}" = "all" ] || grep -qw "conversion" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then
|
if grep -qw "client" <<<"${GENS}"; then
|
||||||
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
|
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
|
||||||
"${gobin}/client-gen" \
|
"${gobin}/client-gen" \
|
||||||
--clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" \
|
--clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" \
|
||||||
@ -111,7 +124,7 @@ if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "lister" <<<"${GENS}"; then
|
if grep -qw "lister" <<<"${GENS}"; then
|
||||||
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
|
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
|
||||||
"${gobin}/lister-gen" \
|
"${gobin}/lister-gen" \
|
||||||
--input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}")" \
|
||||||
@ -119,7 +132,7 @@ if [ "${GENS}" = "all" ] || grep -qw "lister" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "informer" <<<"${GENS}"; then
|
if grep -qw "informer" <<<"${GENS}"; then
|
||||||
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
|
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
|
||||||
"${gobin}/informer-gen" \
|
"${gobin}/informer-gen" \
|
||||||
--input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}")" \
|
--input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}")" \
|
||||||
@ -129,7 +142,7 @@ if [ "${GENS}" = "all" ] || grep -qw "informer" <<<"${GENS}"; then
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${GENS}" = "all" ] || grep -qw "openapi" <<<"${GENS}"; then
|
if grep -qw "openapi" <<<"${GENS}"; then
|
||||||
echo "Generating OpenAPI definitions for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/openapi"
|
echo "Generating OpenAPI definitions for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/openapi"
|
||||||
declare -a OPENAPI_EXTRA_PACKAGES
|
declare -a OPENAPI_EXTRA_PACKAGES
|
||||||
"${gobin}/openapi-gen" \
|
"${gobin}/openapi-gen" \
|
||||||
|
Loading…
Reference in New Issue
Block a user