mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
code-generator: move kube group list out of client-gen
This commit is contained in:
parent
33f873dbbe
commit
12eb6a01eb
@ -40,6 +40,7 @@ informergen=$(kube::util::find-binary "informer-gen")
|
|||||||
|
|
||||||
GROUP_VERSIONS=(${KUBE_AVAILABLE_GROUP_VERSIONS})
|
GROUP_VERSIONS=(${KUBE_AVAILABLE_GROUP_VERSIONS})
|
||||||
GV_DIRS=()
|
GV_DIRS=()
|
||||||
|
INTERNAL_DIRS=()
|
||||||
for gv in "${GROUP_VERSIONS[@]}"; do
|
for gv in "${GROUP_VERSIONS[@]}"; do
|
||||||
# add items, but strip off any leading apis/ you find to match command expectations
|
# add items, but strip off any leading apis/ you find to match command expectations
|
||||||
api_dir=$(kube::util::group-version-to-pkg-path "${gv}")
|
api_dir=$(kube::util::group-version-to-pkg-path "${gv}")
|
||||||
@ -47,19 +48,30 @@ for gv in "${GROUP_VERSIONS[@]}"; do
|
|||||||
nopkg_dir=${nopkg_dir#vendor/k8s.io/api/}
|
nopkg_dir=${nopkg_dir#vendor/k8s.io/api/}
|
||||||
pkg_dir=${nopkg_dir#apis/}
|
pkg_dir=${nopkg_dir#apis/}
|
||||||
|
|
||||||
|
|
||||||
# skip groups that aren't being served, clients for these don't matter
|
# skip groups that aren't being served, clients for these don't matter
|
||||||
if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${gv} "* ]]; then
|
if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${gv} "* ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GV_DIRS+=("${pkg_dir}")
|
GV_DIRS+=("${pkg_dir}")
|
||||||
|
|
||||||
|
# collect internal groups
|
||||||
|
int_group="${pkg_dir%/*}/"
|
||||||
|
if [[ "${pkg_dir}" = core/* ]]; then
|
||||||
|
int_group="api/"
|
||||||
|
fi
|
||||||
|
if ! [[ " ${INTERNAL_DIRS[@]:-} " =~ " ${int_group} " ]]; then
|
||||||
|
INTERNAL_DIRS+=("${int_group}")
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
# delimit by commas for the command
|
# delimit by commas for the command
|
||||||
GV_DIRS_CSV=$(IFS=',';echo "${GV_DIRS[*]// /,}";IFS=$)
|
GV_DIRS_CSV=$(IFS=',';echo "${GV_DIRS[*]// /,}";IFS=$)
|
||||||
|
INTERNAL_DIRS_CSV=$(IFS=',';echo "${INTERNAL_DIRS[*]// /,}";IFS=$)
|
||||||
|
|
||||||
# This can be called with one flag, --verify-only, so it works for both the
|
# This can be called with one flag, --verify-only, so it works for both the
|
||||||
# update- and verify- scripts.
|
# update- and verify- scripts.
|
||||||
${clientgen} "$@"
|
${clientgen} --input-base="k8s.io/kubernetes/pkg/apis" --input="${INTERNAL_DIRS_CSV}" "$@"
|
||||||
${clientgen} --output-base "${KUBE_ROOT}/vendor" --clientset-path="k8s.io/client-go" --clientset-name="kubernetes" --input-base="k8s.io/kubernetes/vendor/k8s.io/api" --input="${GV_DIRS_CSV}" "$@"
|
${clientgen} --output-base "${KUBE_ROOT}/vendor" --clientset-path="k8s.io/client-go" --clientset-name="kubernetes" --input-base="k8s.io/kubernetes/vendor/k8s.io/api" --input="${GV_DIRS_CSV}" "$@"
|
||||||
|
|
||||||
listergen_internal_apis=(
|
listergen_internal_apis=(
|
||||||
|
@ -53,26 +53,8 @@ type CustomArgs struct {
|
|||||||
FakeClient bool
|
FakeClient bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultInput = []string{
|
|
||||||
"api/",
|
|
||||||
"admissionregistration/",
|
|
||||||
"authentication/",
|
|
||||||
"authorization/",
|
|
||||||
"autoscaling/",
|
|
||||||
"batch/",
|
|
||||||
"certificates/",
|
|
||||||
"extensions/",
|
|
||||||
"rbac/",
|
|
||||||
"storage/",
|
|
||||||
"apps/",
|
|
||||||
"policy/",
|
|
||||||
"scheduling/",
|
|
||||||
"settings/",
|
|
||||||
"networking/",
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) {
|
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) {
|
||||||
pflag.Var(NewGVPackagesValue(&ca.GroupVersionToInputPath, &ca.Groups, defaultInput), "input", "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\".")
|
pflag.Var(NewGVPackagesValue(&ca.GroupVersionToInputPath, &ca.Groups, nil), "input", "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\".")
|
||||||
pflag.Var(NewGVTypesValue(&ca.IncludedTypesOverrides, []string{}), "included-types-overrides", "list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient will be used for other group versions.")
|
pflag.Var(NewGVTypesValue(&ca.IncludedTypesOverrides, []string{}), "included-types-overrides", "list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient will be used for other group versions.")
|
||||||
pflag.StringVar(&ca.InputBasePath, "input-base", "k8s.io/kubernetes/pkg/apis", "base path to look for the api group.")
|
pflag.StringVar(&ca.InputBasePath, "input-base", "k8s.io/kubernetes/pkg/apis", "base path to look for the api group.")
|
||||||
pflag.StringVarP(&ca.ClientsetName, "clientset-name", "n", "internalclientset", "the name of the generated clientset package.")
|
pflag.StringVarP(&ca.ClientsetName, "clientset-name", "n", "internalclientset", "the name of the generated clientset package.")
|
||||||
|
Loading…
Reference in New Issue
Block a user