Documentation ¶
Overview ¶
Definitions for Output Snapshots
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
var SnapshotGVKs = []schema.GroupVersionKind{ schema.GroupVersionKind{ Group: "appmesh.k8s.aws", Version: "v1beta2", Kind: "VirtualService", }, schema.GroupVersionKind{ Group: "appmesh.k8s.aws", Version: "v1beta2", Kind: "VirtualNode", }, schema.GroupVersionKind{ Group: "appmesh.k8s.aws", Version: "v1beta2", Kind: "VirtualRouter", }, }
SnapshotGVKs is a list of the GVKs included in this snapshot
Functions ¶
func NewBuilder ¶
Types ¶
type Builder ¶
type Builder interface { // add VirtualServices to the collected outputs AddVirtualServices(virtualServices ...*appmesh_k8s_aws_v1beta2.VirtualService) // get the collected VirtualServices GetVirtualServices() appmesh_k8s_aws_v1beta2_sets.VirtualServiceSet // add VirtualNodes to the collected outputs AddVirtualNodes(virtualNodes ...*appmesh_k8s_aws_v1beta2.VirtualNode) // get the collected VirtualNodes GetVirtualNodes() appmesh_k8s_aws_v1beta2_sets.VirtualNodeSet // add VirtualRouters to the collected outputs AddVirtualRouters(virtualRouters ...*appmesh_k8s_aws_v1beta2.VirtualRouter) // get the collected VirtualRouters GetVirtualRouters() appmesh_k8s_aws_v1beta2_sets.VirtualRouterSet // 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 // 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 LabeledVirtualNodeSet ¶
type LabeledVirtualNodeSet interface { // returns the set of Labels shared by this VirtualNodeSet Labels() map[string]string // returns the set of VirtualNodees with the given labels Set() appmesh_k8s_aws_v1beta2_sets.VirtualNodeSet // converts the set to a generic format which can be applied by the Snapshot.Apply functions Generic() output.ResourceList }
LabeledVirtualNodeSet represents a set of virtualNodes which share a common set of labels. These labels are used to find diffs between VirtualNodeSets.
func NewLabeledVirtualNodeSet ¶
func NewLabeledVirtualNodeSet(set appmesh_k8s_aws_v1beta2_sets.VirtualNodeSet, labels map[string]string) (LabeledVirtualNodeSet, error)
type LabeledVirtualRouterSet ¶
type LabeledVirtualRouterSet interface { // returns the set of Labels shared by this VirtualRouterSet Labels() map[string]string // returns the set of VirtualRouteres with the given labels Set() appmesh_k8s_aws_v1beta2_sets.VirtualRouterSet // converts the set to a generic format which can be applied by the Snapshot.Apply functions Generic() output.ResourceList }
LabeledVirtualRouterSet represents a set of virtualRouters which share a common set of labels. These labels are used to find diffs between VirtualRouterSets.
func NewLabeledVirtualRouterSet ¶
func NewLabeledVirtualRouterSet(set appmesh_k8s_aws_v1beta2_sets.VirtualRouterSet, labels map[string]string) (LabeledVirtualRouterSet, error)
type LabeledVirtualServiceSet ¶
type LabeledVirtualServiceSet interface { // returns the set of Labels shared by this VirtualServiceSet Labels() map[string]string // returns the set of VirtualServicees with the given labels Set() appmesh_k8s_aws_v1beta2_sets.VirtualServiceSet // converts the set to a generic format which can be applied by the Snapshot.Apply functions Generic() output.ResourceList }
LabeledVirtualServiceSet represents a set of virtualServices which share a common set of labels. These labels are used to find diffs between VirtualServiceSets.
func NewLabeledVirtualServiceSet ¶
func NewLabeledVirtualServiceSet(set appmesh_k8s_aws_v1beta2_sets.VirtualServiceSet, labels map[string]string) (LabeledVirtualServiceSet, error)
type Snapshot ¶
type Snapshot interface { // return the set of VirtualServices with a given set of labels VirtualServices() []LabeledVirtualServiceSet // return the set of VirtualNodes with a given set of labels VirtualNodes() []LabeledVirtualNodeSet // return the set of VirtualRouters with a given set of labels VirtualRouters() []LabeledVirtualRouterSet // 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) // 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, virtualServices appmesh_k8s_aws_v1beta2_sets.VirtualServiceSet, virtualNodes appmesh_k8s_aws_v1beta2_sets.VirtualNodeSet, virtualRouters appmesh_k8s_aws_v1beta2_sets.VirtualRouterSet, 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, virtualServices appmesh_k8s_aws_v1beta2_sets.VirtualServiceSet, virtualNodes appmesh_k8s_aws_v1beta2_sets.VirtualNodeSet, virtualRouters appmesh_k8s_aws_v1beta2_sets.VirtualRouterSet, 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, virtualServices []LabeledVirtualServiceSet, virtualNodes []LabeledVirtualNodeSet, virtualRouters []LabeledVirtualRouterSet, clusters ...string, ) Snapshot