func (p *Parser) LookupType(pkg *loader.Package, name string) *markers.TypeInfo {
	return p.Types[TypeIdent{Package: pkg, Name: name}]
}
LookupType fetches type info from Types.
package crd
import (
	"fmt"
	apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-tools/pkg/loader"
	"sigs.k8s.io/controller-tools/pkg/markers"
)
type TypeIdent struct {
	Package *loader.Package
	Name    string
}
func (t TypeIdent) String() string {
	return fmt.Sprintf("%q.%s", t.Package.ID, t.Name)
}
type PackageOverride func(p *Parser, pkg *loader.Package)
type Parser struct {
	Collector *markers.Collector
	Types map[TypeIdent]*markers.TypeInfo
	Schemata map[TypeIdent]apiext.JSONSchemaProps
	GroupVersions map[*loader.Package]schema.GroupVersion
	CustomResourceDefinitions map[schema.GroupKind]apiext.CustomResourceDefinition
	FlattenedSchemata map[TypeIdent]apiext.JSONSchemaProps
	PackageOverrides map[string]PackageOverride
	Checker *loader.TypeChecker
	packages map[*loader.Package]struct{}
	flattener *Flattener
	AllowDangerousTypes bool
	GenerateEmbeddedObjectMeta bool
}
func (p *Parser) init() {
	if p.packages == nil {
		p.packages = make(map[*loader.Package]struct{})
	}
	if p.flattener == nil {
		p.flattener = &Flattener{
			Parser: p,
		}
	}
	if p.Schemata == nil {
		p.Schemata = make(map[TypeIdent]apiext.JSONSchemaProps)
	}
	if p.Types == nil {
		p.Types = make(map[TypeIdent]*markers.TypeInfo)
	}
	if p.PackageOverrides == nil {
		p.PackageOverrides = make(map[string]PackageOverride)
	}
	if p.GroupVersions == nil {
		p.GroupVersions = make(map[*loader.Package]schema.GroupVersion)
	}
	if p.CustomResourceDefinitions == nil {
		p.CustomResourceDefinitions = make(map[schema.GroupKind]apiext.CustomResourceDefinition)
	}
	if p.FlattenedSchemata == nil {
		p.FlattenedSchemata = make(map[TypeIdent]apiext.JSONSchemaProps)
	}
}
func (p *Parser) indexTypes(pkg *loader.Package) {
	pkgMarkers, err := markers.PackageMarkers(p.Collector, pkg)
	if err != nil {
		pkg.AddError(err)
	} else {
		if skipPkg := pkgMarkers.Get("kubebuilder:skip"); skipPkg != nil {
			return
		}
		if nameVal := pkgMarkers.Get("groupName"); nameVal != nil {
			versionVal := pkg.Name  
			if versionMarker := pkgMarkers.Get("versionName"); versionMarker != nil {
				versionVal = versionMarker.(string)
			}
			p.GroupVersions[pkg] = schema.GroupVersion{
				Version: versionVal,
				Group:   nameVal.(string),
			}
		}
	}
	if err := markers.EachType(p.Collector, pkg, func(info *markers.TypeInfo) {
		ident := TypeIdent{
			Package: pkg,
			Name:    info.Name,
		}
		p.Types[ident] = info
	}); err != nil {
		pkg.AddError(err)
	}
}