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: 35 Imported by: 0

Documentation

Overview

The Input Reconciler calls a simple func() error whenever a storage event is received for any of: * Settings * IssuedCertificates * Meshes * ConfigMaps * Services * Pods * Endpoints * Namespaces * Nodes * Deployments * ReplicaSets * DaemonSets * StatefulSets 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.

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

Index

Constants

This section is empty.

Variables

View Source
var DiscoveryInputSnapshotGVKs = []schema.GroupVersionKind{

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

	schema.GroupVersionKind{
		Group:   "appmesh.k8s.aws",
		Version: "v1beta2",
		Kind:    "Mesh",
	},

	schema.GroupVersionKind{
		Group:   "",
		Version: "v1",
		Kind:    "ConfigMap",
	},
	schema.GroupVersionKind{
		Group:   "",
		Version: "v1",
		Kind:    "Service",
	},
	schema.GroupVersionKind{
		Group:   "",
		Version: "v1",
		Kind:    "Pod",
	},
	schema.GroupVersionKind{
		Group:   "",
		Version: "v1",
		Kind:    "Endpoints",
	},
	schema.GroupVersionKind{
		Group:   "",
		Version: "v1",
		Kind:    "Namespace",
	},
	schema.GroupVersionKind{
		Group:   "",
		Version: "v1",
		Kind:    "Node",
	},

	schema.GroupVersionKind{
		Group:   "apps",
		Version: "v1",
		Kind:    "Deployment",
	},
	schema.GroupVersionKind{
		Group:   "apps",
		Version: "v1",
		Kind:    "ReplicaSet",
	},
	schema.GroupVersionKind{
		Group:   "apps",
		Version: "v1",
		Kind:    "DaemonSet",
	},
	schema.GroupVersionKind{
		Group:   "apps",
		Version: "v1",
		Kind:    "StatefulSet",
	},
}

SnapshotGVKs is a list of the GVKs included in this snapshot

View Source
var SettingsSnapshotGVKs = []schema.GroupVersionKind{

	schema.GroupVersionKind{
		Group:   "settings.mesh.gloo.solo.io",
		Version: "v1",
		Kind:    "Settings",
	},
}

SnapshotGVKs is a list of the GVKs included in this snapshot

Functions

func RegisterInputReconciler added in v0.10.8

func RegisterInputReconciler(
	ctx context.Context,
	clusters multicluster.ClusterWatcher,
	multiClusterReconcileFunc input.MultiClusterReconcileFunc,
	mgr manager.Manager,
	singleClusterReconcileFunc input.SingleClusterReconcileFunc,
	options ReconcileOptions,
) (input.InputReconciler, error)

register the given multi cluster reconcile func with the cluster watcher register the given single cluster reconcile func with the local manager

func RegisterMultiClusterAgentReconciler added in v0.12.0

