update the apply generator to use the same package the the client generator expects

This commit is contained in:
David Eads 2022-08-22 16:01:55 -04:00
parent e643b0e667
commit 06497aa13c

View File

@ -30,6 +30,7 @@ import (
"k8s.io/klog/v2" "k8s.io/klog/v2"
applygenargs "k8s.io/code-generator/cmd/applyconfiguration-gen/args" applygenargs "k8s.io/code-generator/cmd/applyconfiguration-gen/args"
"k8s.io/code-generator/cmd/client-gen/generators/util"
clientgentypes "k8s.io/code-generator/cmd/client-gen/types" clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
) )
@ -236,8 +237,10 @@ func packageTypesForInputDirs(context *generator.Context, inputDirs []string, ou
klog.Warningf("Skipping internal package: %s", p.Path) klog.Warningf("Skipping internal package: %s", p.Path)
continue continue
} }
gv := groupVersion(p) // this is how the client generator finds the package we are creating. It uses the API package name, not the group name.
pkg := filepath.Join(outputPath, gv.Group.PackageName(), strings.ToLower(gv.Version.NonEmpty())) _, gvPackageString := util.ParsePathGroupVersion(p.Path)
pkg := filepath.Join(outputPath, strings.ToLower(gvPackageString))
pkgTypes[pkg] = p pkgTypes[pkg] = p
} }
return pkgTypes return pkgTypes