mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Add applyconfiguration generator to code-generator script
This commit is contained in:
parent
d2f40481d1
commit
d2bd7d8557
@ -25,7 +25,7 @@ if [ "$#" -lt 4 ] || [ "${1}" == "--help" ]; then
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") <generators> <output-package> <apis-package> <groups-versions> ...
|
||||
|
||||
<generators> the generators comma separated to run (deepcopy,defaulter,client,lister,informer) or "all".
|
||||
<generators> the generators comma separated to run (deepcopy,defaulter,applyconfiguration,client,lister,informer) or "all".
|
||||
<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).
|
||||
<groups-versions> the groups and their versions in the format "groupA:v1,v2 groupB:v1 groupC:v2", relative
|
||||
@ -50,7 +50,7 @@ shift 4
|
||||
# To support running this script from anywhere, first cd into this directory,
|
||||
# and then install with forced module mode on and fully qualified name.
|
||||
cd "$(dirname "${0}")"
|
||||
GO111MODULE=on go install k8s.io/code-generator/cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen}
|
||||
GO111MODULE=on go install k8s.io/code-generator/cmd/{applyconfiguration-gen,defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen}
|
||||
)
|
||||
# Go installs the above commands to get installed in $GOBIN if defined, and $GOPATH/bin otherwise:
|
||||
GOBIN="$(go env GOBIN)"
|
||||
@ -77,13 +77,25 @@ if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then
|
||||
"$@"
|
||||
fi
|
||||
|
||||
if [ "${GENS}" = "all" ] || grep -qw "applyconfiguration" <<<"${GENS}"; then
|
||||
echo "Generating apply configuration for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${APPLYCONFIGURATION_PKG_NAME:-applyconfiguration}"
|
||||
"${gobin}/applyconfiguration-gen" \
|
||||
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \
|
||||
--output-package "${OUTPUT_PKG}/${APPLYCONFIGURATION_PKG_NAME:-applyconfiguration}" \
|
||||
"$@"
|
||||
fi
|
||||
|
||||
if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then
|
||||
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
|
||||
if [ "${GENS}" = "all" ] || grep -qw "applyconfiguration" <<<"${GENS}"; then
|
||||
APPLY_CONFIGURATION_PACKAGE="${OUTPUT_PKG}/${APPLYCONFIGURATION_PKG_NAME:-applyconfiguration}"
|
||||
fi
|
||||
"${gobin}/client-gen" \
|
||||
--clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" \
|
||||
--input-base "" \
|
||||
--input "$(codegen::join , "${FQ_APIS[@]}")" \
|
||||
--output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" \
|
||||
--apply-configuration-package "${APPLY_CONFIGURATION_PACKAGE:-}" \
|
||||
"$@"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user