conversion

package
v0.25.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

README

Conversion utilities

The conversion utilities have been copied from cluster API and adapted, see https://github.com/kubernetes-sigs/cluster-api/blob/f4a76c749d91b7ae654ae4dd838a199939bc6323/util/conversion/conversion.go.

Documentation

Overview

Package conversion implements conversion utilities. The conversion utilities have been copied from cluster API and adapted, see <https://github.com/kubernetes-sigs/cluster-api/blob/f4a76c749d91b7ae654ae4dd838a199939bc6323/util/conversion/conversion.go>.

Index

Constants

View Source
const (
	// DataAnnotation is the annotation that conversion webhooks
	// use to retain the data in case of down-conversion from the hub.
	DataAnnotation = "run.tanzu.vmware.com/conversion-data"
)

Variables

This section is empty.

Functions

func FuzzTestFunc

func FuzzTestFunc(input *FuzzTestFuncInput) func(*testing.T)

FuzzTestFunc returns a new testing function to be used in tests to make sure conversions between the Hub version of an object and an older version aren't lossy.

func GetFuzzer

func GetFuzzer(runtimeScheme *runtime.Scheme, funcs ...fuzzer.FuzzerFuncs) *fuzz.Fuzzer

GetFuzzer returns a new fuzzer to be used for testing.

func MarshalData

func MarshalData(src, dst metav1.Object) error

MarshalData stores the source object as json data in the destination object annotations map. It ignores the metadata of the source object.

func UnmarshalData

func UnmarshalData(from metav1.Object, to interface{}) (bool, error)

UnmarshalData tries to retrieve the data from the annotation and unmarshals it into the object passed as input.

Types

type FuzzTestFuncInput

type FuzzTestFuncInput struct {
	Scheme *runtime.Scheme

	Hub              conversion.Hub
	HubAfterMutation func(conversion.Hub)

	Spoke                      conversion.Convertible
	SpokeAfterMutation         func(convertible conversion.Convertible)
	SkipSpokeAnnotationCleanup bool

	FuzzerFuncs []fuzzer.FuzzerFuncs
}

FuzzTestFuncInput contains input parameters for the FuzzTestFunc function.

Jump to

Keyboard shortcuts

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