watch

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

// // Create a remote (cluster).

remote := &watch.Remote{
    RestCfg: restCfg,
}

// // Create a remote (cluster) with relay to a controller.

remote := &watch.Remote{
    RestCfg: restCfg,
    Relay: watch.Relay{
        Controller: controller,
        Object: object,
    }
}

// // Add watch(s) and start the remote. remote.Start(

watch.Watch{
    Object: &v1.Pod{},
    Predicates: []predicate{
        &predicate{},
    },
    Object: &v1.Secret{},
    Predicates: []predicate{
        &predicate{},
    },
})

// // Shutdown the remote. remote.Shutdown()

// // Add individual watch. remote.Watch(

&source.Kind{
    Type: &v1.Secret{},
},
&MyPredicate{})

// // Register your remote. watch.Map.Add(myObject, remote)

// // Find a registered remote. remote, found := watch.Map.Find(myObject)

// // Unregister a registered remote. remote, found := watch.Map.Delete(myObject)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forward

type Forward struct {
	// An event channel.
	Channel chan event.GenericEvent
	// An event to be forwarded.
	Event event.GenericEvent
}

Predicate used to forward events. This MUST be the last predicated listed on a watch.

func (*Forward) Create

func (p *Forward) Create(e event.CreateEvent) bool

func (*Forward) Delete

func (p *Forward) Delete(e event.DeleteEvent) bool

func (*Forward) Generic

func (p *Forward) Generic(e event.GenericEvent) bool

func (*Forward) Update

func (p *Forward) Update(e event.UpdateEvent) bool

type Key

type Key = core.ObjectReference

Map key.

type Relay

type Relay struct {
	// Target controller.
	Controller controller.Controller
	// Object (resource) reconciled by the controller.
	Object Resource
	// contains filtered or unexported fields
}

Controller relay.

type Remote

type Remote struct {
	// A name.
	Name string
	// REST configuration
	RestCfg *rest.Config
	// Relay (forward) watch events.
	Relay *Relay
	// contains filtered or unexported fields
}

Represents a remote cluster.

func (*Remote) Shutdown

func (r *Remote) Shutdown()

Shutdown the remote.

func (*Remote) Start

func (r *Remote) Start(watch ...Watch) error

Start the remote.

func (*Remote) Watch

func (r *Remote) Watch(object runtime.Object, prds ...predicate.Predicate) error

Add a watch.

type Resource

type Resource interface {
	meta.Object
	runtime.Object
}

k8s Resource.

type RmtMap

type RmtMap struct {
	// contains filtered or unexported fields
}

Map a remote to CR.

var Map *RmtMap

Global remote map.

func (*RmtMap) Add

func (m *RmtMap) Add(object meta.Object, remote *Remote)

Add a remote.

func (*RmtMap) Delete

func (m *RmtMap) Delete(object meta.Object)

Delete a remote.

func (*RmtMap) Find

func (m *RmtMap) Find(object meta.Object) (*Remote, bool)

Find a remote.

type Watch

type Watch struct {
	// An object (kind) watched.
	Object runtime.Object
	// Optional list of predicates.
	Predicates []predicate.Predicate
}

Watch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL