controller

package
v0.0.0-...-d1b9435 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServiceLabel *must* be set to 'true' on a corev1.Service that should be watched by the Controller
	ServiceLabel = "thanos.receive.hashring.controller/watch"
	// HashringNameIdentifierLabel is an optional label that is used by the controller to identify the hashring name.
	// A missing/empty value defaults to the name of the Service.
	HashringNameIdentifierLabel = "hashring.controller.io/hashring"
	// TenantIdentifierLabel is an optional label that is used by the controller to identify a tenant for the hashring
	// When relying on default behaviour for the controller, the absence of this label
	// on a Service will result in an empty tenant list which matches all tenants providing soft-tenancy
	TenantIdentifierLabel = "hashring.controller.io/tenant"
	// AlgorithmIdentifierLabel is the label that is used by the controller to identify the hashring algorithm
	// When relying on default behaviour for the controller, the absence of this label
	// on a Service will result in the use of config.DefaultAlgorithm
	AlgorithmIdentifierLabel = "hashring.controller.io/hashing-algorithm"

	// DefaultConfigMapName is the default name for the generated ConfigMap
	DefaultConfigMapName = "hashring-controller-generated-config"
	// ConfigMapLabel is the label that is used to identify configmaps that is managed by the controller
	ConfigMapLabel = "hashring.controller.io/managed"

	// DefaultConfigMapKey is the default key for the generated ConfigMap
	DefaultConfigMapKey = "hashrings.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller manages selector-based service endpoint slices

func NewController

func NewController(
	ctx context.Context,
	endpointSliceInformer discoveryinformers.EndpointSliceInformer,
	configMapInformer coreinformers.ConfigMapInformer,
	client clientset.Interface,
	namespace string,
	opts *Options,
	logger log.Logger,
	registry *prometheus.Registry,
) *Controller

func (*Controller) EnsureConfigMapExists

func (c *Controller) EnsureConfigMapExists(ctx context.Context) error

EnsureConfigMapExists ensures that the controller's configmap exists or tries to create it with an empty hashring

func (*Controller) Run

func (c *Controller) Run(ctx context.Context, workers int) error

Run will set up the event handlers for types we are interested in, as well as syncing informer caches and starting workers. It will block until stopCh is closed, at which point it will shutdown the queue and wait for workers to finish processing their current work items.

type Options

type Options struct {
	// TTL controls the duration for which expired entries are kept in the cache
	// If not set, no TTL will be applied
	// Only Endpoints that have become unready due to an involuntary disruption are cached
	// Terminated Endpoints are removed from the hashring in all cases
	TTL *time.Duration
	// ConfigMapKey is the key for hashring config on the generated ConfigMap
	ConfigMapKey *string
	// ConfigMapName is the name of the generated ConfigMap
	ConfigMapName *string
	// Port is the port that the hashring will be generated for
	Port *string
	// ClusterDomain is the cluster domain that the hashring will be generated for
	ClusterDomain *string
}

Options provides a source to override default controller behaviour

Jump to

Keyboard shortcuts

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