certagent

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

Documentation

Overview

Definitions for Output Snapshots

Index

Constants

This section is empty.

Variables

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

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

View Source
var SnapshotGVKs = []schema.GroupVersionKind{

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

	schema.GroupVersionKind{
		Group:   "",
		Version: "v1",
		Kind:    "Secret",
	},
}

SnapshotGVKs is a list of the GVKs included in this snapshot

Functions

func NewBuilder

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

Types

type Builder

type Builder interface {

	// add CertificateRequests to the collected outputs
	AddCertificateRequests(certificateRequests ...*certificates_mesh_gloo_solo_io_v1.CertificateRequest)

	// get the collected CertificateRequests
	GetCertificateRequests() certificates_mesh_gloo_solo_io_v1_sets.CertificateRequestSet

	// add Secrets to the collected outputs
	AddSecrets(secrets ...*v1.Secret)

	// get the collected Secrets
	GetSecrets() v1_sets.SecretSet

	// build the collected outputs into a label-partitioned snapshot
	BuildLabelPartitionedSnapshot(labelKey string, gvk schema.GroupVersionKind) (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

	// 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 output Builder uses a builder pattern to allow iteratively collecting outputs before producing a final snapshot

type LabeledCertificateRequestSet

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

	// returns the set of CertificateRequestes with the given labels
	Set() certificates_mesh_gloo_solo_io_v1_sets.CertificateRequestSet

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

LabeledCertificateRequestSet represents a set of certificateRequests which share a common set of labels. These labels are used to find diffs between CertificateRequestSets.

type LabeledSecretSet

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

	// returns the set of Secretes with the given labels
	Set() v1_sets.SecretSet

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

LabeledSecretSet represents a set of secrets which share a common set of labels. These labels are used to find diffs between SecretSets.

func NewLabeledSecretSet

func NewLabeledSecretSet(set v1_sets.SecretSet, labels map[string]string) (LabeledSecretSet, error)

type Snapshot

type Snapshot interface {

	// return the set of CertificateRequests with a given set of labels
	CertificateRequests() []LabeledCertificateRequestSet
	// return the set of Secrets with a given set of labels
	Secrets() []LabeledSecretSet

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

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

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

	// 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 output resources produced by a translation

func NewLabelPartitionedSnapshot

func NewLabelPartitionedSnapshot(
	name,
	labelKey string,
	gvk schema.GroupVersionKind,

	certificateRequests certificates_mesh_gloo_solo_io_v1_sets.CertificateRequestSet,

	secrets v1_sets.SecretSet,
	clusters ...string,
) (Snapshot, error)

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

func NewSinglePartitionedSnapshot

func NewSinglePartitionedSnapshot(
	name string,
	snapshotLabels map[string]string,

	certificateRequests certificates_mesh_gloo_solo_io_v1_sets.CertificateRequestSet,

	secrets v1_sets.SecretSet,
	clusters ...string,
) (Snapshot, error)

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,

	certificateRequests []LabeledCertificateRequestSet,
	secrets []LabeledSecretSet,
	clusters ...string,
) Snapshot

Directories

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

Jump to

Keyboard shortcuts

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