Documentation ¶
Index ¶
- Variables
- func NewShootClientMap(log logr.Logger, factory *ShootClientSetFactory) clientmap.ClientMap
- type GenericClientMap
- type ShootClientSetFactory
- func (f *ShootClientSetFactory) CalculateClientSetHash(ctx context.Context, k clientmap.ClientSetKey) (string, error)
- func (f *ShootClientSetFactory) InvalidateClient(k clientmap.ClientSetKey) error
- func (f *ShootClientSetFactory) NewClientSet(ctx context.Context, k clientmap.ClientSetKey) (kubernetes.Interface, string, error)
- type ShootClientSetKey
Constants ¶
This section is empty.
Variables ¶
var ( // LookupHost is an alias to net.LookupHost which allows it to be mocked for testing. LookupHost = net.LookupHost )
net aliases
var MaxRefreshInterval = 5 * time.Second
MaxRefreshInterval is the maximum rate at which the version and hash of a single ClientSet are checked, to decide whether the ClientSet should be refreshed. Also, the GenericClientMap waits at least MaxRefreshInterval after creating a new ClientSet before checking if it should be refreshed.
var ( // NewClientFromSecretObject is an alias to kubernetes.NewClientFromSecretObject which allows it to be mocked for testing. NewClientFromSecretObject = kubernetes.NewClientFromSecretObject )
github.com/gardener/gardener/pkg/client/kubernetes aliases
var ( // ProjectForNamespaceFromReader is an alias to gardenerutils.ProjectForNamespaceFromReader which allows it to be mocked for testing. ProjectForNamespaceFromReader = gardenerutils.ProjectForNamespaceFromReader )
github.com/gardener/gardener/pkg/utils/gardener aliases
Functions ¶
func NewShootClientMap ¶
func NewShootClientMap(log logr.Logger, factory *ShootClientSetFactory) clientmap.ClientMap
NewShootClientMap creates a new shootClientMap with the given factory.
Types ¶
type GenericClientMap ¶
type GenericClientMap struct {
// contains filtered or unexported fields
}
GenericClientMap is a generic implementation of clientmap.ClientMap, which can be used by specific ClientMap implementations to reuse the core logic for storing, requesting, invalidating and starting ClientSets. Specific implementations only need to provide a ClientSetFactory that can produce new ClientSets for the respective keys if a corresponding entry is not found in the GenericClientMap.
func NewGenericClientMap ¶
func NewGenericClientMap(factory clientmap.ClientSetFactory, logger logr.Logger, clock clock.Clock) *GenericClientMap
NewGenericClientMap creates a new GenericClientMap with the given factory and logger.
func (*GenericClientMap) GetClient ¶
func (cm *GenericClientMap) GetClient(ctx context.Context, key clientmap.ClientSetKey) (kubernetes.Interface, error)
GetClient requests a ClientSet for a cluster identified by the given key. If the ClientSet was already created before, it returns the one saved in the map, otherwise it creates a new ClientSet by using the provided ClientSetFactory. New ClientSets are immediately started if the ClientMap has already been started before. Also GetClient will regularly rediscover the server version of the targeted cluster and check if the config hash has changed and recreate the ClientSet if a config hash change is detected.
func (*GenericClientMap) InvalidateClient ¶
func (cm *GenericClientMap) InvalidateClient(key clientmap.ClientSetKey) error
InvalidateClient removes the ClientSet identified by the given key from the ClientMap after stopping its cache.
type ShootClientSetFactory ¶
type ShootClientSetFactory struct { // GardenClient is the garden cluster client. GardenClient client.Client // SeedClient is the seed cluster client. SeedClient client.Client // ClientConnectionConfiguration is the configuration that will be used by created ClientSets. ClientConnectionConfig componentbaseconfig.ClientConnectionConfiguration // contains filtered or unexported fields }
ShootClientSetFactory is a ClientSetFactory that can produce new ClientSets to Shoot clusters.
func (*ShootClientSetFactory) CalculateClientSetHash ¶
func (f *ShootClientSetFactory) CalculateClientSetHash(ctx context.Context, k clientmap.ClientSetKey) (string, error)
CalculateClientSetHash calculates a SHA256 hash of the kubeconfig in the 'gardener' secret in the Shoot's Seed namespace.
func (*ShootClientSetFactory) InvalidateClient ¶ added in v1.15.0
func (f *ShootClientSetFactory) InvalidateClient(k clientmap.ClientSetKey) error
InvalidateClient invalidates information cached for the given ClientSetKey in the factory.
func (*ShootClientSetFactory) NewClientSet ¶
func (f *ShootClientSetFactory) NewClientSet(ctx context.Context, k clientmap.ClientSetKey) (kubernetes.Interface, string, error)
NewClientSet creates a new ClientSet for a Shoot cluster.
type ShootClientSetKey ¶
type ShootClientSetKey struct {
Namespace, Name string
}
ShootClientSetKey is a ClientSetKey for a Shoot cluster.
func (ShootClientSetKey) Key ¶
func (k ShootClientSetKey) Key() string
Key returns the string representation of the ClientSetKey.