mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-28 06:29:29 +01:00
Bump to k8s v0.30.0-alpha.3 (#1359)
* update go.mod for v0.30.0-alpha.3 * update vendor deps * regenrate go.mod transitive dependencies --------- Co-authored-by: Amir Alavi <amiralavi7@gmail.com>
This commit is contained in:
4
vendor/k8s.io/code-generator/README.md
generated
vendored
4
vendor/k8s.io/code-generator/README.md
generated
vendored
@@ -14,6 +14,10 @@ These code-generators can be used
|
||||
- The example [sample controller](https://github.com/kubernetes/sample-controller) shows a code example of a controller that uses the clients, listers and informers generated by this library.
|
||||
- The article [Kubernetes Deep Dive: Code Generation for CustomResources](https://cloud.redhat.com/blog/kubernetes-deep-dive-code-generation-customresources/) gives a step by step instruction on how to use this library.
|
||||
|
||||
## Usage
|
||||
|
||||
The examples above are dated. The current recommended script to use is [kube_codegen.sh](kube_codegen.sh).
|
||||
|
||||
## Compatibility
|
||||
|
||||
HEAD of this repo will match HEAD of k8s.io/apiserver, k8s.io/apimachinery, and k8s.io/client-go.
|
||||
|
||||
17
vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go
generated
vendored
17
vendor/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go
generated
vendored
@@ -49,10 +49,15 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
|
||||
genericArgs := args.Default().WithoutDefaultFlagParsing()
|
||||
customArgs := &CustomArgs{
|
||||
ExternalApplyConfigurations: map[types.Name]string{
|
||||
// Always include TypeMeta and ObjectMeta. They are sufficient for the vast majority of use cases.
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "TypeMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ObjectMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "OwnerReference"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
// Always include the applyconfigurations we've generated in client-go. They are sufficient for the vast majority of use cases.
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "Condition"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "DeleteOptions"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "LabelSelector"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "LabelSelectorRequirement"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ManagedFieldsEntry"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ObjectMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "OwnerReference"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "TypeMeta"}: "k8s.io/client-go/applyconfigurations/meta/v1",
|
||||
},
|
||||
}
|
||||
genericArgs.CustomArgs = customArgs
|
||||
@@ -65,10 +70,10 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
|
||||
}
|
||||
|
||||
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet, inputBase string) {
|
||||
pflag.Var(NewExternalApplyConfigurationValue(&ca.ExternalApplyConfigurations, nil), "external-applyconfigurations",
|
||||
fs.Var(NewExternalApplyConfigurationValue(&ca.ExternalApplyConfigurations, nil), "external-applyconfigurations",
|
||||
"list of comma separated external apply configurations locations in <type-package>.<type-name>:<applyconfiguration-package> form."+
|
||||
"For example: k8s.io/api/apps/v1.Deployment:k8s.io/client-go/applyconfigurations/apps/v1")
|
||||
pflag.StringVar(&ca.OpenAPISchemaFilePath, "openapi-schema", "",
|
||||
fs.StringVar(&ca.OpenAPISchemaFilePath, "openapi-schema", "",
|
||||
"path to the openapi schema containing all the types that apply configurations will be generated for")
|
||||
}
|
||||
|
||||
|
||||
14
vendor/k8s.io/code-generator/cmd/client-gen/args/args.go
generated
vendored
14
vendor/k8s.io/code-generator/cmd/client-gen/args/args.go
generated
vendored
@@ -81,13 +81,13 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
|
||||
|
||||
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet, inputBase string) {
|
||||
gvsBuilder := NewGroupVersionsBuilder(&ca.Groups)
|
||||
pflag.Var(NewGVPackagesValue(gvsBuilder, 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(NewInputBasePathValue(gvsBuilder, inputBase), "input-base", "base path to look for the api group.")
|
||||
pflag.StringVarP(&ca.ClientsetName, "clientset-name", "n", ca.ClientsetName, "the name of the generated clientset package.")
|
||||
pflag.StringVarP(&ca.ClientsetAPIPath, "clientset-api-path", "", ca.ClientsetAPIPath, "the value of default API HTTP path, starting with / and without trailing /.")
|
||||
pflag.BoolVar(&ca.ClientsetOnly, "clientset-only", ca.ClientsetOnly, "when set, client-gen only generates the clientset shell, without generating the individual typed clients")
|
||||
pflag.BoolVar(&ca.FakeClient, "fake-clientset", ca.FakeClient, "when set, client-gen will generate the fake clientset that can be used in tests")
|
||||
fs.Var(NewGVPackagesValue(gvsBuilder, 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...\".")
|
||||
fs.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.")
|
||||
fs.Var(NewInputBasePathValue(gvsBuilder, inputBase), "input-base", "base path to look for the api group.")
|
||||
fs.StringVarP(&ca.ClientsetName, "clientset-name", "n", ca.ClientsetName, "the name of the generated clientset package.")
|
||||
fs.StringVarP(&ca.ClientsetAPIPath, "clientset-api-path", "", ca.ClientsetAPIPath, "the value of default API HTTP path, starting with / and without trailing /.")
|
||||
fs.BoolVar(&ca.ClientsetOnly, "clientset-only", ca.ClientsetOnly, "when set, client-gen only generates the clientset shell, without generating the individual typed clients")
|
||||
fs.BoolVar(&ca.FakeClient, "fake-clientset", ca.FakeClient, "when set, client-gen will generate the fake clientset that can be used in tests")
|
||||
|
||||
fs.StringSliceVar(&ca.PluralExceptions, "plural-exceptions", ca.PluralExceptions, "list of comma separated plural exception definitions in Type:PluralizedType form")
|
||||
fs.StringVar(&ca.ApplyConfigurationPackage, "apply-configuration-package", ca.ApplyConfigurationPackage, "optional package of apply configurations, generated by applyconfiguration-gen, that are required to generate Apply functions for each type in the clientset. By default Apply functions are not generated.")
|
||||
|
||||
8
vendor/k8s.io/code-generator/cmd/conversion-gen/args/args.go
generated
vendored
8
vendor/k8s.io/code-generator/cmd/conversion-gen/args/args.go
generated
vendored
@@ -68,13 +68,13 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
|
||||
|
||||
// AddFlags add the generator flags to the flag set.
|
||||
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) {
|
||||
pflag.CommandLine.StringSliceVar(&ca.BasePeerDirs, "base-peer-dirs", ca.BasePeerDirs,
|
||||
fs.StringSliceVar(&ca.BasePeerDirs, "base-peer-dirs", ca.BasePeerDirs,
|
||||
"Comma-separated list of apimachinery import paths which are considered, after tag-specified peers, for conversions. Only change these if you have very good reasons.")
|
||||
pflag.CommandLine.StringSliceVar(&ca.ExtraPeerDirs, "extra-peer-dirs", ca.ExtraPeerDirs,
|
||||
fs.StringSliceVar(&ca.ExtraPeerDirs, "extra-peer-dirs", ca.ExtraPeerDirs,
|
||||
"Application specific comma-separated list of import paths which are considered, after tag-specified peers and base-peer-dirs, for conversions.")
|
||||
pflag.CommandLine.StringSliceVar(&ca.ExtraDirs, "extra-dirs", ca.ExtraDirs,
|
||||
fs.StringSliceVar(&ca.ExtraDirs, "extra-dirs", ca.ExtraDirs,
|
||||
"Application specific comma-separated list of import paths which are loaded and considered for callable conversions, but are not considered peers for conversion.")
|
||||
pflag.CommandLine.BoolVar(&ca.SkipUnsafe, "skip-unsafe", ca.SkipUnsafe,
|
||||
fs.BoolVar(&ca.SkipUnsafe, "skip-unsafe", ca.SkipUnsafe,
|
||||
"If true, will not generate code using unsafe pointer conversions; resulting code may be slower.")
|
||||
}
|
||||
|
||||
|
||||
2
vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go
generated
vendored
2
vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go
generated
vendored
@@ -38,7 +38,7 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
|
||||
|
||||
// AddFlags add the generator flags to the flag set.
|
||||
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) {
|
||||
pflag.CommandLine.StringSliceVar(&ca.BoundingDirs, "bounding-dirs", ca.BoundingDirs,
|
||||
fs.StringSliceVar(&ca.BoundingDirs, "bounding-dirs", ca.BoundingDirs,
|
||||
"Comma-separated list of import paths which bound the types for which deep-copies will be generated.")
|
||||
}
|
||||
|
||||
|
||||
2
vendor/k8s.io/code-generator/cmd/defaulter-gen/args/args.go
generated
vendored
2
vendor/k8s.io/code-generator/cmd/defaulter-gen/args/args.go
generated
vendored
@@ -38,7 +38,7 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
|
||||
|
||||
// AddFlags add the generator flags to the flag set.
|
||||
func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) {
|
||||
pflag.CommandLine.StringSliceVar(&ca.ExtraPeerDirs, "extra-peer-dirs", ca.ExtraPeerDirs,
|
||||
fs.StringSliceVar(&ca.ExtraPeerDirs, "extra-peer-dirs", ca.ExtraPeerDirs,
|
||||
"Comma-separated list of import paths which are considered, after tag-specified peers, for conversions.")
|
||||
}
|
||||
|
||||
|
||||
2
vendor/k8s.io/code-generator/cmd/register-gen/generators/register_external.go
generated
vendored
2
vendor/k8s.io/code-generator/cmd/register-gen/generators/register_external.go
generated
vendored
@@ -91,7 +91,7 @@ var (
|
||||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
// Depreciated: use Install instead
|
||||
// Deprecated: use Install instead
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
Install = localSchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
148
vendor/k8s.io/code-generator/generate-internal-groups.sh
generated
vendored
148
vendor/k8s.io/code-generator/generate-internal-groups.sh
generated
vendored
@@ -55,6 +55,12 @@ echo "WARNING: $(basename "$0") is deprecated."
|
||||
echo "WARNING: Please use k8s.io/code-generator/kube_codegen.sh instead."
|
||||
echo
|
||||
|
||||
# If verification only is requested, avoid deleting files
|
||||
verify_only=""
|
||||
for ((i = 1; i <= $#; i++)); do
|
||||
if [ "${!i}" = --verify-only ]; then verify_only=1; fi
|
||||
done
|
||||
|
||||
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."
|
||||
@@ -124,12 +130,14 @@ CLIENTSET_PKG="${CLIENTSET_PKG_NAME:-clientset}"
|
||||
CLIENTSET_NAME="${CLIENTSET_NAME_VERSIONED:-versioned}"
|
||||
|
||||
if grep -qw "deepcopy" <<<"${GENS}"; then
|
||||
# Nuke existing files
|
||||
for dir in $(GO111MODULE=on go list -f '{{.Dir}}' "${ALL_FQ_APIS[@]}"); do
|
||||
pushd "${dir}" >/dev/null
|
||||
git_find -z ':(glob)**'/zz_generated.deepcopy.go | xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
done
|
||||
if [ ! "$verify_only" ]; then
|
||||
# Nuke existing files
|
||||
for dir in $(GO111MODULE=on go list -f '{{.Dir}}' "${ALL_FQ_APIS[@]}"); do
|
||||
pushd "${dir}" >/dev/null
|
||||
git_find -z ':(glob)**'/zz_generated.deepcopy.go | xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Generating deepcopy funcs"
|
||||
"${gobin}/deepcopy-gen" \
|
||||
@@ -139,12 +147,14 @@ if grep -qw "deepcopy" <<<"${GENS}"; then
|
||||
fi
|
||||
|
||||
if grep -qw "defaulter" <<<"${GENS}"; then
|
||||
# Nuke existing files
|
||||
for dir in $(GO111MODULE=on go list -f '{{.Dir}}' "${ALL_FQ_APIS[@]}"); do
|
||||
pushd "${dir}" >/dev/null
|
||||
git_find -z ':(glob)**'/zz_generated.defaults.go | xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
done
|
||||
if [ ! "$verify_only" ]; then
|
||||
# Nuke existing files
|
||||
for dir in $(GO111MODULE=on go list -f '{{.Dir}}' "${ALL_FQ_APIS[@]}"); do
|
||||
pushd "${dir}" >/dev/null
|
||||
git_find -z ':(glob)**'/zz_generated.defaults.go | xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Generating defaulters"
|
||||
"${gobin}/defaulter-gen" \
|
||||
@@ -154,12 +164,14 @@ if grep -qw "defaulter" <<<"${GENS}"; then
|
||||
fi
|
||||
|
||||
if grep -qw "conversion" <<<"${GENS}"; then
|
||||
# Nuke existing files
|
||||
for dir in $(GO111MODULE=on go list -f '{{.Dir}}' "${ALL_FQ_APIS[@]}"); do
|
||||
pushd "${dir}" >/dev/null
|
||||
git_find -z ':(glob)**'/zz_generated.conversion.go | xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
done
|
||||
if [ ! "$verify_only" ]; then
|
||||
# Nuke existing files
|
||||
for dir in $(GO111MODULE=on go list -f '{{.Dir}}' "${ALL_FQ_APIS[@]}"); do
|
||||
pushd "${dir}" >/dev/null
|
||||
git_find -z ':(glob)**'/zz_generated.conversion.go | xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Generating conversions"
|
||||
"${gobin}/conversion-gen" \
|
||||
@@ -171,15 +183,17 @@ fi
|
||||
if grep -qw "applyconfiguration" <<<"${GENS}"; then
|
||||
APPLY_CONFIGURATION_PACKAGE="${OUTPUT_PKG}/${APPLYCONFIGURATION_PKG_NAME:-applyconfiguration}"
|
||||
|
||||
# Nuke existing files
|
||||
root="$(GO111MODULE=on go list -f '{{.Dir}}' "${APPLY_CONFIGURATION_PACKAGE}" 2>/dev/null || true)"
|
||||
if [ -n "${root}" ]; then
|
||||
pushd "${root}" >/dev/null
|
||||
git_grep -l --null \
|
||||
-e '^// Code generated by applyconfiguration-gen. DO NOT EDIT.$' \
|
||||
':(glob)**/*.go' \
|
||||
| xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
if [ ! "$verify_only" ]; then
|
||||
# Nuke existing files
|
||||
root="$(GO111MODULE=on go list -f '{{.Dir}}' "${APPLY_CONFIGURATION_PACKAGE}" 2>/dev/null || true)"
|
||||
if [ -n "${root}" ]; then
|
||||
pushd "${root}" >/dev/null
|
||||
git_grep -l --null \
|
||||
-e '^// Code generated by applyconfiguration-gen. DO NOT EDIT.$' \
|
||||
':(glob)**/*.go' \
|
||||
| xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Generating apply configuration for ${GROUPS_WITH_VERSIONS} at ${APPLY_CONFIGURATION_PACKAGE}"
|
||||
@@ -190,15 +204,17 @@ if grep -qw "applyconfiguration" <<<"${GENS}"; then
|
||||
fi
|
||||
|
||||
if grep -qw "client" <<<"${GENS}"; then
|
||||
# Nuke existing files
|
||||
root="$(GO111MODULE=on go list -f '{{.Dir}}' "${OUTPUT_PKG}/${CLIENTSET_PKG}/${CLIENTSET_NAME}" 2>/dev/null || true)"
|
||||
if [ -n "${root}" ]; then
|
||||
pushd "${root}" >/dev/null
|
||||
git_grep -l --null \
|
||||
-e '^// Code generated by client-gen. DO NOT EDIT.$' \
|
||||
':(glob)**/*.go' \
|
||||
| xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
if [ ! "$verify_only" ]; then
|
||||
# Nuke existing files
|
||||
root="$(GO111MODULE=on go list -f '{{.Dir}}' "${OUTPUT_PKG}/${CLIENTSET_PKG}/${CLIENTSET_NAME}" 2>/dev/null || true)"
|
||||
if [ -n "${root}" ]; then
|
||||
pushd "${root}" >/dev/null
|
||||
git_grep -l --null \
|
||||
-e '^// Code generated by client-gen. DO NOT EDIT.$' \
|
||||
':(glob)**/*.go' \
|
||||
| xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG}"
|
||||
@@ -212,18 +228,20 @@ if grep -qw "client" <<<"${GENS}"; then
|
||||
fi
|
||||
|
||||
if grep -qw "lister" <<<"${GENS}"; then
|
||||
# Nuke existing files
|
||||
for gv in "${GROUP_VERSIONS[@]}"; do
|
||||
root="$(GO111MODULE=on go list -f '{{.Dir}}' "${OUTPUT_PKG}/listers/${gv}" 2>/dev/null || true)"
|
||||
if [ -n "${root}" ]; then
|
||||
pushd "${root}" >/dev/null
|
||||
git_grep -l --null \
|
||||
-e '^// Code generated by lister-gen. DO NOT EDIT.$' \
|
||||
':(glob)**/*.go' \
|
||||
| xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
fi
|
||||
done
|
||||
if [ ! "$verify_only" ]; then
|
||||
# Nuke existing files
|
||||
for gv in "${GROUP_VERSIONS[@]}"; do
|
||||
root="$(GO111MODULE=on go list -f '{{.Dir}}' "${OUTPUT_PKG}/listers/${gv}" 2>/dev/null || true)"
|
||||
if [ -n "${root}" ]; then
|
||||
pushd "${root}" >/dev/null
|
||||
git_grep -l --null \
|
||||
-e '^// Code generated by lister-gen. DO NOT EDIT.$' \
|
||||
':(glob)**/*.go' \
|
||||
| xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
|
||||
"${gobin}/lister-gen" \
|
||||
@@ -233,15 +251,17 @@ if grep -qw "lister" <<<"${GENS}"; then
|
||||
fi
|
||||
|
||||
if grep -qw "informer" <<<"${GENS}"; then
|
||||
# Nuke existing files
|
||||
root="$(GO111MODULE=on go list -f '{{.Dir}}' "${OUTPUT_PKG}/informers/externalversions" 2>/dev/null || true)"
|
||||
if [ -n "${root}" ]; then
|
||||
pushd "${root}" >/dev/null
|
||||
git_grep -l --null \
|
||||
-e '^// Code generated by informer-gen. DO NOT EDIT.$' \
|
||||
':(glob)**/*.go' \
|
||||
| xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
if [ ! "$verify_only" ]; then
|
||||
# Nuke existing files
|
||||
root="$(GO111MODULE=on go list -f '{{.Dir}}' "${OUTPUT_PKG}/informers/externalversions" 2>/dev/null || true)"
|
||||
if [ -n "${root}" ]; then
|
||||
pushd "${root}" >/dev/null
|
||||
git_grep -l --null \
|
||||
-e '^// Code generated by informer-gen. DO NOT EDIT.$' \
|
||||
':(glob)**/*.go' \
|
||||
| xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
|
||||
@@ -254,12 +274,14 @@ if grep -qw "informer" <<<"${GENS}"; then
|
||||
fi
|
||||
|
||||
if grep -qw "openapi" <<<"${GENS}"; then
|
||||
# Nuke existing files
|
||||
for dir in $(GO111MODULE=on go list -f '{{.Dir}}' "${FQ_APIS[@]}"); do
|
||||
pushd "${dir}" >/dev/null
|
||||
git_find -z ':(glob)**'/zz_generated.openapi.go | xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
done
|
||||
if [ ! "$verify_only" ]; then
|
||||
# Nuke existing files
|
||||
for dir in $(GO111MODULE=on go list -f '{{.Dir}}' "${FQ_APIS[@]}"); do
|
||||
pushd "${dir}" >/dev/null
|
||||
git_find -z ':(glob)**'/zz_generated.openapi.go | xargs -0 rm -f
|
||||
popd >/dev/null
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Generating OpenAPI definitions for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/openapi"
|
||||
declare -a OPENAPI_EXTRA_PACKAGES
|
||||
|
||||
168
vendor/k8s.io/code-generator/kube_codegen.sh
generated
vendored
168
vendor/k8s.io/code-generator/kube_codegen.sh
generated
vendored
@@ -17,23 +17,30 @@
|
||||
# This presents several functions for packages which want to use kubernetes
|
||||
# code-generation tools.
|
||||
|
||||
# These functions insist that your input IDL (commented go) files be located in
|
||||
# go packages following the pattern $input_pkg_root/$something_sans_slash/$api_version .
|
||||
# Those $something_sans_slash will be propagated into the output directory structure.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_CODEGEN_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||
|
||||
function kube::codegen::internal::git_find() {
|
||||
# Similar to find but faster and easier to understand. We want to include
|
||||
# modified and untracked files because this might be running against code
|
||||
# which is not tracked by git yet.
|
||||
git ls-files -cmo --exclude-standard "$@"
|
||||
function kube::codegen::internal::findz() {
|
||||
# We use `find` rather than `git ls-files` because sometimes external
|
||||
# projects use this across repos. This is an imperfect wrapper of find,
|
||||
# but good enough for this script.
|
||||
find "$@" -print0
|
||||
}
|
||||
|
||||
function kube::codegen::internal::git_grep() {
|
||||
# We want to include modified and untracked files because this might be
|
||||
# running against code which is not tracked by git yet.
|
||||
git grep --untracked "$@"
|
||||
function kube::codegen::internal::grep() {
|
||||
# We use `grep` rather than `git grep` because sometimes external projects
|
||||
# use this across repos.
|
||||
grep "$@" \
|
||||
--exclude-dir .git \
|
||||
--exclude-dir _output \
|
||||
--exclude-dir vendor
|
||||
}
|
||||
|
||||
# Generate tagged helper code: conversions, deepcopy, and defaults
|
||||
@@ -42,6 +49,7 @@ function kube::codegen::internal::git_grep() {
|
||||
# --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>
|
||||
# The root directory under which to emit code. The concatenation of
|
||||
@@ -118,23 +126,26 @@ function kube::codegen::gen_helpers() {
|
||||
# Deepcopy
|
||||
#
|
||||
local input_pkgs=()
|
||||
while read -r file; do
|
||||
dir="$(dirname "${file}")"
|
||||
while read -r dir; do
|
||||
pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)"
|
||||
input_pkgs+=("${pkg}")
|
||||
done < <(
|
||||
( kube::codegen::internal::git_grep -l \
|
||||
( kube::codegen::internal::grep -l --null \
|
||||
-e '+k8s:deepcopy-gen=' \
|
||||
":(glob)${root}"/'**/*.go' \
|
||||
-r "${root}" \
|
||||
--include '*.go' \
|
||||
|| true \
|
||||
) | LC_ALL=C sort -u
|
||||
) | while read -r -d $'\0' F; do dirname "${F}"; done \
|
||||
| LC_ALL=C sort -u
|
||||
)
|
||||
|
||||
if [ "${#input_pkgs[@]}" != 0 ]; then
|
||||
echo "Generating deepcopy code for ${#input_pkgs[@]} targets"
|
||||
|
||||
kube::codegen::internal::git_find -z \
|
||||
":(glob)${root}"/'**/zz_generated.deepcopy.go' \
|
||||
kube::codegen::internal::findz \
|
||||
"${root}" \
|
||||
-type f \
|
||||
-name zz_generated.deepcopy.go \
|
||||
| xargs -0 rm -f
|
||||
|
||||
local input_args=()
|
||||
@@ -143,7 +154,7 @@ function kube::codegen::gen_helpers() {
|
||||
done
|
||||
"${gobin}/deepcopy-gen" \
|
||||
-v "${v}" \
|
||||
-O zz_generated.deepcopy \
|
||||
--output-file-base zz_generated.deepcopy \
|
||||
--go-header-file "${boilerplate}" \
|
||||
--output-base "${out_base}" \
|
||||
"${input_args[@]}"
|
||||
@@ -152,23 +163,26 @@ function kube::codegen::gen_helpers() {
|
||||
# Defaults
|
||||
#
|
||||
local input_pkgs=()
|
||||
while read -r file; do
|
||||
dir="$(dirname "${file}")"
|
||||
while read -r dir; do
|
||||
pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)"
|
||||
input_pkgs+=("${pkg}")
|
||||
done < <(
|
||||
( kube::codegen::internal::git_grep -l \
|
||||
( kube::codegen::internal::grep -l --null \
|
||||
-e '+k8s:defaulter-gen=' \
|
||||
":(glob)${root}"/'**/*.go' \
|
||||
-r "${root}" \
|
||||
--include '*.go' \
|
||||
|| true \
|
||||
) | LC_ALL=C sort -u
|
||||
) | while read -r -d $'\0' F; do dirname "${F}"; done \
|
||||
| LC_ALL=C sort -u
|
||||
)
|
||||
|
||||
if [ "${#input_pkgs[@]}" != 0 ]; then
|
||||
echo "Generating defaulter code for ${#input_pkgs[@]} targets"
|
||||
|
||||
kube::codegen::internal::git_find -z \
|
||||
":(glob)${root}"/'**/zz_generated.defaults.go' \
|
||||
kube::codegen::internal::findz \
|
||||
"${root}" \
|
||||
-type f \
|
||||
-name zz_generated.defaults.go \
|
||||
| xargs -0 rm -f
|
||||
|
||||
local input_args=()
|
||||
@@ -177,7 +191,7 @@ function kube::codegen::gen_helpers() {
|
||||
done
|
||||
"${gobin}/defaulter-gen" \
|
||||
-v "${v}" \
|
||||
-O zz_generated.defaults \
|
||||
--output-file-base zz_generated.defaults \
|
||||
--go-header-file "${boilerplate}" \
|
||||
--output-base "${out_base}" \
|
||||
"${input_args[@]}"
|
||||
@@ -186,23 +200,26 @@ function kube::codegen::gen_helpers() {
|
||||
# Conversions
|
||||
#
|
||||
local input_pkgs=()
|
||||
while read -r file; do
|
||||
dir="$(dirname "${file}")"
|
||||
while read -r dir; do
|
||||
pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)"
|
||||
input_pkgs+=("${pkg}")
|
||||
done < <(
|
||||
( kube::codegen::internal::git_grep -l \
|
||||
( kube::codegen::internal::grep -l --null \
|
||||
-e '+k8s:conversion-gen=' \
|
||||
":(glob)${root}"/'**/*.go' \
|
||||
-r "${root}" \
|
||||
--include '*.go' \
|
||||
|| true \
|
||||
) | LC_ALL=C sort -u
|
||||
) | while read -r -d $'\0' F; do dirname "${F}"; done \
|
||||
| LC_ALL=C sort -u
|
||||
)
|
||||
|
||||
if [ "${#input_pkgs[@]}" != 0 ]; then
|
||||
echo "Generating conversion code for ${#input_pkgs[@]} targets"
|
||||
|
||||
kube::codegen::internal::git_find -z \
|
||||
":(glob)${root}"/'**/zz_generated.conversion.go' \
|
||||
kube::codegen::internal::findz \
|
||||
"${root}" \
|
||||
-type f \
|
||||
-name zz_generated.conversion.go \
|
||||
| xargs -0 rm -f
|
||||
|
||||
local input_args=()
|
||||
@@ -215,7 +232,7 @@ function kube::codegen::gen_helpers() {
|
||||
done
|
||||
"${gobin}/conversion-gen" \
|
||||
-v "${v}" \
|
||||
-O zz_generated.conversion \
|
||||
--output-file-base zz_generated.conversion \
|
||||
--go-header-file "${boilerplate}" \
|
||||
--output-base "${out_base}" \
|
||||
"${extra_peer_args[@]:+"${extra_peer_args[@]}"}" \
|
||||
@@ -229,6 +246,7 @@ function kube::codegen::gen_helpers() {
|
||||
# --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>
|
||||
# The root package under which generated directories and files
|
||||
@@ -347,23 +365,26 @@ function kube::codegen::gen_openapi() {
|
||||
root="$(cd "${root}" && pwd -P)"
|
||||
|
||||
local input_pkgs=( "${extra_pkgs[@]:+"${extra_pkgs[@]}"}")
|
||||
while read -r file; do
|
||||
dir="$(dirname "${file}")"
|
||||
while read -r dir; do
|
||||
pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)"
|
||||
input_pkgs+=("${pkg}")
|
||||
done < <(
|
||||
( kube::codegen::internal::git_grep -l \
|
||||
( kube::codegen::internal::grep -l --null \
|
||||
-e '+k8s:openapi-gen=' \
|
||||
":(glob)${root}"/'**/*.go' \
|
||||
-r "${root}" \
|
||||
--include '*.go' \
|
||||
|| true \
|
||||
) | LC_ALL=C sort -u
|
||||
) | while read -r -d $'\0' F; do dirname "${F}"; done \
|
||||
| LC_ALL=C sort -u
|
||||
)
|
||||
|
||||
if [ "${#input_pkgs[@]}" != 0 ]; then
|
||||
echo "Generating openapi code for ${#input_pkgs[@]} targets"
|
||||
|
||||
kube::codegen::internal::git_find -z \
|
||||
":(glob)${root}"/'**/zz_generated.openapi.go' \
|
||||
kube::codegen::internal::findz \
|
||||
"${root}" \
|
||||
-type f \
|
||||
-name zz_generated.openapi.go \
|
||||
| xargs -0 rm -f
|
||||
|
||||
local inputs=()
|
||||
@@ -372,7 +393,7 @@ function kube::codegen::gen_openapi() {
|
||||
done
|
||||
"${gobin}/openapi-gen" \
|
||||
-v "${v}" \
|
||||
-O zz_generated.openapi \
|
||||
--output-file-base zz_generated.openapi \
|
||||
--go-header-file "${boilerplate}" \
|
||||
--output-base "${out_base}" \
|
||||
--output-package "${out_pkg_root}/${openapi_subdir}" \
|
||||
@@ -396,9 +417,15 @@ function kube::codegen::gen_openapi() {
|
||||
#
|
||||
# Args:
|
||||
# --input-pkg-root <string>
|
||||
# The root package under which to search for types.go files which request
|
||||
# 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.
|
||||
#
|
||||
# --one-input-api <string>
|
||||
# A specific API (a directory) under the --input-pkg-root for which to
|
||||
# generate a client. If this is not set, clients for all APIs under the
|
||||
# input root will be generated (under the --output-pkg-root).
|
||||
#
|
||||
# --output-pkg-root <string>
|
||||
# The root package into which generated directories and files will be
|
||||
@@ -424,6 +451,10 @@ function kube::codegen::gen_openapi() {
|
||||
# --applyconfig-name <string = "applyconfiguration">
|
||||
# An optional override for the leaf name of the generated "applyconfiguration" directory.
|
||||
#
|
||||
# --applyconfig-externals <string = "">
|
||||
# An optional list of comma separated external apply configurations locations
|
||||
# in <type-package>.<type-name>:<applyconfiguration-package> form.
|
||||
#
|
||||
# --with-watch
|
||||
# Enables generation of listers and informers for APIs which support WATCH.
|
||||
#
|
||||
@@ -433,18 +464,24 @@ function kube::codegen::gen_openapi() {
|
||||
# --informers-name <string = "informers">
|
||||
# An optional override for the leaf name of the generated "informers" directory.
|
||||
#
|
||||
# --plural-exceptions <string = "">
|
||||
# An optional list of comma separated plural exception definitions in Type:PluralizedType form.
|
||||
#
|
||||
function kube::codegen::gen_client() {
|
||||
local in_pkg_root=""
|
||||
local one_input_api=""
|
||||
local out_pkg_root=""
|
||||
local out_base="" # gengo needs the output dir must be $out_base/$out_pkg_root
|
||||
local clientset_subdir="clientset"
|
||||
local clientset_versioned_name="versioned"
|
||||
local applyconfig="false"
|
||||
local applyconfig_subdir="applyconfiguration"
|
||||
local applyconfig_external=""
|
||||
local watchable="false"
|
||||
local listers_subdir="listers"
|
||||
local informers_subdir="informers"
|
||||
local boilerplate="${KUBE_CODEGEN_ROOT}/hack/boilerplate.go.txt"
|
||||
local plural_exceptions=""
|
||||
local v="${KUBE_VERBOSE:-0}"
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
@@ -453,6 +490,10 @@ function kube::codegen::gen_client() {
|
||||
in_pkg_root="$2"
|
||||
shift 2
|
||||
;;
|
||||
"--one-input-api")
|
||||
one_input_api="/$2"
|
||||
shift 2
|
||||
;;
|
||||
"--output-pkg-root")
|
||||
out_pkg_root="$2"
|
||||
shift 2
|
||||
@@ -481,6 +522,10 @@ function kube::codegen::gen_client() {
|
||||
applyconfig_subdir="$2"
|
||||
shift 2
|
||||
;;
|
||||
"--applyconfig-externals")
|
||||
applyconfig_external="$2"
|
||||
shift 2
|
||||
;;
|
||||
"--with-watch")
|
||||
watchable="true"
|
||||
shift
|
||||
@@ -493,6 +538,10 @@ function kube::codegen::gen_client() {
|
||||
informers_subdir="$2"
|
||||
shift 2
|
||||
;;
|
||||
"--plural-exceptions")
|
||||
plural_exceptions="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "unknown argument: $1" >&2
|
||||
return 1
|
||||
@@ -538,8 +587,7 @@ function kube::codegen::gen_client() {
|
||||
|
||||
local group_versions=()
|
||||
local input_pkgs=()
|
||||
while read -r file; do
|
||||
dir="$(dirname "${file}")"
|
||||
while read -r dir; do
|
||||
pkg="$(cd "${dir}" && GO111MODULE=on go list -find .)"
|
||||
leaf="$(basename "${dir}")"
|
||||
if grep -E -q '^v[0-9]+((alpha|beta)[0-9]+)?$' <<< "${leaf}"; then
|
||||
@@ -550,11 +598,13 @@ function kube::codegen::gen_client() {
|
||||
group_versions+=("${leaf2}/${leaf}")
|
||||
fi
|
||||
done < <(
|
||||
( kube::codegen::internal::git_grep -l \
|
||||
( kube::codegen::internal::grep -l --null \
|
||||
-e '+genclient' \
|
||||
":(glob)${in_root}"/'**/types.go' \
|
||||
-r "${in_root}${one_input_api}" \
|
||||
--include '*.go' \
|
||||
|| true \
|
||||
) | LC_ALL=C sort -u
|
||||
) | while read -r -d $'\0' F; do dirname "${F}"; done \
|
||||
| LC_ALL=C sort -u
|
||||
)
|
||||
|
||||
if [ "${#group_versions[@]}" == 0 ]; then
|
||||
@@ -567,9 +617,10 @@ function kube::codegen::gen_client() {
|
||||
|
||||
echo "Generating applyconfig code for ${#input_pkgs[@]} targets"
|
||||
|
||||
( kube::codegen::internal::git_grep -l --null \
|
||||
( kube::codegen::internal::grep -l --null \
|
||||
-e '^// Code generated by applyconfiguration-gen. DO NOT EDIT.$' \
|
||||
":(glob)${out_root}/${applyconfig_subdir}"/'**/*.go' \
|
||||
-r "${out_root}/${applyconfig_subdir}" \
|
||||
--include '*.go' \
|
||||
|| true \
|
||||
) | xargs -0 rm -f
|
||||
|
||||
@@ -582,14 +633,16 @@ function kube::codegen::gen_client() {
|
||||
--go-header-file "${boilerplate}" \
|
||||
--output-base "${out_base}" \
|
||||
--output-package "${out_pkg_root}/${applyconfig_subdir}" \
|
||||
--external-applyconfigurations "${applyconfig_external}" \
|
||||
"${inputs[@]}"
|
||||
fi
|
||||
|
||||
echo "Generating client code for ${#group_versions[@]} targets"
|
||||
|
||||
( kube::codegen::internal::git_grep -l --null \
|
||||
( kube::codegen::internal::grep -l --null \
|
||||
-e '^// Code generated by client-gen. DO NOT EDIT.$' \
|
||||
":(glob)${out_root}/${clientset_subdir}"/'**/*.go' \
|
||||
-r "${out_root}/${clientset_subdir}" \
|
||||
--include '*.go' \
|
||||
|| true \
|
||||
) | xargs -0 rm -f
|
||||
|
||||
@@ -605,14 +658,16 @@ function kube::codegen::gen_client() {
|
||||
--output-base "${out_base}" \
|
||||
--output-package "${out_pkg_root}/${clientset_subdir}" \
|
||||
--apply-configuration-package "${applyconfig_pkg}" \
|
||||
--plural-exceptions "${plural_exceptions}" \
|
||||
"${inputs[@]}"
|
||||
|
||||
if [ "${watchable}" == "true" ]; then
|
||||
echo "Generating lister code for ${#input_pkgs[@]} targets"
|
||||
|
||||
( kube::codegen::internal::git_grep -l --null \
|
||||
( kube::codegen::internal::grep -l --null \
|
||||
-e '^// Code generated by lister-gen. DO NOT EDIT.$' \
|
||||
":(glob)${out_root}/${listers_subdir}"/'**/*.go' \
|
||||
-r "${out_root}/${listers_subdir}" \
|
||||
--include '*.go' \
|
||||
|| true \
|
||||
) | xargs -0 rm -f
|
||||
|
||||
@@ -625,13 +680,15 @@ function kube::codegen::gen_client() {
|
||||
--go-header-file "${boilerplate}" \
|
||||
--output-base "${out_base}" \
|
||||
--output-package "${out_pkg_root}/${listers_subdir}" \
|
||||
--plural-exceptions "${plural_exceptions}" \
|
||||
"${inputs[@]}"
|
||||
|
||||
echo "Generating informer code for ${#input_pkgs[@]} targets"
|
||||
|
||||
( kube::codegen::internal::git_grep -l --null \
|
||||
( kube::codegen::internal::grep -l --null \
|
||||
-e '^// Code generated by informer-gen. DO NOT EDIT.$' \
|
||||
":(glob)${out_root}/${informers_subdir}"/'**/*.go' \
|
||||
-r "${out_root}/${informers_subdir}" \
|
||||
--include '*.go' \
|
||||
|| true \
|
||||
) | xargs -0 rm -f
|
||||
|
||||
@@ -646,6 +703,7 @@ function kube::codegen::gen_client() {
|
||||
--output-package "${out_pkg_root}/${informers_subdir}" \
|
||||
--versioned-clientset-package "${out_pkg_root}/${clientset_subdir}/${clientset_versioned_name}" \
|
||||
--listers-package "${out_pkg_root}/${listers_subdir}" \
|
||||
--plural-exceptions "${plural_exceptions}" \
|
||||
"${inputs[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user