apiextensions-apiserverk8s.io/apiextensions-apiserver/pkg/apiserver/conversion Index | Files

package conversion

import "k8s.io/apiextensions-apiserver/pkg/apiserver/conversion"

Index

Functions

func NewDelegatingConverter

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

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

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

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.

Source Files

converter.go metrics.go nop_converter.go webhook_converter.go

Version
v0.27.0-beta.0
Published
Mar 17, 2023
Platform
js/wasm
Imports
25 packages
Last checked
1 minute ago

Tools for package owners.