discovery

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Definitions for Output Snapshots

Index

Constants

This section is empty.

Variables

View Source
var MissingRequiredLabelError = func(labelKey, resourceKind string, obj ezkube.ResourceId) error {
	return eris.Errorf("expected label %v not on labels of %v %v", labelKey, resourceKind, sets.Key(obj))
}

this error can occur if constructing a Partitioned Snapshot from a resource that is missing the partition label

Functions

func NewBuilder

func NewBuilder(ctx context.Context, name string) *builder

Types

type Builder

type Builder interface {

	// add TrafficTargets to the collected outputs
	AddTrafficTargets(trafficTargets ...*discovery_mesh_gloo_solo_io_v1alpha2.TrafficTarget)

	// get the collected TrafficTargets
	GetTrafficTargets() discovery_mesh_gloo_solo_io_v1alpha2_sets.TrafficTargetSet

	// add Workloads to the collected outputs
	AddWorkloads(workloads ...*discovery_mesh_gloo_solo_io_v1alpha2.Workload)

	// get the collected Workloads
	GetWorkloads() discovery_mesh_gloo_solo_io_v1alpha2_sets.WorkloadSet

	// add Meshes to the collected outputs
	AddMeshes(meshes ...*discovery_mesh_gloo_solo_io_v1alpha2.Mesh)

	// get the collected Meshes
	GetMeshes() discovery_mesh_gloo_solo_io_v1alpha2_sets.MeshSet

	// build the collected outputs into a label-partitioned snapshot
	BuildLabelPartitionedSnapshot(labelKey string) (Snapshot, error)

	// build the collected outputs into a snapshot with a single partition
	BuildSinglePartitionedSnapshot(snapshotLabels map[string]string) (Snapshot, error)

	// add a cluster to the collected clusters.
	// this can be used to collect clusters for use with MultiCluster snapshots.
	AddCluster(cluster string)

	// returns the set of clusters currently stored in this builder
	Clusters() []string

	// merge all the resources from another Builder into this one
	Merge(other Builder)

	// create a clone of this builder (deepcopying all resources)
	Clone() Builder
}

the output Builder uses a builder pattern to allow iteratively collecting outputs before producing a final snapshot

type LabeledMeshSet

type LabeledMeshSet interface {
	// returns the set of Labels shared by this MeshSet
	Labels() map[string]string

	// returns the set of Meshes with the given labels
	Set() discovery_mesh_gloo_solo_io_v1alpha2_sets.MeshSet

	// converts the set to a generic format which can be applied by the Snapshot.Apply functions
	Generic() output.ResourceList
}

LabeledMeshSet represents a set of meshes which share a common set of labels. These labels are used to find diffs between MeshSets.

type LabeledTrafficTargetSet

type LabeledTrafficTargetSet interface {
	// returns the set of Labels shared by this TrafficTargetSet
	Labels() map[string]string

	// returns the set of TrafficTargetes with the given labels
	Set() discovery_mesh_gloo_solo_io_v1alpha2_sets.TrafficTargetSet

	// converts the set to a generic format which can be applied by the Snapshot.Apply functions
	Generic() output.ResourceList
}

LabeledTrafficTargetSet represents a set of trafficTargets which share a common set of labels. These labels are used to find diffs between TrafficTargetSets.

type LabeledWorkloadSet

type LabeledWorkloadSet interface {
	// returns the set of Labels shared by this WorkloadSet
	Labels() map[string]string

	// returns the set of Workloades with the given labels
	Set() discovery_mesh_gloo_solo_io_v1alpha2_sets.WorkloadSet

	// converts the set to a generic format which can be applied by the Snapshot.Apply functions
	Generic() output.ResourceList
}

LabeledWorkloadSet represents a set of workloads which share a common set of labels. These labels are used to find diffs between WorkloadSets.

type Snapshot

type Snapshot interface {

	// return the set of TrafficTargets with a given set of labels
	TrafficTargets() []LabeledTrafficTargetSet
	// return the set of Workloads with a given set of labels
	Workloads() []LabeledWorkloadSet
	// return the set of Meshes with a given set of labels
	Meshes() []LabeledMeshSet

	// apply the snapshot to the local cluster, garbage collecting stale resources
	ApplyLocalCluster(ctx context.Context, clusterClient client.Client, errHandler output.ErrorHandler)

	// apply resources from the snapshot across multiple clusters, garbage collecting stale resources
	ApplyMultiCluster(ctx context.Context, multiClusterClient multicluster.Client, errHandler output.ErrorHandler)

	// serialize the entire snapshot as JSON
	MarshalJSON() ([]byte, error)
}

the snapshot of output resources produced by a translation

func NewLabelPartitionedSnapshot

automatically partitions the input resources by the presence of the provided label.

func NewSinglePartitionedSnapshot

simplified constructor for a snapshot with a single label partition (i.e. all resources share a single set of labels).

func NewSnapshot

func NewSnapshot(
	name string,

	trafficTargets []LabeledTrafficTargetSet,
	workloads []LabeledWorkloadSet,
	meshes []LabeledMeshSet,
	clusters ...string,
) Snapshot

Directories

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

Jump to

Keyboard shortcuts

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