sync

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RancherCredentialsNamespace is the default namespace for
	// cloud provider credentials.
	RancherCredentialsNamespace = "cattle-global-data"

	// NameAnnotation is the annotation key for the cloud credential secret name.
	NameAnnotation = "field.cattle.io/name"

	// DriverNameAnnotation is the annotation key for the cloud provider driver name.
	DriverNameAnnotation = "provisioning.cattle.io/driver"
)
View Source
const AppliedSpecHashAnnotation = "operator.cluster.x-k8s.io/applied-spec-hash"

AppliedSpecHashAnnotation is a spec hash annotation set by CAPI Operator, to prevent infrastructure rollout without spec changes.

Variables

This section is empty.

Functions

func Into

func Into(provider string, from map[string][]byte, to map[string]string) error

Into maps the secret keys from source secret data according to credentials map.

func Patch

func Patch(ctx context.Context, cl client.Client, obj client.Object) error

Patch will only patch mirror object in the cluster.

func PatchStatus

func PatchStatus(ctx context.Context, cl client.Client, obj client.Object) error

PatchStatus will only patch the status subresource of the provided object.

Types

type B64

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

B64 is a structure for encoding a secret key as base64.

type DefaultSynchronizer

type DefaultSynchronizer struct {
	Source      *turtlesv1.CAPIProvider
	Destination client.Object
	// contains filtered or unexported fields
}

DefaultSynchronizer is a structure mirroring state of the CAPI Operator Provider object.

func NewDefaultSynchronizer

func NewDefaultSynchronizer(cl client.Client, capiProvider *turtlesv1.CAPIProvider, destination client.Object) *DefaultSynchronizer

NewDefaultSynchronizer returns a new instance of DefaultSynchronizer.

func (*DefaultSynchronizer) Apply

func (s *DefaultSynchronizer) Apply(ctx context.Context, reterr *error)

Apply applies the destination object to the cluster.

func (*DefaultSynchronizer) Get

Get updates the destination object from the cluster.

type List

type List []Sync

List contains a list of syncers to apply the syncing logic.

func NewList

func NewList(syncHandlers ...Sync) List

NewList creates a new list of only initialized Sync handlers.

func (List) Apply

func (s List) Apply(ctx context.Context, reterr *error)

Apply updates all syncer objects in the cluster.

func (List) Sync

func (s List) Sync(ctx context.Context) error

Sync applies synchronization logic on all syncers in the list.

type Mapping

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

Mapping defines a mapping between a source and destination secret keys.

type ProviderSync

type ProviderSync struct {
	*DefaultSynchronizer
	Destination api.Provider
}

ProviderSync is a structure mirroring state of the CAPI Operator Provider object.

func (*ProviderSync) Sync

func (s *ProviderSync) Sync(_ context.Context) error

Sync updates the mirror object state from the upstream source object Direction of updates: Spec -> down up <- Status.

func (*ProviderSync) SyncObjects

func (s *ProviderSync) SyncObjects()

SyncObjects updates the Source CAPIProvider object and the destination provider object states. Direction of updates: Spec -> <Common>Provider CAPIProvider <- Status.

func (ProviderSync) Template

func (ProviderSync) Template(capiProvider *turtlesv1.CAPIProvider) client.Object

Template returning the mirrored CAPI Operator manifest template.

type Raw

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

Raw is a structure for storing a secret key without encoding.

type SecretMapperSync

type SecretMapperSync struct {
	*SecretSync
	RancherSecret *corev1.Secret
}

SecretMapperSync is a structure mirroring variable secret state of the Rancher secret data.

func (*SecretMapperSync) Get

func (s *SecretMapperSync) Get(ctx context.Context) error

Get retrieves the source Rancher secret and destenation secret.

func (SecretMapperSync) GetSecret

func (SecretMapperSync) GetSecret(capiProvider *turtlesv1.CAPIProvider) *corev1.Secret

GetSecret returning the source secret resource template.

func (*SecretMapperSync) Sync

func (s *SecretMapperSync) Sync(ctx context.Context) error

Sync updates the credentials secret with required values from rancher manager secret.

func (SecretMapperSync) Template

func (SecretMapperSync) Template(capiProvider *turtlesv1.CAPIProvider) client.Object

Template returning the mirrored secret resource template.

type SecretSync

type SecretSync struct {
	*DefaultSynchronizer

	Secret *corev1.Secret
}

SecretSync is a structure mirroring variable secret state of the CAPI Operator Provider object.

func (SecretSync) GetSecret

func (SecretSync) GetSecret(capiProvider *turtlesv1.CAPIProvider) *corev1.Secret

GetSecret returning the mirrored secret resource template.

func (*SecretSync) Sync

func (s *SecretSync) Sync(_ context.Context) error

Sync updates the mirror object state from the upstream source object Direction of updates: Spec -> down up <- Status.

func (*SecretSync) SyncObjects

func (s *SecretSync) SyncObjects()

SyncObjects updates the Source CAPIProvider object and the environment secret state. Direction of updates: Spec.Features + Spec.Variables -> Status.Variables -> Secret.

func (SecretSync) Template

func (SecretSync) Template(capiProvider *turtlesv1.CAPIProvider) client.Object

Template returning the mirrored secret resource template.

type Sync

type Sync interface {
	Template(source *turtlesv1.CAPIProvider) client.Object
	Get(ctx context.Context) error
	Sync(ctx context.Context) error
	Apply(ctx context.Context, reterr *error)
}

Sync is an inteface for mirroring state of the CAPI Operator Provider object on child objects.

func NewProviderSync

func NewProviderSync(cl client.Client, capiProvider *turtlesv1.CAPIProvider) Sync

NewProviderSync creates a new mirror object.

func NewSecretMapperSync

func NewSecretMapperSync(ctx context.Context, cl client.Client, capiProvider *turtlesv1.CAPIProvider) Sync

NewSecretMapperSync creates a new secret mapper object sync.

func NewSecretSync

func NewSecretSync(cl client.Client, capiProvider *turtlesv1.CAPIProvider) Sync

NewSecretSync creates a new secret object sync.

type Template

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

Template is a structure for rendering a template as a secret value.

Jump to

Keyboard shortcuts

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