Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ClusterLabelKey = fmt.Sprintf("cluster.%s", v1alpha1.SchemeGroupVersion.Group)
the key used to differentiate discovery resources by the cluster in which they were discovered
Functions ¶
func AddClusterLabels ¶ added in v0.7.17
adds cluster labels to the given set of labels and returns them
func ClusterLabel ¶ added in v0.7.17
func ClusterLabels ¶ added in v0.7.17
Create a label that identifies the cluster used to discover a resource.
Types ¶
type ErrorHandler ¶ added in v0.7.17
type ErrorHandler interface { // handle an error that happens when we try to write a resource HandleWriteError(resource ezkube.Object, err error) // handle an error that happens when we try to delete a resource HandleDeleteError(resource ezkube.Object, err error) // handle an error that happens when we try list resources in a cluster HandleListError(err error) }
User-defined error-handling functions. Used to invoke custom error-handling code when a resource write fails.
type ErrorHandlerFuncs ¶ added in v0.7.17
type ErrorHandlerFuncs struct { // handle an error that happens when we try to write a resource HandleWriteErrorFunc func(resource ezkube.Object, err error) // handle an error that happens when we try to delete a resource HandleDeleteErrorFunc func(resource ezkube.Object, err error) // handle an error that happens when we try list resources in a cluster HandleListErrorFunc func(err error) }
straightforward implementation of an Error Handler
func (ErrorHandlerFuncs) HandleDeleteError ¶ added in v0.7.17
func (e ErrorHandlerFuncs) HandleDeleteError(resource ezkube.Object, err error)
func (ErrorHandlerFuncs) HandleListError ¶ added in v0.7.17
func (e ErrorHandlerFuncs) HandleListError(err error)
func (ErrorHandlerFuncs) HandleWriteError ¶ added in v0.7.17
func (e ErrorHandlerFuncs) HandleWriteError(resource ezkube.Object, err error)
type ResourceList ¶
type ResourceList struct { // the desired resources should share the given labels Resources []ezkube.Object // list function that will be used to compare the given resources to the currently existing state. // if the resources in the list do not match those returned by the list func, // the differences will be reconciled by applying the snapshot. // if this function is nil, no garbage collection will be done. ListFunc func(ctx context.Context, cli client.Client) ([]ezkube.Object, error) // indicates whether the resources in the list should have their status updated to the cluster. // if true, resources will not be upserted or garbage collected. StatusUpdate bool // name of resource Kind, used for debugging only ResourceKind string }
a ResourceList define a list of resources we wish to write to kubernetes. A ListFunc can be provided to compare the resources with what is currently written to storage and trim stale resources. A transition function can also be provided for updating existing resources.
func (ResourceList) SplitByClusterName ¶
func (l ResourceList) SplitByClusterName() map[string][]ezkube.Object
partition the resource list by the ClusterName of each object.
type Snapshot ¶
type Snapshot struct { // name of the snapshot, used for metrics Name string // the clusters across which the snapshot should be synced. // only relevant for multicluster syncing. Clusters []string // the lists of resources to sync, partitioned by resource type // and ListFunc (typically a set of labels) ListsToSync []ResourceList }
an Output Snapshot defines a list of desired resources to apply to Kubernetes. Stale resources (resources with no parents) will be garbage collected.
A resources is determined to be stale when it currently exists in the cluster, but does not exist in the snapshot.
func (Snapshot) SyncLocalCluster ¶ added in v0.7.17
sync the output snapshot to local cluster storage. only writes resources intended for the local cluster (with ClusterName == "") Note that Syncing snapshots in this way adds the label
func (Snapshot) SyncMultiCluster ¶
func (s Snapshot) SyncMultiCluster(ctx context.Context, mcClient multicluster.Client, errHandler ErrorHandler)
sync the output snapshot to storage across multiple clusters. uses the object's ClusterName to determine the correct destination cluster.