crd

package
v0.0.0-...-abac61d Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenAPIObject  = "object"
	OpenAPIArray   = "array"
	OpenAPIString  = "string"
	OpenAPIInteger = "integer"
	OpenAPINumber  = "number"
	OpenAPIBoolean = "boolean"
)
View Source
const (
	FirstVersion = ""
)

Variables

View Source
var (
	// ErrNoCRD failure when the YAML is not a CRD
	ErrNoCRD = errors.New("not a CRD")
)
View Source
var (
	// ErrNotProcessed means the hook did nothing as the CRDType did not apply to this hook
	ErrNotProcessed = errors.New("hook not")
)

Functions

func DecodeCRD

func DecodeCRD(content []byte) (*apiextensionsv1.CustomResourceDefinition, error)

func FromOpenAPIType

func FromOpenAPIType(td *gotype.TypeDict, hooks []OpenAPI2GoHook, crdType *CRDType) (*gotype.GoType, error)

FromOpenAPIType converts an OpenAPI schema to a GoType

func IsDateTimeFormat

func IsDateTimeFormat(crdType *CRDType) bool

func IsPrimitive

func IsPrimitive(crdType *CRDType) bool

func Kind2Filename

func Kind2Filename(kind string) string

func ParseCRD

ParseCRD scans a YAML stream and returns the next CRD found. If more than one CRD is present in the stream, calling again on the same stream will return the next CRD found.

Types

type CRDType

type CRDType struct {
	Name    string
	Parents []string
	Schema  *apiextensionsv1.JSONSchemaProps
}

type OpenAPI2GoHook

type OpenAPI2GoHook func(td *gotype.TypeDict, hooks []OpenAPI2GoHook, crdType *CRDType) (*gotype.GoType, error)

type VersionedCRD

type VersionedCRD struct {
	// Spec    *apiextensionsv1.CustomResourceDefinitionSpec
	Kind    string
	Version *apiextensionsv1.CustomResourceDefinitionVersion
}

func SelectVersion

func SelectVersion(spec *apiextensionsv1.CustomResourceDefinitionSpec, version string) *VersionedCRD

SelectVersion returns the version from the CRD spec that matches the given version string

func (*VersionedCRD) SpecTypename

func (versionedCRD *VersionedCRD) SpecTypename() string

func (*VersionedCRD) StatusTypename

func (versionedCRD *VersionedCRD) StatusTypename() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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