conversion

package
v0.0.0-...-87426b5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConversionController

func NewConversionController(
	ctx context.Context,
	path string,
	kinds map[schema.GroupKind]GroupKindConversion,
	withContext func(context.Context) context.Context,
) *controller.Impl

NewConversionController returns a K8s controller that will will reconcile CustomResourceDefinitions and update their conversion webhook attributes such as path & CA bundle.

Additionally the controller's Reconciler implements webhook.ConversionController for the purposes of converting resources between different versions

Types

type ConvertibleObject

type ConvertibleObject interface {
	// ConvertTo(ctx, to)
	// ConvertFrom(ctx, from)
	apis.Convertible

	// DeepCopyObject()
	// GetObjectKind() => SetGroupVersionKind(gvk)
	runtime.Object
}

ConvertibleObject defines the functionality our API types are required to implement in order to be convertible from one version to another

Optionally if the object implements apis.Defaultable the ConversionController will apply defaults before returning the response

type GroupKindConversion

type GroupKindConversion struct {
	// DefinitionName specifies the CustomResourceDefinition that should
	// be reconciled with by the controller.
	//
	// The conversion webhook configuration will be updated
	// when the CA bundle changes
	DefinitionName string

	// HubVersion specifies which version of the CustomResource supports
	// convertions to and from all types
	//
	// It is expected that the Zygotes map contains an entry for the
	// specified HubVersion
	HubVersion string

	// Zygotes contains a map of version strings (ie. v1, v2) to empty
	// ConvertibleObject objects
	//
	// During a conversion request these zygotes will be deep copied
	// and manipulated using the apis.Convertible interface
	Zygotes map[string]ConvertibleObject
}

GroupKindConversion specifies how a specific Kind for a given group should be converted

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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