conversion

package
v0.28.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 25 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDelegatingConverter added in v0.27.0

func NewDelegatingConverter(crd *apiextensionsv1.CustomResourceDefinition, delegate CRConverter) (safe, unsafe runtime.ObjectConvertor, err error)

NewDelegatingConverter returns new safe and unsafe converters based on the conversion settings in crd. These converters contain logic common to all converters, and they delegate the actual specific version-to-version conversion logic to the delegate.

func NewNOPConverter added in v0.27.0

func NewNOPConverter() *nopConverter

NewNOPConverter creates a new no-op converter. The only "conversion" it performs is to set the group and version to targetGV.

Types

type CRConverter added in v0.27.0

type CRConverter interface {
	// Convert converts in object to the given gvk and returns the converted object.
	// Note that the function may mutate in object and return it. A safe wrapper will make sure
	// a safe converter will be returned.
	Convert(in *unstructured.UnstructuredList, targetGVK schema.GroupVersion) (*unstructured.UnstructuredList, error)
}

CRConverter is the interface all CR converters must implement

type CRConverterFactory

type CRConverterFactory struct {
	// contains filtered or unexported fields
}

CRConverterFactory is the factory for all CR converters.

func NewCRConverterFactory

func NewCRConverterFactory(serviceResolver webhook.ServiceResolver, authResolverWrapper webhook.AuthenticationInfoResolverWrapper) (*CRConverterFactory, error)

NewCRConverterFactory creates a new CRConverterFactory that supports none and webhook conversion strategies.

func (*CRConverterFactory) NewConverter

NewConverter creates a new CRConverter based on the crd's conversion strategy. Supported strategies are none and webhook.

type Factory added in v0.27.0

type Factory interface {
	// NewConverter returns a CRConverter capable of converting crd's versions.
	//
	// For proper conversion, the returned CRConverter must be used via NewDelegatingConverter.
	//
	// When implementing a CRConverter, you do not need to: test for valid API versions or no-op
	// conversions, handle field selector logic, or handle scale conversions; these are all handled
	// via NewDelegatingConverter.
	NewConverter(crd *apiextensionsv1.CustomResourceDefinition) (CRConverter, error)
}

Factory is able to create a new CRConverter for crd.

Jump to

Keyboard shortcuts

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