endpointslice

package module
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 25 Imported by: 2

README

endpointslice

Purpose

This repository contains packages related to the EndpointSlices feature.

This EndpointSlice reconciler library is not sufficiently generic to be used by the EndpointSlice Mirroring controller. The reconciler in the EndpointSlice mirroring controller has a 1:1 mapping between Service/Endpoints and EndpointSlice, which results in a simpler implementation then the EndpointSlice staging lib. Contributions to move towards the shared code being used by the mirroring controller would be welcome.

Compatibility

There are NO compatibility guarantees for this repository, yet. It is in direct support of Kubernetes, so branches will track Kubernetes and be compatible with that repo.

Where does it come from?

This repository is synced from https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/endpointslice Code changes are made in that location, merged into k8s.io/kubernetes and later synced here.

Things you should NOT do

  1. Directly modify any files in this repo. Those are driven from k8s.io/kubernetes/staging/src/k8s.io/endpointslice.
  2. Expect compatibility. This repo is changing quickly in direct support of Kubernetes.
OWNERS

SIG Network owns the code.

Documentation

Overview

Package endpointslice contains the core logic of endpointslice controller.

Index

Constants

This section is empty.

Variables

This section is empty.

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 added in v0.30.0

type ReconcilerOption func(*Reconciler)

func WithTrafficDistributionEnabled added in v0.30.0

func WithTrafficDistributionEnabled(enabled bool) ReconcilerOption

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

Directories

Path Synopsis
trafficdist handles reconciliation of hints for trafficDistribution field.
trafficdist handles reconciliation of hints for trafficDistribution field.

Jump to

Keyboard shortcuts

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