Documentation ¶
Index ¶
- Variables
- func PrefixAnnotations(prefix string)
- func UnknownAnnotations(annotations map[string]string) []string
- type ObjectReplicator
- func (r *ObjectReplicator) InitStores(lw cache.ListerWatcher, objType runtime.Object, resyncPeriod time.Duration)
- func (r *ObjectReplicator) NamespaceAdded(object interface{})
- func (r *ObjectReplicator) ObjectAdded(object interface{})
- func (r *ObjectReplicator) ObjectDeleted(object interface{})
- func (r *ObjectReplicator) Start()
- func (r *ObjectReplicator) Synced() bool
- type Replicator
- type ReplicatorActions
- type ReplicatorOptions
- type ReplicatorProps
Constants ¶
This section is empty.
Variables ¶
var ( // ReplicateFromAnnotation tells to replicate from a source object to this object ReplicateFromAnnotation = "replicate-from" // ReplicateToAnnotation tells to replicate this object to a target object(s) ReplicateToAnnotation = "replicate-to" // ReplicateToNsAnnotation tells to replicate this object to a target namespace(s) ReplicateToNsAnnotation = "replicate-to-namespaces" // ReplicateOnceAnnotation tells to replicate only once ReplicateOnceAnnotation = "replicate-once" // ReplicateOnceVersionAnnotation tells to replicate once again when the annotation's value changes ReplicateOnceVersionAnnotation = "replicate-once-version" // ReplicatedAtAnnotation stores when this object was replicated ReplicatedAtAnnotation = "replicated-at" // ReplicatedByAnnotation stores which object created this replication ReplicatedByAnnotation = "replicated-by" // ReplicatedFromVersionAnnotation stores the resource version of the source when replicated to this object ReplicatedFromVersionAnnotation = "replicated-from-version" // ReplicatedFromOriginAnnotation stores the object from which the data originates ReplicatedFromOriginAnnotation = "replicated-from-origin" // ReplicationAllowedAnnotation explicitely allows replication ReplicationAllowedAnnotation = "replication-allowed" // ReplicationAllowedNsAnnotation explicitely allows replication to the specified namespace(s) ReplicationAllowedNsAnnotation = "replication-allowed-namespaces" // ReplicatedFromAllowedAnnotation stores the replication permissions of the source ReplicatedFromAllowedAnnotation = "replicated-from-allowed" )
Annotations that are used to specify this controller's behaviour
Functions ¶
func PrefixAnnotations ¶
func PrefixAnnotations(prefix string)
PrefixAnnotations sets the prefix of all the annotations
func UnknownAnnotations ¶
UnknownAnnotations returns the list of the unknown annotations with the same prefix
Types ¶
type ObjectReplicator ¶
type ObjectReplicator struct { ReplicatorProps ReplicatorActions }
ObjectReplicator is the structure for any replicator
func (*ObjectReplicator) InitStores ¶
func (r *ObjectReplicator) InitStores(lw cache.ListerWatcher, objType runtime.Object, resyncPeriod time.Duration)
InitStores inits namespace store and object store
func (*ObjectReplicator) NamespaceAdded ¶
func (r *ObjectReplicator) NamespaceAdded(object interface{})
NamespaceAdded is called when a namespace is seen in kubernetes Creates the resouces that should be replicated in that namespace
func (*ObjectReplicator) ObjectAdded ¶
func (r *ObjectReplicator) ObjectAdded(object interface{})
ObjectAdded is called when a new resource is seen in kubernetes Checks its replication status and does the necessaey updates
func (*ObjectReplicator) ObjectDeleted ¶
func (r *ObjectReplicator) ObjectDeleted(object interface{})
ObjectDeleted is called when a resource is updated Checks if a target should be cleared / deleted, or if it should be replaced by a replication
func (*ObjectReplicator) Synced ¶
func (r *ObjectReplicator) Synced() bool
Synced returns if synched with kubernetes
type Replicator ¶
type Replicator interface { Start() Synced() bool }
Replicator describes the common interface for all replicators
func NewConfigMapReplicator ¶
func NewConfigMapReplicator(client kubernetes.Interface, options ReplicatorOptions, resyncPeriod time.Duration) Replicator
NewConfigMapReplicator creates a new config map replicator
func NewSecretReplicator ¶
func NewSecretReplicator(client kubernetes.Interface, options ReplicatorOptions, resyncPeriod time.Duration) Replicator
NewSecretReplicator creates a new secret replicator
type ReplicatorActions ¶
type ReplicatorActions interface { // Returns the meta of a resource // Probably nothing more than `&object.(*ResourceType).ObjectMeta` GetMeta(object interface{}) *metav1.ObjectMeta // Updates a resource with the data from the source, and the given annotations Update(client kubernetes.Interface, object interface{}, sourceObject interface{}, annotations map[string]string) (interface{}, error) // Clears a resource from any data, and set the given annotations Clear(client kubernetes.Interface, object interface{}, annotations map[string]string) (interface{}, error) // Creates or updates the given resource with info from the source, data from the data object, and the given meta // create if `object.ResourceVersion == ""`, update else Install(client kubernetes.Interface, meta *metav1.ObjectMeta, sourceObject interface{}, dataObject interface{}) (interface{}, error) // Deletes the given resource Delete(client kubernetes.Interface, meta interface{}) error }
ReplicatorActions is the interface to implement for each resource type
type ReplicatorOptions ¶
type ReplicatorOptions struct { // when true, "allowed" annotations are ignored AllowAll bool // when false, any unknown annotation will make the replicator fail IgnoreUnknown bool // the labels to add to created resources Labels map[string]string }
ReplicatorOptions is the public options to configure a replicator
type ReplicatorProps ¶
type ReplicatorProps struct { // displayed name for the resources Name string // various options ReplicatorOptions // contains filtered or unexported fields }
ReplicatorProps is all the common properties for a repicator
func NewReplicatorProps ¶
func NewReplicatorProps(client kubernetes.Interface, name string, options ReplicatorOptions) ReplicatorProps
NewReplicatorProps inits and returns the common replicator properties for a repicator