endpointslice – k8s.io/endpointslice Index | Files | Directories

package endpointslice

import "k8s.io/endpointslice"

Package endpointslice contains the core logic of endpointslice controller.

Index

Functions

func ServiceControllerKey

func ServiceControllerKey(endpointSlice *discovery.EndpointSlice) (string, error)

ServiceControllerKey returns a controller key for a Service but derived from an EndpointSlice.

Types

type Reconciler

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

Reconciler is responsible for transforming current EndpointSlice state into desired state

func NewReconciler

func NewReconciler(client clientset.Interface, nodeLister corelisters.NodeLister, maxEndpointsPerSlice int32, endpointSliceTracker *endpointsliceutil.EndpointSliceTracker, topologyCache *topologycache.TopologyCache, eventRecorder record.EventRecorder, controllerName string, options ...ReconcilerOption) *Reconciler

func (*Reconciler) DeleteService

func (r *Reconciler) DeleteService(namespace, name string)

func (*Reconciler) GetControllerName

func (r *Reconciler) GetControllerName() string

func (*Reconciler) ManagedByChanged

func (r *Reconciler) ManagedByChanged(endpointSlice1, endpointSlice2 *discovery.EndpointSlice) bool

ManagedByChanged returns true if one of the provided EndpointSlices is managed by the EndpointSlice controller while the other is not.

func (*Reconciler) ManagedByController

func (r *Reconciler) ManagedByController(endpointSlice *discovery.EndpointSlice) bool

ManagedByController returns true if the controller of the provided EndpointSlices is the EndpointSlice controller.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(logger klog.Logger, service *corev1.Service, pods []*corev1.Pod, existingSlices []*discovery.EndpointSlice, triggerTime time.Time) error

Reconcile takes a set of pods currently matching a service selector and compares them with the endpoints already present in any existing endpoint slices for the given service. It creates, updates, or deletes endpoint slices to ensure the desired set of pods are represented by endpoint slices.

type ReconcilerOption

type ReconcilerOption func(*Reconciler)

func WithTrafficDistributionEnabled

func WithTrafficDistributionEnabled(enabled bool) ReconcilerOption

WithTrafficDistributionEnabled controls whether the Reconciler considers the `trafficDistribution` field while reconciling EndpointSlices.

Source Files

doc.go reconciler.go utils.go

Directories

PathSynopsis
metrics
topologycache
trafficdisttrafficdist handles reconciliation of hints for trafficDistribution field.
util
Version
v0.32.2 (latest)
Published
Feb 13, 2025
Platform
linux/amd64
Imports
25 packages
Last checked
2 months ago

Tools for package owners.