sync

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package sync implements a queue for syncing resources to an upstream Kubernetes cluster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SumEndpoints added in v0.3.0

func SumEndpoints(eps *v1.Endpoints) int

SumEndpoints takes an enpoints object and returns total number of Addresses

Types

type Action

type Action interface {
	Sync(kube kubernetes.Interface, logger *logrus.Logger) error
	ObjectMeta() *metav1.ObjectMeta
	SetMetrics(gimbalKubeClient kubernetes.Interface, lm localmetrics.DiscovererMetrics, logger *logrus.Logger)
	SetMetricError(metrics localmetrics.DiscovererMetrics)
	GetActionType() string
}

Action that is added to the queue for processing

func AddEndpointsAction

func AddEndpointsAction(endpoints *v1.Endpoints, upstreamName string) Action

AddEndpointsAction returns an action that adds a new endpoint to the cluster

func AddServiceAction

func AddServiceAction(service *v1.Service) Action

AddServiceAction returns an action that adds a new endpoint to the cluster

func DeleteEndpointsAction

func DeleteEndpointsAction(endpoints *v1.Endpoints, upstreamName string) Action

DeleteEndpointsAction returns an action that deletes the given endpoint from the cluster

func DeleteServiceAction

func DeleteServiceAction(service *v1.Service) Action

DeleteServiceAction returns an action that deletes the given endpoint from the cluster

func UpdateEndpointsAction

func UpdateEndpointsAction(endpoints *v1.Endpoints, upstreamName string) Action

UpdateEndpointsAction returns an action that updates the given endpoint in the cluster

func UpdateServiceAction

func UpdateServiceAction(service *v1.Service) Action

UpdateServiceAction returns an action that updates the given endpoint in the cluster

type Queue

type Queue struct {
	Logger      *logrus.Logger
	KubeClient  kubernetes.Interface
	Workqueue   workqueue.RateLimitingInterface
	Threadiness int
	Metrics     localmetrics.DiscovererMetrics
}

Queue syncs resources with the Gimbal cluster by working through a queue of actions that must be performed against services and endpoints.

func NewQueue added in v0.2.0

func NewQueue(logger *logrus.Logger, kubeClient kubernetes.Interface,
	threadiness int, metrics localmetrics.DiscovererMetrics) Queue

NewQueue returns an initialized sync.Queue for syncing resources with a Gimbal cluster.

func (*Queue) Enqueue

func (sq *Queue) Enqueue(action Action)

Enqueue adds a new resource action to the worker queue

func (*Queue) Run

func (sq *Queue) Run(stopCh <-chan struct{})

Run starts the queue workers. It blocks until the stopCh is closed.

Jump to

Keyboard shortcuts

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