Documentation
¶
Overview ¶
Package tenant provides utilities for managing connections to tenant clusters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientManager ¶
type ClientManager struct {
// contains filtered or unexported fields
}
ClientManager manages Kubernetes clients for tenant clusters.
Since Kamaji hosts tenant control planes in the management cluster, we can connect to tenant APIs locally. This manager caches clients to avoid recreating them on every reconciliation.
Key features: - Caches clients by tenant cluster name - Automatically refreshes clients when kubeconfig changes - Cleans up clients when tenant clusters are deleted - Thread-safe for concurrent reconciliation
func NewClientManager ¶
func NewClientManager(mgr client.Client) *ClientManager
NewClientManager creates a new ClientManager.
func (*ClientManager) GetClient ¶
func (m *ClientManager) GetClient(ctx context.Context, namespace, name string) (*TenantClient, error)
GetClient returns a client for the specified tenant cluster. If a client doesn't exist or the kubeconfig has changed, a new one is created.
func (*ClientManager) RefreshClient ¶
func (m *ClientManager) RefreshClient(ctx context.Context, namespace, name string) (*TenantClient, error)
RefreshClient forces a client refresh. Called when a kubeconfig secret changes.
func (*ClientManager) RemoveClient ¶
func (m *ClientManager) RemoveClient(namespace, name string)
RemoveClient removes a cached client. Called when a tenant cluster is deleted.
type TenantClient ¶
type TenantClient struct {
// RESTConfig is the REST config for the tenant cluster.
RESTConfig *rest.Config
// Clientset is the Kubernetes clientset.
Clientset kubernetes.Interface
// Client is the controller-runtime client.
Client client.Client
}
TenantClient wraps connections to a tenant cluster.