kubernetes

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetK8sClient

func GetK8sClient(
	clientMgr *KubeMultiClientManager,
	orgName, name string,
	kubernetesCluster openchoreov1alpha1.KubernetesClusterSpec,
) (client.Client, error)

GetK8sClient retrieves a Kubernetes client for the specified org and cluster. Deprecated: Use GetK8sClientFromDataPlane instead

func GetK8sClientFromDataPlane added in v0.6.0

func GetK8sClientFromDataPlane(
	clientMgr *KubeMultiClientManager,
	dataplane *openchoreov1alpha1.DataPlane,
	agentServer interface{},
) (client.Client, error)

GetK8sClientFromDataPlane retrieves a Kubernetes client from DataPlane specification. It automatically handles agent mode vs direct access mode.

func NewAgentClient added in v0.6.0

func NewAgentClient(planeName string, agentSrv clustergateway.Dispatcher, requestTimeout time.Duration) (client.Client, error)

Types

type AgentClient added in v0.6.0

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

func (*AgentClient) Create added in v0.6.0

func (ac *AgentClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (*AgentClient) Delete added in v0.6.0

func (ac *AgentClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

func (*AgentClient) DeleteAllOf added in v0.6.0

func (ac *AgentClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

func (*AgentClient) Get added in v0.6.0

func (ac *AgentClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error

func (*AgentClient) GroupVersionKindFor added in v0.6.0

func (ac *AgentClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)

GroupVersionKindFor returns the GVK for an object

func (*AgentClient) IsObjectNamespaced added in v0.6.0

func (ac *AgentClient) IsObjectNamespaced(obj runtime.Object) (bool, error)

func (*AgentClient) List added in v0.6.0

func (ac *AgentClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

func (*AgentClient) Patch added in v0.6.0

func (ac *AgentClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

func (*AgentClient) RESTMapper added in v0.6.0

func (ac *AgentClient) RESTMapper() meta.RESTMapper

RESTMapper returns the REST mapper

func (*AgentClient) Scheme added in v0.6.0

func (ac *AgentClient) Scheme() *runtime.Scheme

Scheme returns the scheme this client is using

func (*AgentClient) Status added in v0.6.0

func (ac *AgentClient) Status() client.StatusWriter

Status returns a status writer for updating resource status

func (*AgentClient) SubResource added in v0.6.0

func (ac *AgentClient) SubResource(subResource string) client.SubResourceClient

func (*AgentClient) Update added in v0.6.0

func (ac *AgentClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

type KubeMultiClientManager

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

KubeMultiClientManager maintains a cache of Kubernetes clients keyed by a unique identifier. Uses RWMutex to allow concurrent reads while still protecting writes.

func NewManager

func NewManager() *KubeMultiClientManager

NewManager initializes a new KubeMultiClientManager.

func (*KubeMultiClientManager) GetClient

func (m *KubeMultiClientManager) GetClient(key string, kubernetesCluster *openchoreov1alpha1.KubernetesClusterSpec) (client.Client, error)

GetClient returns an existing Kubernetes client or creates one using the provided cluster configuration.

func (*KubeMultiClientManager) GetOrAddClient added in v0.6.0

func (m *KubeMultiClientManager) GetOrAddClient(key string, createFunc func() (client.Client, error)) (client.Client, error)

GetOrAddClient returns a cached client or creates one using the provided create function. This method encapsulates all locking logic, ensuring thread-safe access to the client cache. If a client exists for the given key, it returns immediately. Otherwise, it calls createFunc to create a new client, caches it, and returns it.

Jump to

Keyboard shortcuts

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