plugin

package
v0.0.0-...-4fe213c Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 392

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareInt64Slices

func CompareInt64Slices(a, b []int64) bool

func CompareMapBool

func CompareMapBool(a, b map[string]bool) bool

func CompareMapInt64

func CompareMapInt64(a, b map[string]int64) bool

func CompareMapString

func CompareMapString(a, b map[string]string) bool

func CompareStringSlices

func CompareStringSlices(a, b []string) bool

Types

type CtyDecoder

type CtyDecoder interface {
	DecodeCty(xpresource.Managed, cty.Value, *providers.Schema) (xpresource.Managed, error)
}

type CtyEncoder

type CtyEncoder interface {
	EncodeCty(xpresource.Managed, *providers.Schema) (cty.Value, error)
}

type Implementation

type Implementation struct {
	// GVK is used to index other elements of the Entry by GVK
	GVK k8schema.GroupVersionKind
	// TerraformResourceName is needed to map the crossplane type
	// to the Terraform type name. This is needed to find the schema
	// for the type and to identify the type in API calls.
	TerraformResourceName string
	// SchemeBuilder is used to register the controller for this type with the
	// controller runtime. StartTerraformManager (in pkg/controller) iterates
	// through all the registration entries and performs the bindings.
	SchemeBuilder *scheme.Builder
	// ReconcilerConfigurer is the function responsible for calling
	// managed.NewReconciler to bind the reconciler to the managed resource
	// type. It is also invoked in StartTerraformManager.
	ReconcilerConfigurer ReconcilerConfigurer
	// ResourceMerger can update the local kubernetes object with attributes
	// from the cloud provider, late-initializing Spec fields, copying over Status
	// fields and annotations.
	ResourceMerger ResourceMerger
	// CtyEncoder produces the cty.Value (cty-encoded resource for
	// terraform) for a resource.Managed, given the corresponding schema
	// object. Note that we do not try to compile schemas in to the generated
	// code, they are always obtained from the terraform process itself.
	CtyEncoder CtyEncoder
	// CtyDecoder is the complement to EncodeCtyCallback. In addition
	// to the schema and cty.Value, it also requires a resource.Managed, using
	// the deepcopied value from this resource as the base structure (and
	// providing values for .Spec fields and k8s metadata)
	CtyDecoder CtyDecoder
	// ResourceYAMLMarshaller is the complement to UnmarshalResourceCallback, taking
	// a resource.Managed and producing the []byte representation.
	ResourceYAMLMarshaller ResourceYAMLMarshaller
	// ResourceYAMLUnmarshaller is only used for prototyping atm -- it's a
	// function that can parse the []byte representation of a managed resource
	// to a resource.Managed
	ResourceYAMLUnmarshaller ResourceYAMLUnmarshaller
}

Implementation is a collection of callbacks required to implement a resource There can be multiple Implementations for a resource; ImplementationMerger is used to overlay them in a predictable fashion.

type ImplementationMerger

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

An ImplementationMerger collects a sequence of Implementations through the Overlay method, and then can generate a single Implementation which is the result of merging all the layers into a single Implementation. It does this by picking a non-nil value for each field from the highest possible layer. Please see indexer_test.go for clarification.

func NewImplementationMerger

func NewImplementationMerger() *ImplementationMerger

func (*ImplementationMerger) Merge

func (mt *ImplementationMerger) Merge() (Implementation, error)

Merge flattens all the layers in the ImplementationMerger, with the invariant: a layers' non-empty fields always replace underlying layers' fields. So last field Overlayed wins, eg call Overlay w/ the generated base Implementation before the user-override Implementations. I don't know if we really need an error; if we can assume generated Implementations cover everything, we don't. if that turns out to be a bad assumption, the error would give us an escape hatch to fail on incomplete implementations at runtime.

func (*ImplementationMerger) Overlay

func (mt *ImplementationMerger) Overlay(ft *Implementation)

type Index

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

func (*Index) InvokerForGVK

func (idx *Index) InvokerForGVK(gvk k8schema.GroupVersionKind) (*Invoker, error)

func (*Index) ReconcilerConfigurers

func (idx *Index) ReconcilerConfigurers() []ReconcilerConfigurer

func (*Index) SchemeBuilders

func (idx *Index) SchemeBuilders() []*scheme.Builder

type Indexer

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

func NewIndexer

func NewIndexer() *Indexer

func (*Indexer) BuildIndex

func (i *Indexer) BuildIndex() (*Index, error)

func (*Indexer) Overlay

func (i *Indexer) Overlay(ft *Implementation) error

type Invoker

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

func (*Invoker) DecodeCty

func (*Invoker) EncodeCty

func (a *Invoker) EncodeCty(r xpresource.Managed, s *providers.Schema) (cty.Value, error)

func (*Invoker) GVK

func (*Invoker) MarshalResourceYaml

func (a *Invoker) MarshalResourceYaml(r xpresource.Managed) ([]byte, error)

func (*Invoker) MergeResources

func (a *Invoker) MergeResources(f xpresource.Managed, t xpresource.Managed) (MergeDescription, error)

func (*Invoker) SchemeBuilder

func (a *Invoker) SchemeBuilder() (*scheme.Builder, error)

func (*Invoker) TerraformResourceName

func (a *Invoker) TerraformResourceName() string

func (*Invoker) UnmarshalResourceYaml

func (a *Invoker) UnmarshalResourceYaml(b []byte) (xpresource.Managed, error)

type MergeDescription

type MergeDescription struct {
	LateInitializedSpec bool
	StatusUpdated       bool
	AnnotationsUpdated  bool
	NeedsProviderUpdate bool
	AnyFieldUpdated     bool
}

type ProviderInit

type ProviderInit struct {
	GVK           k8schema.GroupVersionKind
	SchemeBuilder *scheme.Builder
	Initializer   client.Initializer
}

type ReconcilerConfigurer

type ReconcilerConfigurer interface {
	ConfigureReconciler(ctrl.Manager, logging.Logger, *Index, *client.ProviderPool) error
}

type ResourceMerger

type ResourceMerger interface {
	MergeResources(xpresource.Managed, xpresource.Managed) MergeDescription
}

type ResourceYAMLMarshaller

type ResourceYAMLMarshaller interface {
	MarshalResourceYAML(xpresource.Managed) ([]byte, error)
}

type ResourceYAMLUnmarshaller

type ResourceYAMLUnmarshaller interface {
	UnmarshalResourceYAML([]byte) (xpresource.Managed, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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