kubegroup

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 10 Imported by: 3

Documentation

Overview

Package kubegroup provides autodiscovery for groupcache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindMyAddress added in v1.1.0

func FindMyAddress() (string, error)

FindMyAddress returns my adress.

func FindMyURL

func FindMyURL(groupcachePort string) (string, error)

FindMyURL returns my URL for groupcache pool. groupcachePort example: ":5000". Sample resulting URL: "http://10.0.0.1:5000"

Types

type Group added in v0.5.0

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

Group holds context for kubegroup.

func UpdatePeers

func UpdatePeers(options Options) (*Group, error)

UpdatePeers continuously updates groupcache peers.

func (*Group) Close added in v0.5.0

func (g *Group) Close()

Close terminates kubegroup goroutines to release resources.

type Options added in v0.2.0

type Options struct {
	// Pool is an interface to plug in a target for delivering peering
	// updates. *groupcache.HTTPPool, created with
	// groupcache.NewHTTPPoolOpts(), implements this interface.
	// Pool supports groupcache2.
	Pool PeerGroup

	// PeerSet is an interface to plug in a target for delivering peering
	// updates. *groupcache.Daemon, created with
	// groupcache.ListenAndServe(), implements this interface.
	// PeerSet supports groupcache3.
	Peers PeerSet

	// Client provides kubernetes client.
	Client *kubernetes.Clientset

	// GroupCachePort is the listening port used by groupcache peering http
	// server. For instance, ":5000".
	GroupCachePort string

	// LabelSelector is required. Example: "key1=value1,key2=value2"
	LabelSelector string

	// Debug enables non-error logging. Errors are always logged.
	Debug bool

	// Logf optionally sets custom logging.
	Logf func(format string, v ...any)

	// MetricsNamespace provides optional namespace for prometheus metrics.
	MetricsNamespace string

	// MetricsRegisterer is required registerer for prometheus metrics.
	MetricsRegisterer prometheus.Registerer

	// MetricsRegisterer is required gatherer for prometheus metrics.
	MetricsGatherer prometheus.Gatherer

	// ForceNamespaceDefault is used only for testing.
	ForceNamespaceDefault bool
}

Options specifies options for UpdatePeers.

type PeerGroup added in v0.5.0

type PeerGroup interface {
	Set(peers ...string)
}

PeerGroup is an interface to plug in a target for delivering peering updates. *groupcache.HTTPPool, created with groupcache.NewHTTPPoolOpts(), implements this interface.

type PeerSet added in v1.1.0

type PeerSet interface {
	SetPeers(ctx context.Context, peers []peer.Info) error
}

PeerSet is an interface to plug in a target for delivering peering updates. *groupcache.daemon, created with groupcache.ListenAndServe(), implements this interface.

Jump to

Keyboard shortcuts

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