func RegisterMultiClusterAgentReconciler(
	ctx context.Context,
	clusters multicluster.ClusterWatcher,
	reconcileFunc input.MultiClusterReconcileFunc,
	reconcileInterval time.Duration,
	options AgentReconcileOptions,
	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 RegisterSingleClusterAgentReconciler added in v0.12.0

func RegisterSingleClusterAgentReconciler(
	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 AgentReconcileOptions added in v0.12.0

type AgentReconcileOptions struct {

	// Options for reconciling Settings
	Settings reconcile.Options

	// Options for reconciling IssuedCertificates
	IssuedCertificates reconcile.Options

	// Options for reconciling Meshes
	Meshes reconcile.Options

	// Options for reconciling ConfigMaps
	ConfigMaps reconcile.Options
	// Options for reconciling Services
	Services reconcile.Options
	// Options for reconciling Pods
	Pods reconcile.Options
	// Options for reconciling Endpoints
	Endpoints reconcile.Options
	// Options for reconciling Namespaces
	Namespaces reconcile.Options
	// Options for reconciling Nodes
	Nodes reconcile.Options

	// Options for reconciling Deployments
	Deployments reconcile.Options
	// Options for reconciling ReplicaSets
	ReplicaSets reconcile.Options
	// Options for reconciling DaemonSets
	DaemonSets reconcile.Options
	// Options for reconciling StatefulSets
	StatefulSets reconcile.Options
}

Options for reconciling a snapshot

type DiscoveryInputBuildOptions added in v0.12.0

type DiscoveryInputBuildOptions struct {

	// List options for composing a snapshot from IssuedCertificates
	IssuedCertificates ResourceDiscoveryInputBuildOptions

	// List options for composing a snapshot from Meshes
	Meshes ResourceDiscoveryInputBuildOptions

	// List options for composing a snapshot from ConfigMaps
	ConfigMaps ResourceDiscoveryInputBuildOptions
	// List options for composing a snapshot from Services
	Services ResourceDiscoveryInputBuildOptions
	// List options for composing a snapshot from Pods
	Pods ResourceDiscoveryInputBuildOptions
	// List options for composing a snapshot from Endpoints
	Endpoints ResourceDiscoveryInputBuildOptions
	// List options for composing a snapshot from Namespaces
	Namespaces ResourceDiscoveryInputBuildOptions
	// List options for composing a snapshot from Nodes
	Nodes ResourceDiscoveryInputBuildOptions

	// List options for composing a snapshot from Deployments
	Deployments ResourceDiscoveryInputBuildOptions
	// List options for composing a snapshot from ReplicaSets
	ReplicaSets ResourceDiscoveryInputBuildOptions
	// List options for composing a snapshot from DaemonSets
	DaemonSets ResourceDiscoveryInputBuildOptions
	// List options for composing a snapshot from StatefulSets
	StatefulSets ResourceDiscoveryInputBuildOptions
}

Options for building a snapshot

type DiscoveryInputBuilder added in v0.12.0

type DiscoveryInputBuilder interface {
	BuildSnapshot(ctx context.Context, name string, opts DiscoveryInputBuildOptions) (DiscoveryInputSnapshot, error)
}

builds the input snapshot from API Clients.

func NewInMemoryDiscoveryInputBuilder added in v0.12.7

func NewInMemoryDiscoveryInputBuilder(
	getSnapshot func() (resource.ClusterSnapshot, error),
) DiscoveryInputBuilder

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

func NewMultiClusterDiscoveryInputBuilder added in v0.12.0

func NewMultiClusterDiscoveryInputBuilder(
	clusters multicluster.Interface,
	client multicluster.Client,
) DiscoveryInputBuilder

Produces snapshots of resources across all clusters defined in the ClusterSet

func NewSingleClusterDiscoveryInputBuilder added in v0.12.0

func NewSingleClusterDiscoveryInputBuilder(
	mgr manager.Manager,
) DiscoveryInputBuilder

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

func NewSingleClusterDiscoveryInputBuilderWithClusterName added in v0.12.0

func NewSingleClusterDiscoveryInputBuilderWithClusterName(
	mgr manager.Manager,
	clusterName string,
) DiscoveryInputBuilder

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

type DiscoveryInputSnapshot added in v0.12.0

type DiscoveryInputSnapshot interface {

	// return the set of input IssuedCertificates
	IssuedCertificates() certificates_mesh_gloo_solo_io_v1_sets.IssuedCertificateSet

	// return the set of input Meshes
	Meshes() appmesh_k8s_aws_v1beta2_sets.MeshSet

	// return the set of input ConfigMaps
	ConfigMaps() v1_sets.ConfigMapSet
	// return the set of input Services
	Services() v1_sets.ServiceSet
	// return the set of input Pods
	Pods() v1_sets.PodSet
	// return the set of input Endpoints
	Endpoints() v1_sets.EndpointsSet
	// return the set of input Namespaces
	Namespaces() v1_sets.NamespaceSet
	// return the set of input Nodes
	Nodes() v1_sets.NodeSet

	// return the set of input Deployments
	Deployments() apps_v1_sets.DeploymentSet
	// return the set of input ReplicaSets
	ReplicaSets() apps_v1_sets.ReplicaSetSet
	// return the set of input DaemonSets
	DaemonSets() apps_v1_sets.DaemonSetSet
	// return the set of input StatefulSets
	StatefulSets() apps_v1_sets.StatefulSetSet
	// update the status of all input objects which support
	// the Status subresource (across multiple clusters)
	SyncStatusesMultiCluster(ctx context.Context, mcClient multicluster.Client, opts DiscoveryInputSyncStatusOptions) 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 DiscoveryInputSyncStatusOptions) error
	// serialize the entire snapshot as JSON
	MarshalJSON() ([]byte, error)

	// Clone the snapshot
	Clone() DiscoveryInputSnapshot

	// 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 NewDiscoveryInputSnapshotFromGeneric added in v0.12.7

func NewDiscoveryInputSnapshotFromGeneric(
	name string,
	genericSnapshot resource.ClusterSnapshot,
) DiscoveryInputSnapshot

type DiscoveryInputSyncStatusOptions added in v0.12.0

type DiscoveryInputSyncStatusOptions struct {

	// sync status of IssuedCertificate objects
	IssuedCertificate bool

	// sync status of Mesh objects
	Mesh bool

	// sync status of ConfigMap objects
	ConfigMap bool
	// sync status of Service objects
	Service bool
	// sync status of Pod objects
	Pod bool
	// sync status of Endpoints objects
	Endpoints bool
	// sync status of Namespace objects
	Namespace bool
	// sync status of Node objects
	Node bool

	// sync status of Deployment objects
	Deployment bool
	// sync status of ReplicaSet objects
	ReplicaSet bool
	// sync status of DaemonSet objects
	DaemonSet bool
	// sync status of StatefulSet objects
	StatefulSet bool
}

options for syncing input object statuses

type InputDiscoveryInputSnapshotManualBuilder added in v0.12.0

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

func NewInputDiscoveryInputSnapshotManualBuilder added in v0.12.0

func NewInputDiscoveryInputSnapshotManualBuilder(name string) *InputDiscoveryInputSnapshotManualBuilder

func (*InputDiscoveryInputSnapshotManualBuilder) AddConfigMaps added in v0.12.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddDaemonSets added in v0.12.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddDeployments added in v0.12.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddEndpoints added in v0.12.3

func (*InputDiscoveryInputSnapshotManualBuilder) AddIssuedCertificates added in v1.1.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddMeshes added in v0.12.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddNamespaces added in v1.1.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddNodes added in v0.12.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddPods added in v0.12.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddReplicaSets added in v0.12.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddServices added in v0.12.0

func (*InputDiscoveryInputSnapshotManualBuilder) AddStatefulSets added in v0.12.0

func (*InputDiscoveryInputSnapshotManualBuilder) Build added in v0.12.0

type InputSettingsSnapshotManualBuilder added in v0.12.0

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

func NewInputSettingsSnapshotManualBuilder added in v0.12.0

func NewInputSettingsSnapshotManualBuilder(name string) *InputSettingsSnapshotManualBuilder

func (*InputSettingsSnapshotManualBuilder) AddSettings added in v0.12.0

func (*InputSettingsSnapshotManualBuilder) Build added in v0.12.0

type LocalReconcileOptions added in v0.10.8

type LocalReconcileOptions struct {

	// Options for reconciling Settings
	Settings reconcile.Options

	// optional predicates for filtering local events
	Predicates []predicate.Predicate
}

Options for reconciling a snapshot in remote clusters

type ReconcileOptions

type ReconcileOptions struct {
	Remote RemoteReconcileOptions
	Local  LocalReconcileOptions

	// the ReconcileInterval, if greater than 0, will limit the number of reconciles
	// to one per interval.
	ReconcileInterval time.Duration
}

type RemoteReconcileOptions added in v0.10.8

type RemoteReconcileOptions struct {

	// Options for reconciling IssuedCertificates
	IssuedCertificates reconcile.Options

	// Options for reconciling Meshes
	Meshes reconcile.Options

	// Options for reconciling ConfigMaps
	ConfigMaps reconcile.Options
	// Options for reconciling Services
	Services reconcile.Options
	// Options for reconciling Pods
	Pods reconcile.Options
	// Options for reconciling Endpoints
	Endpoints reconcile.Options
	// Options for reconciling Namespaces
	Namespaces reconcile.Options
	// Options for reconciling Nodes
	Nodes reconcile.Options

	// Options for reconciling Deployments
	Deployments reconcile.Options
	// Options for reconciling ReplicaSets
	ReplicaSets reconcile.Options
	// Options for reconciling DaemonSets
	DaemonSets reconcile.Options
	// Options for reconciling StatefulSets
	StatefulSets reconcile.Options

	// optional predicates for filtering remote events
	Predicates []predicate.Predicate
}

Options for reconciling a snapshot in remote clusters

type ResourceDiscoveryInputBuildOptions added in v0.12.0

type ResourceDiscoveryInputBuildOptions 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 ResourceSettingsBuildOptions added in v0.12.0

type ResourceSettingsBuildOptions 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 SettingsBuildOptions added in v0.12.0

type SettingsBuildOptions struct {

	// List options for composing a snapshot from Settings
	Settings ResourceSettingsBuildOptions
}

Options for building a snapshot

type SettingsBuilder added in v0.12.0

type SettingsBuilder interface {
	BuildSnapshot(ctx context.Context, name string, opts SettingsBuildOptions) (SettingsSnapshot, error)
}

builds the input snapshot from API Clients.

func NewInMemorySettingsBuilder added in v0.12.7

func NewInMemorySettingsBuilder(
	getSnapshot func() (resource.ClusterSnapshot, error),
) SettingsBuilder

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

func NewMultiClusterSettingsBuilder added in v0.12.0

func NewMultiClusterSettingsBuilder(
	clusters multicluster.Interface,
	client multicluster.Client,
) SettingsBuilder

Produces snapshots of resources across all clusters defined in the ClusterSet

func NewSingleClusterSettingsBuilder added in v0.12.0

func NewSingleClusterSettingsBuilder(
	mgr manager.Manager,
) SettingsBuilder

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

func NewSingleClusterSettingsBuilderWithClusterName added in v0.12.0

func NewSingleClusterSettingsBuilderWithClusterName(
	mgr manager.Manager,
	clusterName string,
) SettingsBuilder

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

type SettingsSnapshot added in v0.12.0

type SettingsSnapshot interface {

	// return the set of input Settings
	Settings() settings_mesh_gloo_solo_io_v1_sets.SettingsSet
	// update the status of all input objects which support
	// the Status subresource (across multiple clusters)
	SyncStatusesMultiCluster(ctx context.Context, mcClient multicluster.Client, opts SettingsSyncStatusOptions) 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 SettingsSyncStatusOptions) error
	// serialize the entire snapshot as JSON
	MarshalJSON() ([]byte, error)

	// Clone the snapshot
	Clone() SettingsSnapshot

	// 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 NewSettingsSnapshot added in v0.12.0

func NewSettingsSnapshot(
	name string,

	settings settings_mesh_gloo_solo_io_v1_sets.SettingsSet,

) SettingsSnapshot

func NewSettingsSnapshotFromGeneric added in v0.12.7

func NewSettingsSnapshotFromGeneric(
	name string,
	genericSnapshot resource.ClusterSnapshot,
) SettingsSnapshot

type SettingsSyncStatusOptions added in v0.12.0

type SettingsSyncStatusOptions struct {

	// sync status of Settings objects
	Settings 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