clientmap

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientMap

type ClientMap interface {
	Invalidate
	// GetClient returns the corresponding ClientSet for the given key in the ClientMap or creates a new ClientSet for
	// it if the map does not contain a corresponding ClientSet. If the ClientMap was started before by a call to Start,
	// newly created ClientSets will be started automatically using the stop channel provided to Start.
	GetClient(ctx context.Context, key ClientSetKey) (kubernetes.Interface, error)

	// Start starts the ClientMap, i.e. starts all ClientSets already contained in the map and saves the stop channel
	// for starting new ClientSets, when they are created.
	Start(stopCh <-chan struct{}) error
}

A ClientMap is a collection of kubernetes ClientSets, which can be used to dynamically create and lookup different ClientSets during runtime. ClientSets are identified by a ClientSetKey, which can have different forms, as there are different kinds of ClientMaps (for example one for Seed clients and one for Shoot clients). Implementations will provide suitable mechanisms to create a ClientSet for a given key and should come with some easy ways of constructing ClientSetKeys that their callers can use to lookup ClientSets in the map.

type ClientSetFactory

type ClientSetFactory interface {
	// NewClientSet constructs a new ClientSet for the given key.
	NewClientSet(ctx context.Context, key ClientSetKey) (kubernetes.Interface, error)
	// CalculateClientSetHash calculates a hash for the configuration that is used to construct a ClientSet
	// (e.g. kubeconfig secret) to detect if it has changed mid-air and the ClientSet should be refreshed.
	CalculateClientSetHash(ctx context.Context, key ClientSetKey) (string, error)
}

A ClientSetFactory can be used by ClientMaps to provide the individual mechanism for constructing new ClientSets for a given ClientSetKey

type ClientSetKey

type ClientSetKey interface {
	// Key is the string representation of the ClientSetKey.
	Key() string
}

A ClientSetKey is used to identify a ClientSet within a ClientMap. There can be different implementations for ClientSetKey as there are different kinds of ClientSets (e.g. for Shoot and Seed clusters) and therefore also different means of identifying the cluster to which a ClientSet belongs.

type Invalidate added in v1.15.0

type Invalidate interface {
	// InvalidateClient removes cached client information identified by the given `ClientSetKey`.
	InvalidateClient(key ClientSetKey) error
}

Invalidate is an interface used to invalidate client specific information.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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