xrd

package
v0.0.0-...-57ccdc6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	// IgnoreUnexportedFields indicates that we should skip unexported fields.
	//
	// Left unspecified, the default is false.
	IgnoreUnexportedFields *bool `marker:",optional"`

	// AllowDangerousTypes allows types which are usually omitted from CRD generation
	// because they are not recommended.
	//
	// Currently the following additional types are allowed when this is true:
	// float32
	// float64
	//
	// Left unspecified, the default is false
	AllowDangerousTypes *bool `marker:",optional"`

	// MaxDescLen specifies the maximum description length for fields in CRD's OpenAPI schema.
	//
	// 0 indicates drop the description for all fields completely.
	// n indicates limit the description to at most n characters and truncate the description to
	// closest sentence boundary if it exceeds n characters.
	MaxDescLen *int `marker:",optional"`

	// CRDVersions specifies the target API versions of the CRD type itself to
	// generate. Defaults to v1.
	//
	// Currently, the only supported value is v1.
	//
	// The first version listed will be assumed to be the "default" version and
	// will not get a version suffix in the output filename.
	//
	// You'll need to use "v1" to get support for features like defaulting,
	// along with an API server that supports it (Kubernetes 1.16+).
	CRDVersions []string `marker:"crdVersions,optional"`

	// GenerateEmbeddedObjectMeta specifies if any embedded ObjectMeta in the CRD should be generated
	GenerateEmbeddedObjectMeta *bool `marker:",optional"`
}

Generator is a generator for XRDs.

func (Generator) CheckFilter

func (Generator) CheckFilter() loader.NodeFilter

CheckFilter returns the node filter for this generator.

func (Generator) Generate

func (g Generator) Generate(ctx *genall.GenerationContext) error

Generate generates the XRDs for the given GenerationContext.

func (Generator) RegisterMarkers

func (Generator) RegisterMarkers(into *markers.Registry) error

RegisterMarkers registers the markers used by this generator.

type PackageOverride

type PackageOverride func(p *Parser, pkg *loader.Package)

PackageOverride overrides the loading of some package (potentially setting custom schemata, etc). It must call AddPackage if it wants to continue with the default loading behavior.

type Parser

type Parser struct {
	Collector *markers.Collector

	// Types contains the known TypeInfo for this parser.
	Types map[crd.TypeIdent]*markers.TypeInfo
	// GroupVersions contains the known group-versions of each package in this parser.
	GroupVersions map[*loader.Package]schema.GroupVersion

	// PackageOverrides indicates that the loading of any package with
	// the given path should be handled by the given overrider.
	PackageOverrides map[string]PackageOverride

	// checker stores persistent partial type-checking/reference-traversal information.
	Checker *loader.TypeChecker
	// contains filtered or unexported fields
}

Parser is used to apply XRD markers.

func (*Parser) AddPackage

func (p *Parser) AddPackage(pkg *loader.Package)

AddPackage indicates that types and type-checking information is needed for the the given package, *ignoring* overrides. Generally, consumers should call NeedPackage, while PackageOverrides should call AddPackage to continue with the normal loading procedure.

func (*Parser) ApplyForXRD

func (p *Parser) ApplyForXRD(xrd *xapiext.CompositeResourceDefinition)

ApplyForXRD applies all markers to the generated XRD.

func (*Parser) NeedPackage

func (p *Parser) NeedPackage(pkg *loader.Package)

NeedPackage indicates that types and type-checking information is needed for the given package.

type XRDMarker

type XRDMarker interface {
	ApplyToXRD(xrd *xapiext.CompositeResourceDefinition, version string) error
}

XRDMarker defines a marker for XRD types.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL