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: "split.smi-spec.io", Version: "v1alpha2", Kind: "TrafficSplit", }, schema.GroupVersionKind{ Group: "access.smi-spec.io", Version: "v1alpha2", Kind: "TrafficTarget", }, schema.GroupVersionKind{ Group: "specs.smi-spec.io", Version: "v1alpha3", Kind: "HTTPRouteGroup", }, }
SnapshotGVKs is a list of the GVKs included in this snapshot
Functions ¶
func NewBuilder ¶
Types ¶
type Builder ¶
type Builder interface { // add TrafficSplits to the collected outputs AddTrafficSplits(trafficSplits ...*split_smi_spec_io_v1alpha2.TrafficSplit) // get the collected TrafficSplits GetTrafficSplits() split_smi_spec_io_v1alpha2_sets.TrafficSplitSet // add TrafficTargets to the collected outputs AddTrafficTargets(trafficTargets ...*access_smi_spec_io_v1alpha2.TrafficTarget) // get the collected TrafficTargets GetTrafficTargets() access_smi_spec_io_v1alpha2_sets.TrafficTargetSet // add HTTPRouteGroups to the collected outputs AddHTTPRouteGroups(hTTPRouteGroups ...*specs_smi_spec_io_v1alpha3.HTTPRouteGroup) // get the collected HTTPRouteGroups GetHTTPRouteGroups() specs_smi_spec_io_v1alpha3_sets.HTTPRouteGroupSet // 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 }
the output Builder uses a builder pattern to allow iteratively collecting outputs before producing a final snapshot
type LabeledHTTPRouteGroupSet ¶
type LabeledHTTPRouteGroupSet interface { // returns the set of Labels shared by this HTTPRouteGroupSet Labels() map[string]string // returns the set of HTTPRouteGroupes with the given labels Set() specs_smi_spec_io_v1alpha3_sets.HTTPRouteGroupSet // converts the set to a generic format which can be applied by the Snapshot.Apply functions Generic() output.ResourceList }
LabeledHTTPRouteGroupSet represents a set of hTTPRouteGroups which share a common set of labels. These labels are used to find diffs between HTTPRouteGroupSets.
func NewLabeledHTTPRouteGroupSet ¶
func NewLabeledHTTPRouteGroupSet(set specs_smi_spec_io_v1alpha3_sets.HTTPRouteGroupSet, labels map[string]string) (LabeledHTTPRouteGroupSet, error)
type LabeledTrafficSplitSet ¶
type LabeledTrafficSplitSet interface { // returns the set of Labels shared by this TrafficSplitSet Labels() map[string]string // returns the set of TrafficSplites with the given labels Set() split_smi_spec_io_v1alpha2_sets.TrafficSplitSet // converts the set to a generic format which can be applied by the Snapshot.Apply functions Generic() output.ResourceList }
LabeledTrafficSplitSet represents a set of trafficSplits which share a common set of labels. These labels are used to find diffs between TrafficSplitSets.
func NewLabeledTrafficSplitSet ¶
func NewLabeledTrafficSplitSet(set split_smi_spec_io_v1alpha2_sets.TrafficSplitSet, labels map[string]string) (LabeledTrafficSplitSet, error)
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() access_smi_spec_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.
func NewLabeledTrafficTargetSet ¶
func NewLabeledTrafficTargetSet(set access_smi_spec_io_v1alpha2_sets.TrafficTargetSet, labels map[string]string) (LabeledTrafficTargetSet, error)
type Snapshot ¶
type Snapshot interface { // return the set of TrafficSplits with a given set of labels TrafficSplits() []LabeledTrafficSplitSet // return the set of TrafficTargets with a given set of labels TrafficTargets() []LabeledTrafficTargetSet // return the set of HTTPRouteGroups with a given set of labels HTTPRouteGroups() []LabeledHTTPRouteGroupSet // 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 ¶
func NewLabelPartitionedSnapshot( name, labelKey string, trafficSplits split_smi_spec_io_v1alpha2_sets.TrafficSplitSet, trafficTargets access_smi_spec_io_v1alpha2_sets.TrafficTargetSet, hTTPRouteGroups specs_smi_spec_io_v1alpha3_sets.HTTPRouteGroupSet, 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, trafficSplits split_smi_spec_io_v1alpha2_sets.TrafficSplitSet, trafficTargets access_smi_spec_io_v1alpha2_sets.TrafficTargetSet, hTTPRouteGroups specs_smi_spec_io_v1alpha3_sets.HTTPRouteGroupSet, 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, trafficSplits []LabeledTrafficSplitSet, trafficTargets []LabeledTrafficTargetSet, hTTPRouteGroups []LabeledHTTPRouteGroupSet, clusters ...string, ) Snapshot