k8

package
v0.0.0-...-b779308 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestTypeAdd RequestType = iota
	RequestTypeUpdate
	RequestTypeDelete

	CrossClusterServiceLabelKey         = "fair.com/cross-cluster"
	CrossClusterServiceLocalLabelValue  = "follower"
	CrossClusterServiceRemoteLabelValue = "true"
)
View Source
const (
	K8Endpoints = "endpoints"
	K8Services  = "services"
)

Variables

View Source
var (
	CrossClusterLocalLabel  = fmt.Sprintf("%s=%s", CrossClusterServiceLabelKey, CrossClusterServiceLocalLabelValue)
	CrossClusterRemoteLabel = fmt.Sprintf("%s=%s", CrossClusterServiceLabelKey, CrossClusterServiceRemoteLabelValue)
	// Ideally the local filter and the remote filter will be in a consistent format, but the watcher for the remote filter
	// requires an options func
	LocalFilter = metav1.ListOptions{
		LabelSelector: CrossClusterLocalLabel,
	}
	RemoteFilter = func(options *metav1.ListOptions) {
		options.LabelSelector = CrossClusterRemoteLabel
	}
	RequestTypeMap = map[RequestType]string{
		RequestTypeAdd:    "add",
		RequestTypeUpdate: "update",
		RequestTypeDelete: "delete",
	}
)

Functions

func PermanentError

func PermanentError(err error) bool

func ResourceNotExist

func ResourceNotExist(err error) bool

func WatchEndpoints

func WatchEndpoints(clientset kubernetes.Interface, w Watcher, stopChan <-chan struct{})

WatchEndpoints watches for endpoint update and delete events

func WatchServices

func WatchServices(clientset kubernetes.Interface, w Watcher, stopChan <-chan struct{})

WatchServices watches for service add, update, and delete events

Types

type EndpointsReader

type EndpointsReader struct {
	Events chan *EndpointsRequest
}

func NewEndpointsReader

func NewEndpointsReader(events chan *EndpointsRequest) *EndpointsReader

func (*EndpointsReader) Add

func (e *EndpointsReader) Add(obj interface{})

func (*EndpointsReader) Delete

func (e *EndpointsReader) Delete(obj interface{})

func (*EndpointsReader) Update

func (e *EndpointsReader) Update(_, newObj interface{})

type EndpointsRequest

type EndpointsRequest struct {
	Type            RequestType
	RemoteEndpoints *v1.Endpoints
	LocalEndpoints  *v1.Endpoints
}

type EndpointsWriter

type EndpointsWriter struct {
	Events chan *EndpointsRequest
	Client kubernetes.Interface
}

func NewEndpointsWriter

func NewEndpointsWriter(clientset kubernetes.Interface, events chan *EndpointsRequest) *EndpointsWriter

func (*EndpointsWriter) Run

func (e *EndpointsWriter) Run()

type RequestType

type RequestType int

type ServiceReader

type ServiceReader struct {
	Events chan *ServiceRequest
}

func NewServiceReader

func NewServiceReader(events chan *ServiceRequest) *ServiceReader

func (*ServiceReader) Add

func (s *ServiceReader) Add(obj interface{})

func (*ServiceReader) Delete

func (s *ServiceReader) Delete(obj interface{})

func (*ServiceReader) Update

func (s *ServiceReader) Update(_, newObj interface{})

type ServiceRequest

type ServiceRequest struct {
	Type          RequestType
	RemoteService *v1.Service
	LocalService  *v1.Service
}

type ServiceWriter

type ServiceWriter struct {
	Events chan *ServiceRequest
	Client kubernetes.Interface
}

func NewServiceWriter

func NewServiceWriter(clientset kubernetes.Interface, events chan *ServiceRequest) *ServiceWriter

func (*ServiceWriter) Run

func (s *ServiceWriter) Run()

type Watcher

type Watcher interface {
	Add(interface{})
	Update(interface{}, interface{})
	Delete(interface{})
}

Jump to

Keyboard shortcuts

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