reconcilers

package
v1.25.4-rc.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 23 Imported by: 11

Documentation

Overview

Package reconcilers provides objects for managing the list of active masters. NOTE: The Lease reconciler is not the intended way for any apiserver other than kube-apiserver to accomplish the task of Endpoint registration. This is a special case for the time being.

Package reconcilers master count based reconciler

Package reconcilers a noop based reconciler

Package reconcilers Endpoint Reconcilers for the apiserver

Index

Constants

View Source
const (
	// MasterCountReconcilerType will select the original reconciler
	MasterCountReconcilerType Type = "master-count"
	// LeaseEndpointReconcilerType will select a storage based reconciler
	LeaseEndpointReconcilerType = "lease"
	// NoneEndpointReconcilerType will turn off the endpoint reconciler
	NoneEndpointReconcilerType = "none"
)

Variables

AllTypes export all reconcilers

Functions

This section is empty.

Types

type EndpointReconciler

type EndpointReconciler interface {
	// ReconcileEndpoints sets the endpoints for the given apiserver service (ro or rw).
	// ReconcileEndpoints expects that the endpoints objects it manages will all be
	// managed only by ReconcileEndpoints; therefore, to understand this, you need only
	// understand the requirements.
	//
	// Requirements:
	//  * All apiservers MUST use the same ports for their {rw, ro} services.
	//  * All apiservers MUST use ReconcileEndpoints and only ReconcileEndpoints to manage the
	//      endpoints for their {rw, ro} services.
	//  * ReconcileEndpoints is called periodically from all apiservers.
	ReconcileEndpoints(serviceName string, ip net.IP, endpointPorts []corev1.EndpointPort, reconcilePorts bool) error
	// RemoveEndpoints removes this apiserver's lease.
	RemoveEndpoints(serviceName string, ip net.IP, endpointPorts []corev1.EndpointPort) error
	// StopReconciling turns any later ReconcileEndpoints call into a noop.
	StopReconciling()
	// Destroy shuts down all internal structures.
	// Destroy needs to be implemented in thread-safe way and be prepared for being
	// called more than once.
	Destroy()
}

EndpointReconciler knows how to reconcile the endpoints for the apiserver service.

func NewLeaseEndpointReconciler

func NewLeaseEndpointReconciler(epAdapter EndpointsAdapter, masterLeases Leases) EndpointReconciler

NewLeaseEndpointReconciler creates a new LeaseEndpoint reconciler

func NewMasterCountEndpointReconciler

func NewMasterCountEndpointReconciler(masterCount int, epAdapter EndpointsAdapter) EndpointReconciler

NewMasterCountEndpointReconciler creates a new EndpointReconciler that reconciles based on a specified expected number of masters.

func NewNoneEndpointReconciler

func NewNoneEndpointReconciler() EndpointReconciler

NewNoneEndpointReconciler creates a new EndpointReconciler that reconciles based on a nothing. It is a no-op.

type EndpointsAdapter

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

EndpointsAdapter provides a simple interface for reading and writing both Endpoints and Endpoint Slices. NOTE: This is an incomplete adapter implementation that is only suitable for use in this package. This takes advantage of the Endpoints used in this package always having a consistent set of ports, a single subset, and a small set of addresses. Any more complex Endpoints resource would likely translate into multiple Endpoint Slices creating significantly more complexity instead of the 1:1 mapping this allows.

func NewEndpointsAdapter

func NewEndpointsAdapter(endpointClient corev1client.EndpointsGetter, endpointSliceClient discoveryclient.EndpointSlicesGetter) EndpointsAdapter

NewEndpointsAdapter returns a new EndpointsAdapter.

func (*EndpointsAdapter) Create

func (adapter *EndpointsAdapter) Create(namespace string, endpoints *corev1.Endpoints) (*corev1.Endpoints, error)

Create accepts a namespace and Endpoints object and creates the Endpoints object and matching EndpointSlice. The created Endpoints object or an error will be returned.

func (*EndpointsAdapter) EnsureEndpointSliceFromEndpoints

func (adapter *EndpointsAdapter) EnsureEndpointSliceFromEndpoints(namespace string, endpoints *corev1.Endpoints) error

EnsureEndpointSliceFromEndpoints accepts a namespace and Endpoints resource and creates or updates a corresponding EndpointSlice. An error will be returned if it fails to sync the EndpointSlice.

func (*EndpointsAdapter) Get

func (adapter *EndpointsAdapter) Get(namespace, name string, getOpts metav1.GetOptions) (*corev1.Endpoints, error)

Get takes the name and namespace of the Endpoints resource, and returns a corresponding Endpoints object if it exists, and an error if there is any.

func (*EndpointsAdapter) Update

func (adapter *EndpointsAdapter) Update(namespace string, endpoints *corev1.Endpoints) (*corev1.Endpoints, error)

Update accepts a namespace and Endpoints object and updates it and its matching EndpointSlice. The updated Endpoints object or an error will be returned.

type Leases

type Leases interface {
	// ListLeases retrieves a list of the current master IPs
	ListLeases() ([]string, error)

	// UpdateLease adds or refreshes a master's lease
	UpdateLease(ip string) error

	// RemoveLease removes a master's lease
	RemoveLease(ip string) error

	// Destroy cleans up everything on shutdown.
	Destroy()
}

Leases is an interface which assists in managing the set of active masters

func NewLeases

func NewLeases(config *storagebackend.ConfigForResource, baseKey string, leaseTime time.Duration) (Leases, error)

NewLeases creates a new etcd-based Leases implementation.

type Type

type Type string

Type the reconciler type

type Types

type Types []Type

Types an array of reconciler types

func (Types) Names

func (t Types) Names() []string

Names returns a slice of all the reconciler names

Jump to

Keyboard shortcuts

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