Documentation
¶
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 cached Kubernetes clients for tenant clusters. Tenant control planes are hosted in the management cluster via Steward, so connections use the internal ClusterIP service endpoint (admin.svc). Clients are cached by tenant namespace/name with a TTL to handle kubeconfig rotation (cert renewal, key rotation).
func NewClientManager ¶
func NewClientManager(mgr client.Client) *ClientManager
NewClientManager creates a new ClientManager with the default TTL.
func (*ClientManager) GetClient ¶
func (m *ClientManager) GetClient(ctx context.Context, namespace, clusterName string) (*TenantClient, error)
GetClient returns a cached client for the specified tenant cluster. On cache miss or TTL expiry, it fetches the admin kubeconfig Secret from the tenant namespace, preferring the internal service endpoint (admin.svc) over the external endpoint (admin.conf).
func (*ClientManager) RefreshClient ¶
func (m *ClientManager) RefreshClient(ctx context.Context, namespace, clusterName string) (*TenantClient, error)
RefreshClient forces a client refresh. Called when a kubeconfig Secret changes.
func (*ClientManager) RemoveClient ¶
func (m *ClientManager) RemoveClient(namespace, clusterName string)
RemoveClient removes a cached client. Called when a tenant cluster is deleted.
type TenantClient ¶
type TenantClient struct {
RESTConfig *rest.Config
Clientset kubernetes.Interface
}
TenantClient wraps a cached connection to a tenant cluster.