diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index c17b2f5198d..501c57d9e0e 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -553,7 +553,7 @@ function codegen::openapi() { --go-header-file "${BOILERPLATE_FILENAME}" \ --output-file-base "${output_file}" \ --output-dir "${output_dir}" \ - --output-package "${output_pkg}" \ + --output-pkg "${output_pkg}" \ --report-filename "${report_file}" \ $(printf -- " -i %s" "${tag_pkgs[@]}") \ "$@" @@ -609,7 +609,7 @@ function codegen::applyconfigs() { --openapi-schema <("${modelsschema}") \ --go-header-file "${BOILERPLATE_FILENAME}" \ --output-dir "${KUBE_ROOT}/staging/src/${APPLYCONFIG_PKG}" \ - --output-package "${APPLYCONFIG_PKG}" \ + --output-pkg "${APPLYCONFIG_PKG}" \ $(printf -- " --input-dirs %s" "${ext_apis[@]}") \ "$@" @@ -662,7 +662,7 @@ function codegen::clients() { -v "${KUBE_VERBOSE}" \ --go-header-file "${BOILERPLATE_FILENAME}" \ --output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go" \ - --output-package="k8s.io/client-go" \ + --output-pkg="k8s.io/client-go" \ --clientset-name="kubernetes" \ --input-base="k8s.io/api" \ --apply-configuration-package "${APPLYCONFIG_PKG}" \ @@ -707,7 +707,7 @@ function codegen::listers() { -v "${KUBE_VERBOSE}" \ --go-header-file "${BOILERPLATE_FILENAME}" \ --output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go/listers" \ - --output-package "k8s.io/client-go/listers" \ + --output-pkg "k8s.io/client-go/listers" \ $(printf -- " --input-dirs %s" "${ext_apis[@]}") \ "$@" @@ -749,7 +749,7 @@ function codegen::informers() { -v "${KUBE_VERBOSE}" \ --go-header-file "${BOILERPLATE_FILENAME}" \ --output-dir "${KUBE_ROOT}/staging/src/k8s.io/client-go/informers" \ - --output-package "k8s.io/client-go/informers" \ + --output-pkg "k8s.io/client-go/informers" \ --single-directory \ --versioned-clientset-package "k8s.io/client-go/kubernetes" \ --listers-package "k8s.io/client-go/listers" \ diff --git a/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go b/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go index 3c2ee3ec2e2..530f8b67330 100644 --- a/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go +++ b/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/args/args.go @@ -26,8 +26,8 @@ import ( // CustomArgs is a wrapper for arguments to applyconfiguration-gen. type CustomArgs struct { - OutputDir string // must be a directory path - OutputPackage string // must be a Go import-path + OutputDir string // must be a directory path + OutputPkg string // must be a Go import-path // ExternalApplyConfigurations provides the locations of externally generated // apply configuration types for types referenced by the go structs provided as input. @@ -68,7 +68,7 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) { func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet, inputBase string) { fs.StringVar(&ca.OutputDir, "output-dir", "", "the base directory under which to generate results") - fs.StringVar(&ca.OutputPackage, "output-package", ca.OutputPackage, + fs.StringVar(&ca.OutputPkg, "output-pkg", ca.OutputPkg, "the Go import-path of the generated results") fs.Var(NewExternalApplyConfigurationValue(&ca.ExternalApplyConfigurations, nil), "external-applyconfigurations", "list of comma separated external apply configurations locations in .: form."+ @@ -84,8 +84,8 @@ func Validate(genericArgs *args.GeneratorArgs) error { if len(customArgs.OutputDir) == 0 { return fmt.Errorf("--output-dir must be specified") } - if len(customArgs.OutputPackage) == 0 { - return fmt.Errorf("--output-package must be specified") + if len(customArgs.OutputPkg) == 0 { + return fmt.Errorf("--output-pkg must be specified") } return nil diff --git a/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/targets.go b/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/targets.go index 708db5a9fb4..6522d40cd37 100644 --- a/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/targets.go +++ b/staging/src/k8s.io/code-generator/cmd/applyconfiguration-gen/generators/targets.go @@ -63,7 +63,7 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen customArgs := arguments.CustomArgs.(*applygenargs.CustomArgs) - pkgTypes := packageTypesForInputDirs(context, arguments.InputDirs, customArgs.OutputPackage) + pkgTypes := packageTypesForInputDirs(context, arguments.InputDirs, customArgs.OutputPkg) initialTypes := customArgs.ExternalApplyConfigurations refs := refGraphForReachableTypes(context.Universe, pkgTypes, initialTypes) typeModels, err := newTypeModels(customArgs.OpenAPISchemaFilePath, pkgTypes) @@ -103,13 +103,13 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen // Apparently we allow the groupName to be overridden in a way that it // no longer maps to a Go package by name. So we have to figure out // the offset of this particular output package (pkg) from the base - // output package (customArgs.OutputPackage). - pkgSubdir := strings.TrimPrefix(pkg, customArgs.OutputPackage+"/") + // output package (customArgs.OutputPkg). + pkgSubdir := strings.TrimPrefix(pkg, customArgs.OutputPkg+"/") // generate the apply configurations targetList = append(targetList, targetForApplyConfigurationsPackage( - customArgs.OutputDir, customArgs.OutputPackage, pkgSubdir, + customArgs.OutputDir, customArgs.OutputPkg, pkgSubdir, boilerplate, gv, toGenerate, refs, typeModels)) // group all the generated apply configurations by gv so ForKind() can be generated @@ -133,11 +133,11 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen // generate ForKind() utility function targetList = append(targetList, - targetForUtils(customArgs.OutputDir, customArgs.OutputPackage, + targetForUtils(customArgs.OutputDir, customArgs.OutputPkg, boilerplate, groupVersions, applyConfigsForGroupVersion, groupGoNames)) // generate internal embedded schema, required for generated Extract functions targetList = append(targetList, - targetForInternal(customArgs.OutputDir, customArgs.OutputPackage, + targetForInternal(customArgs.OutputDir, customArgs.OutputPkg, boilerplate, typeModels)) return targetList diff --git a/staging/src/k8s.io/code-generator/cmd/client-gen/args/args.go b/staging/src/k8s.io/code-generator/cmd/client-gen/args/args.go index a650785630e..e7335a33144 100644 --- a/staging/src/k8s.io/code-generator/cmd/client-gen/args/args.go +++ b/staging/src/k8s.io/code-generator/cmd/client-gen/args/args.go @@ -33,7 +33,7 @@ type CustomArgs struct { OutputDir string // The Go import-path of the generated results. - OutputPackage string + OutputPkg string // A sorted list of group versions to generate. For each of them the package path is found // in GroupVersionToInputPath. @@ -83,7 +83,7 @@ func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet, inputBase string) { gvsBuilder := NewGroupVersionsBuilder(&ca.Groups) fs.StringVar(&ca.OutputDir, "output-dir", "", "the base directory under which to generate results") - fs.StringVar(&ca.OutputPackage, "output-package", ca.OutputPackage, + fs.StringVar(&ca.OutputPkg, "output-pkg", ca.OutputPkg, "the Go import-path of the generated results") 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.") @@ -97,7 +97,7 @@ func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet, inputBase string) { 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.") // support old flags - fs.SetNormalizeFunc(mapFlagName("clientset-path", "output-package", fs.GetNormalizeFunc())) + fs.SetNormalizeFunc(mapFlagName("clientset-path", "output-pkg", fs.GetNormalizeFunc())) } func Validate(genericArgs *args.GeneratorArgs) error { @@ -106,8 +106,8 @@ func Validate(genericArgs *args.GeneratorArgs) error { if len(customArgs.OutputDir) == 0 { return fmt.Errorf("--output-dir must be specified") } - if len(customArgs.OutputPackage) == 0 { - return fmt.Errorf("--output-package must be specified") + if len(customArgs.OutputPkg) == 0 { + return fmt.Errorf("--output-pkg must be specified") } if len(customArgs.ClientsetName) == 0 { return fmt.Errorf("--clientset-name must be specified") diff --git a/staging/src/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go b/staging/src/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go index 6ed8386a2f2..78cb32a015b 100644 --- a/staging/src/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go +++ b/staging/src/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go @@ -255,7 +255,7 @@ NextGroup: OutputFilename: "register.go", }, InputPackages: customArgs.GroupVersionPackages(), - OutputPackage: schemePkg, + OutputPkg: schemePkg, OutputPath: schemeDir, Groups: customArgs.Groups, GroupGoNames: groupGoNames, @@ -396,7 +396,7 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen } clientsetDir := filepath.Join(customArgs.OutputDir, customArgs.ClientsetName) - clientsetPkg := filepath.Join(customArgs.OutputPackage, customArgs.ClientsetName) + clientsetPkg := filepath.Join(customArgs.OutputPkg, customArgs.ClientsetName) var targetList []generator.Target diff --git a/staging/src/k8s.io/code-generator/cmd/client-gen/generators/fake/fake_client_generator.go b/staging/src/k8s.io/code-generator/cmd/client-gen/generators/fake/fake_client_generator.go index 8a3168617a4..a8c27076aec 100644 --- a/staging/src/k8s.io/code-generator/cmd/client-gen/generators/fake/fake_client_generator.go +++ b/staging/src/k8s.io/code-generator/cmd/client-gen/generators/fake/fake_client_generator.go @@ -118,7 +118,7 @@ func TargetForClientset(customArgs *clientgenargs.CustomArgs, clientsetDir, clie OutputFilename: "register.go", }, InputPackages: customArgs.GroupVersionPackages(), - OutputPackage: clientsetPkg, + OutputPkg: clientsetPkg, Groups: customArgs.Groups, GroupGoNames: groupGoNames, ImportTracker: generator.NewImportTracker(), diff --git a/staging/src/k8s.io/code-generator/cmd/client-gen/generators/scheme/generator_for_scheme.go b/staging/src/k8s.io/code-generator/cmd/client-gen/generators/scheme/generator_for_scheme.go index c1e3e9d5bf6..411a27711c1 100644 --- a/staging/src/k8s.io/code-generator/cmd/client-gen/generators/scheme/generator_for_scheme.go +++ b/staging/src/k8s.io/code-generator/cmd/client-gen/generators/scheme/generator_for_scheme.go @@ -32,7 +32,7 @@ import ( // GenScheme produces a package for a clientset with the scheme, codecs and parameter codecs. type GenScheme struct { generator.GoGenerator - OutputPackage string // Must be a Go import-path + OutputPkg string // Must be a Go import-path OutputPath string // optional Groups []clientgentypes.GroupVersions GroupGoNames map[clientgentypes.GroupVersion]string @@ -45,7 +45,7 @@ type GenScheme struct { func (g *GenScheme) Namers(c *generator.Context) namer.NameSystems { return namer.NameSystems{ - "raw": namer.NewRawNamer(g.OutputPackage, g.ImportTracker), + "raw": namer.NewRawNamer(g.OutputPkg, g.ImportTracker), } } diff --git a/staging/src/k8s.io/code-generator/cmd/informer-gen/args/args.go b/staging/src/k8s.io/code-generator/cmd/informer-gen/args/args.go index 537d2632a1f..beed56da9e7 100644 --- a/staging/src/k8s.io/code-generator/cmd/informer-gen/args/args.go +++ b/staging/src/k8s.io/code-generator/cmd/informer-gen/args/args.go @@ -26,7 +26,7 @@ import ( // CustomArgs is used by the gengo framework to pass args specific to this generator. type CustomArgs struct { OutputDir string // must be a directory path - OutputPackage string // must be a Go import-path + OutputPkg string // must be a Go import-path VersionedClientSetPackage string // must be a Go import-path InternalClientSetPackage string // must be a Go import-path ListersPackage string // must be a Go import-path @@ -53,7 +53,7 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) { func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&ca.OutputDir, "output-dir", "", "the base directory under which to generate results") - fs.StringVar(&ca.OutputPackage, "output-package", ca.OutputPackage, + fs.StringVar(&ca.OutputPkg, "output-pkg", ca.OutputPkg, "the Go import-path of the generated results") fs.StringVar(&ca.InternalClientSetPackage, "internal-clientset-package", ca.InternalClientSetPackage, "the Go import-path of the internal clientset to use") fs.StringVar(&ca.VersionedClientSetPackage, "versioned-clientset-package", ca.VersionedClientSetPackage, "the Go import-path of the versioned clientset to use") @@ -69,8 +69,8 @@ func Validate(genericArgs *args.GeneratorArgs) error { if len(customArgs.OutputDir) == 0 { return fmt.Errorf("--output-dir must be specified") } - if len(customArgs.OutputPackage) == 0 { - return fmt.Errorf("--output-package must be specified") + if len(customArgs.OutputPkg) == 0 { + return fmt.Errorf("--output-pkg must be specified") } if len(customArgs.VersionedClientSetPackage) == 0 { return fmt.Errorf("--versioned-clientset-package must be specified") diff --git a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/targets.go b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/targets.go index 35448d9f030..b3e67d051cb 100644 --- a/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/targets.go +++ b/staging/src/k8s.io/code-generator/cmd/informer-gen/generators/targets.go @@ -102,9 +102,9 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen customArgs := arguments.CustomArgs.(*informergenargs.CustomArgs) internalVersionOutputDir := customArgs.OutputDir - internalVersionOutputPkg := customArgs.OutputPackage + internalVersionOutputPkg := customArgs.OutputPkg externalVersionOutputDir := customArgs.OutputDir - externalVersionOutputPkg := customArgs.OutputPackage + externalVersionOutputPkg := customArgs.OutputPkg if !customArgs.SingleDirectory { internalVersionOutputDir = filepath.Join(internalVersionOutputDir, "internalversion") internalVersionOutputPkg = filepath.Join(internalVersionOutputPkg, "internalversion") diff --git a/staging/src/k8s.io/code-generator/cmd/lister-gen/args/args.go b/staging/src/k8s.io/code-generator/cmd/lister-gen/args/args.go index 0f2febcc855..d031b8effdb 100644 --- a/staging/src/k8s.io/code-generator/cmd/lister-gen/args/args.go +++ b/staging/src/k8s.io/code-generator/cmd/lister-gen/args/args.go @@ -25,8 +25,8 @@ import ( // CustomArgs is used by the gengo framework to pass args specific to this generator. type CustomArgs struct { - OutputDir string // must be a directory path - OutputPackage string // must be a Go import-path + OutputDir string // must be a directory path + OutputPkg string // must be a Go import-path // PluralExceptions specify list of exceptions used when pluralizing certain types. // For example 'Endpoints:Endpoints', otherwise the pluralizer will generate 'Endpointes'. @@ -48,7 +48,7 @@ func NewDefaults() (*args.GeneratorArgs, *CustomArgs) { func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&ca.OutputDir, "output-dir", "", "the base directory under which to generate results") - fs.StringVar(&ca.OutputPackage, "output-package", "", + fs.StringVar(&ca.OutputPkg, "output-pkg", "", "the base Go import-path under which to generate results") fs.StringSliceVar(&ca.PluralExceptions, "plural-exceptions", ca.PluralExceptions, "list of comma separated plural exception definitions in Type:PluralizedType format") @@ -61,8 +61,8 @@ func Validate(genericArgs *args.GeneratorArgs) error { if len(custom.OutputDir) == 0 { return fmt.Errorf("--output-dir must be specified") } - if len(custom.OutputPackage) == 0 { - return fmt.Errorf("--output-package must be specified") + if len(custom.OutputPkg) == 0 { + return fmt.Errorf("--output-pkg must be specified") } return nil diff --git a/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/lister.go b/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/lister.go index 6a0e2758730..06a0e1f6088 100644 --- a/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/lister.go +++ b/staging/src/k8s.io/code-generator/cmd/lister-gen/generators/lister.go @@ -122,7 +122,7 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen subdir := filepath.Join(groupPackageName, strings.ToLower(gv.Version.NonEmpty())) outputDir := filepath.Join(customArgs.OutputDir, subdir) - outputPkg := filepath.Join(customArgs.OutputPackage, subdir) + outputPkg := filepath.Join(customArgs.OutputPkg, subdir) targetList = append(targetList, &generator.SimpleTarget{ PkgName: strings.ToLower(gv.Version.NonEmpty()), PkgPath: outputPkg, diff --git a/staging/src/k8s.io/code-generator/kube_codegen.sh b/staging/src/k8s.io/code-generator/kube_codegen.sh index f6a18244a8a..5dd1e5faa87 100755 --- a/staging/src/k8s.io/code-generator/kube_codegen.sh +++ b/staging/src/k8s.io/code-generator/kube_codegen.sh @@ -376,7 +376,7 @@ function kube::codegen::gen_openapi() { --output-file-base zz_generated.openapi.go \ --go-header-file "${boilerplate}" \ --output-dir "${out_dir}" \ - --output-package "${out_pkg}" \ + --output-pkg "${out_pkg}" \ --report-filename "${new_report}" \ --input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1" \ --input-dirs "k8s.io/apimachinery/pkg/runtime" \ @@ -612,7 +612,7 @@ function kube::codegen::gen_client() { -v "${v}" \ --go-header-file "${boilerplate}" \ --output-dir "${out_dir}/${applyconfig_subdir}" \ - --output-package "${applyconfig_pkg}" \ + --output-pkg "${applyconfig_pkg}" \ --external-applyconfigurations "${applyconfig_external}" \ "${inputs[@]}" fi @@ -634,7 +634,7 @@ function kube::codegen::gen_client() { -v "${v}" \ --go-header-file "${boilerplate}" \ --output-dir "${out_dir}/${clientset_subdir}" \ - --output-package "${out_pkg}/${clientset_subdir}" \ + --output-pkg "${out_pkg}/${clientset_subdir}" \ --clientset-name "${clientset_versioned_name}" \ --apply-configuration-package "${applyconfig_pkg}" \ --input-base "$(cd "${in_dir}" && pwd -P)" `# must be absolute path or Go import path"` \ @@ -659,7 +659,7 @@ function kube::codegen::gen_client() { -v "${v}" \ --go-header-file "${boilerplate}" \ --output-dir "${out_dir}/${listers_subdir}" \ - --output-package "${out_pkg}/${listers_subdir}" \ + --output-pkg "${out_pkg}/${listers_subdir}" \ --plural-exceptions "${plural_exceptions}" \ "${inputs[@]}" @@ -680,7 +680,7 @@ function kube::codegen::gen_client() { -v "${v}" \ --go-header-file "${boilerplate}" \ --output-dir "${out_dir}/${informers_subdir}" \ - --output-package "${out_pkg}/${informers_subdir}" \ + --output-pkg "${out_pkg}/${informers_subdir}" \ --versioned-clientset-package "${out_pkg}/${clientset_subdir}/${clientset_versioned_name}" \ --listers-package "${out_pkg}/${listers_subdir}" \ --plural-exceptions "${plural_exceptions}" \