input

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

The Input Reconciler calls a simple func() error whenever a storage event is received for any of: * IssuedCertificates * CertificateRequests for a given cluster or set of clusters.

Input Reconcilers can be be constructed from either a single Manager (watch events in a single cluster) or a ClusterWatcher (watch events in multiple clusters).

Utility for manually building input snapshots. Used primarily in tests.

Index

Constants

This section is empty.

Variables

View Source
var SnapshotGVKs = []schema.GroupVersionKind{

	schema.GroupVersionKind{
		Group:   "certificates.mesh.gloo.solo.io",
		Version: "v1",
		Kind:    "IssuedCertificate",
	},
	schema.GroupVersionKind{
		Group:   "certificates.mesh.gloo.solo.io",
		Version: "v1",
		Kind:    "CertificateRequest",
	},
}

SnapshotGVKs is a list of the GVKs included in this snapshot

Functions

func RegisterMultiClusterReconciler

func RegisterMultiClusterReconciler(
	ctx context.Context,
	clusters multicluster.ClusterWatcher,
	reconcileFunc input.MultiClusterReconcileFunc,
	reconcileInterval time.Duration,
	options ReconcileOptions,
	predicates ...predicate.Predicate,
) input.InputReconciler

register the reconcile func with the cluster watcher the reconcileInterval, if greater than 0, will limit the number of reconciles to one per interval.

func RegisterSingleClusterReconciler

func RegisterSingleClusterReconciler(
	ctx context.Context,
	mgr manager.Manager,
	reconcileFunc input.SingleClusterReconcileFunc,
	reconcileInterval time.Duration,
	options reconcile.Options,
	predicates ...predicate.Predicate,
) (input.InputReconciler, error)

register the reconcile func with the manager the reconcileInterval, if greater than 0, will limit the number of reconciles to one per interval.

Types

type BuildOptions

type BuildOptions struct {

	// List options for composing a snapshot from IssuedCertificates
	IssuedCertificates ResourceBuildOptions
	// List options for composing a snapshot from CertificateRequests
	CertificateRequests ResourceBuildOptions
}

Options for building a snapshot

type Builder

type Builder interface {
	BuildSnapshot(ctx context.Context, name string, opts BuildOptions) (Snapshot, error)
}

builds the input snapshot from API Clients.

func NewInMemoryBuilder added in v0.12.7

func NewInMemoryBuilder(
	getSnapshot func() (resource.ClusterSnapshot, error),
) Builder

Produces snapshots of resources read from the manager for the given cluster

func NewMultiClusterBuilder

func NewMultiClusterBuilder(
	clusters multicluster.Interface,
	client multicluster.Client,
) Builder

Produces snapshots of resources across all clusters defined in the ClusterSet

func NewSingleClusterBuilder

func NewSingleClusterBuilder(
	mgr manager.Manager,
) Builder

Produces snapshots of resources read from the manager for the given cluster

func NewSingleClusterBuilderWithClusterName added in v0.12.0

func NewSingleClusterBuilderWithClusterName(
	mgr manager.Manager,
	clusterName string,
) Builder

Produces snapshots of resources read from the manager for the given cluster. Snapshot resources will be marked with the given ClusterName.

type InputSnapshotManualBuilder

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

func NewInputSnapshotManualBuilder

func NewInputSnapshotManualBuilder(name string) *InputSnapshotManualBuilder

func (*InputSnapshotManualBuilder) AddCertificateRequests

func (*InputSnapshotManualBuilder) AddIssuedCertificates

func (*InputSnapshotManualBuilder) Build

type ReconcileOptions

type ReconcileOptions struct {

	// Options for reconciling IssuedCertificates
	IssuedCertificates reconcile.Options
	// Options for reconciling CertificateRequests
	CertificateRequests reconcile.Options
}

Options for reconciling a snapshot

type ResourceBuildOptions

type ResourceBuildOptions struct {

	// List options for composing a snapshot from a resource type
	ListOptions []client.ListOption

	// If provided, ensure the resource has been verified before adding it to snapshots
	Verifier verifier.ServerResourceVerifier
}

Options for reading resources of a given type

type Snapshot

type Snapshot interface {

	// return the set of input IssuedCertificates
	IssuedCertificates() certificates_mesh_gloo_solo_io_v1_sets.IssuedCertificateSet
	// return the set of input CertificateRequests
	CertificateRequests() certificates_mesh_gloo_solo_io_v1_sets.CertificateRequestSet
	// update the status of all input objects which support
	// the Status subresource (across multiple clusters)
	SyncStatusesMultiCluster(ctx context.Context, mcClient multicluster.Client, opts SyncStatusOptions) error
	// update the status of all input objects which support
	// the Status subresource (in the local cluster)
	SyncStatuses(ctx context.Context, c client.Client, opts SyncStatusOptions) error
	// serialize the entire snapshot as JSON
	MarshalJSON() ([]byte, error)

	// Clone the snapshot
	Clone() Snapshot

	// convert this snapshot to its generic form.
	Generic() resource.ClusterSnapshot

	// iterate over the objects contained in the snapshot
	ForEachObject(handleObject func(cluster string, gvk schema.GroupVersionKind, obj resource.TypedObject))
}

the snapshot of input resources consumed by translation

func NewSnapshotFromGeneric added in v0.12.7

func NewSnapshotFromGeneric(
	name string,
	genericSnapshot resource.ClusterSnapshot,
) Snapshot

type SyncStatusOptions added in v0.10.8

type SyncStatusOptions struct {

	// sync status of IssuedCertificate objects
	IssuedCertificate bool
	// sync status of CertificateRequest objects
	CertificateRequest bool
}

options for syncing input object statuses

Directories

Path Synopsis
Package mock_input is a generated GoMock package.
Package mock_input is a generated GoMock package.

Jump to

Keyboard shortcuts

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