Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultGVRs = []schema.GroupVersionResource{
{Group: "", Version: "v1", Resource: "namespaces"},
{Group: "scheduling.k8s.io", Version: "v1", Resource: "priorityclasses"},
{Group: "storage.k8s.io", Version: "v1", Resource: "storageclasses"},
{Group: "", Version: "v1", Resource: "persistentvolumeclaims"},
{Group: "", Version: "v1", Resource: "nodes"},
{Group: "", Version: "v1", Resource: "persistentvolumes"},
{Group: "", Version: "v1", Resource: "pods"},
}
DefaultGVRs is a list of GroupVersionResource that we sync by default (configurable with Options), which is a suitable resource set for the vanilla scheduler.
Note that this order matters - When first importing resources, we want to sync namespaces first, then priorityclasses, storageclasses...
Functions ¶
This section is empty.
Types ¶
type Clients ¶
type Clients struct { // SrcDynamicClient is the dynamic client for the source cluster, which the resource is supposed to be copied from. SrcDynamicClient dynamic.Interface // DestDynamicClient is the dynamic client for the destination cluster, which the resource is supposed to be copied to. DestDynamicClient dynamic.Interface RestMapper meta.RESTMapper }
Note: Clients and its fields are exposed intentionally so that users can use it in MutatingFunction and FilteringFunction.
type FilteringFunction ¶
type FilteringFunction func(ctx context.Context, resource *unstructured.Unstructured, clients *Clients, event Event) (bool, error)
FilteringFunction is a function that filters a resource. If it returns false, the resource will not be imported.
type MutatingFunction ¶
type MutatingFunction func(ctx context.Context, resource *unstructured.Unstructured, clients *Clients, event Event) (*unstructured.Unstructured, error)
MutatingFunction is a function that mutates a resource before importing it.
type Options ¶
type Options struct { // GVRsToSync is a list of GroupVersionResource that will be synced. // If GVRsToSync is nil, defaultGVRs are used. GVRsToSync []schema.GroupVersionResource // AdditionalMutatingFunctions is a list of mutating functions that users add. AdditionalMutatingFunctions map[schema.GroupVersionResource]MutatingFunction // AdditionalFilteringFunctions is a list of filtering functions that users add. AdditionalFilteringFunctions map[schema.GroupVersionResource]FilteringFunction }
Click to show internal directories.
Click to hide internal directories.