Documentation ¶
Overview ¶
Package generic implements the generic logic to reflect Kubernetes objects between the local and the remote cluster, for a set of resources and namespaces.
Index ¶
- func NamespacedKeyer(namespace string) func(metadata metav1.Object) types.NamespacedName
- func NewReflector(name string, factory NamespacedReflectorFactoryFunc, workers uint) manager.Reflector
- type NamespacedReflector
- func (gnr *NamespacedReflector) DeleteRemote(ctx context.Context, deleter ResourceDeleter, resource, name string, ...) error
- func (gnr *NamespacedReflector) LocalNamespace() string
- func (gnr *NamespacedReflector) LocalRef(name string) klog.ObjectRef
- func (gnr *NamespacedReflector) Ready() bool
- func (gnr *NamespacedReflector) RemoteNamespace() string
- func (gnr *NamespacedReflector) RemoteRef(name string) klog.ObjectRef
- func (gnr *NamespacedReflector) SetReady()
- type NamespacedReflectorFactoryFunc
- type ResourceDeleter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NamespacedKeyer ¶
func NamespacedKeyer(namespace string) func(metadata metav1.Object) types.NamespacedName
NamespacedKeyer returns a keyer associated with the given namespace, retrieving the object name from its metadata.
func NewReflector ¶
func NewReflector(name string, factory NamespacedReflectorFactoryFunc, workers uint) manager.Reflector
NewReflector returns a new reflector to implement the reflection towards a remote clusters.
Types ¶
type NamespacedReflector ¶
type NamespacedReflector struct {
// contains filtered or unexported fields
}
NamespacedReflector implements the logic common to all namespaced reflectors.
func NewNamespacedReflector ¶
func NewNamespacedReflector(opts *options.ReflectorOpts) NamespacedReflector
NewNamespacedReflector returns a new NamespacedReflector for the given namespaces.
func (*NamespacedReflector) DeleteRemote ¶
func (gnr *NamespacedReflector) DeleteRemote(ctx context.Context, deleter ResourceDeleter, resource, name string, uid types.UID) error
DeleteRemote deletes the given remote resource from the cluster.
func (*NamespacedReflector) LocalNamespace ¶
func (gnr *NamespacedReflector) LocalNamespace() string
LocalNamespace returns the local namespace associated with the reflector.
func (*NamespacedReflector) LocalRef ¶
func (gnr *NamespacedReflector) LocalRef(name string) klog.ObjectRef
LocalRef returns the ObjectRef associated with the local namespace.
func (*NamespacedReflector) Ready ¶
func (gnr *NamespacedReflector) Ready() bool
Ready returns whether the NamespacedReflector is completely initialized.
func (*NamespacedReflector) RemoteNamespace ¶
func (gnr *NamespacedReflector) RemoteNamespace() string
RemoteNamespace returns the remote namespace associated with the reflector.
func (*NamespacedReflector) RemoteRef ¶
func (gnr *NamespacedReflector) RemoteRef(name string) klog.ObjectRef
RemoteRef returns the ObjectRef associated with the remote namespace.
func (*NamespacedReflector) SetReady ¶
func (gnr *NamespacedReflector) SetReady()
SetReady marks the NamespacedReflector as completely initialized.
type NamespacedReflectorFactoryFunc ¶
type NamespacedReflectorFactoryFunc func(*options.ReflectorOpts) manager.NamespacedReflector
NamespacedReflectorFactoryFunc represents the function type to create a new NamespacedReflector.
type ResourceDeleter ¶
type ResourceDeleter interface {
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
}
ResourceDeleter know how to delete a Kubernetes object with the given name.