kubernetes

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 27 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 GetK8sClientFromBuildPlane added in v0.7.0

func GetK8sClientFromBuildPlane(
	clientMgr *KubeMultiClientManager,
	buildplane *openchoreov1alpha1.BuildPlane,
	gatewayURL string,
) (client.Client, error)

GetK8sClientFromBuildPlane retrieves a Kubernetes client from BuildPlane specification. Supports both agent mode (via HTTP proxy) and direct access mode.

func GetK8sClientFromDataPlane added in v0.6.0

func GetK8sClientFromDataPlane(
	clientMgr *KubeMultiClientManager,
	dataplane *openchoreov1alpha1.DataPlane,
	gatewayURL string,
) (client.Client, error)

GetK8sClientFromDataPlane retrieves a Kubernetes client from DataPlane specification. Supports both agent mode (via HTTP proxy) and direct access mode.

func NewProxyClient added in v0.7.0

func NewProxyClient(gatewayURL, planeName string, tlsConfig *ProxyTLSConfig) (client.Client, error)

NewProxyClient creates a new proxy client for accessing a data plane or build plane through the cluster gateway

Types

type KubeMultiClientManager

type KubeMultiClientManager struct {
	ProxyTLSConfig *ProxyTLSConfig // TLS configuration for HTTP proxy connections
	// 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 NewManagerWithProxyTLS added in v0.7.0

func NewManagerWithProxyTLS(tlsConfig *ProxyTLSConfig) *KubeMultiClientManager

NewManagerWithProxyTLS initializes a new KubeMultiClientManager with proxy TLS configuration.

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.

type ProxyClient added in v0.7.0

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

ProxyClient is a Kubernetes client that communicates through the cluster gateway HTTP proxy It implements the controller-runtime client.Client interface

func (*ProxyClient) Create added in v0.7.0

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

Create creates an object in the data plane Kubernetes API via the cluster gateway

func (*ProxyClient) Delete added in v0.7.0

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

Delete deletes an object from the data plane Kubernetes API via the cluster gateway

func (*ProxyClient) DeleteAllOf added in v0.7.0

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

DeleteAllOf deletes all objects matching the given list options

func (*ProxyClient) Get added in v0.7.0

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

Get retrieves an object from the data plane Kubernetes API via the cluster gateway

func (*ProxyClient) GroupVersionKindFor added in v0.7.0

func (pc *ProxyClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)

GroupVersionKindFor returns the GroupVersionKind for the given object

func (*ProxyClient) IsObjectNamespaced added in v0.7.0

func (pc *ProxyClient) IsObjectNamespaced(obj runtime.Object) (bool, error)

IsObjectNamespaced returns true if the object is namespaced

func (*ProxyClient) List added in v0.7.0

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

List retrieves a list of objects from the data plane Kubernetes API via the cluster gateway

func (*ProxyClient) Patch added in v0.7.0

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

Patch patches an object in the data plane Kubernetes API via the cluster gateway

func (*ProxyClient) RESTMapper added in v0.7.0

func (pc *ProxyClient) RESTMapper() meta.RESTMapper

RESTMapper returns the REST mapper

func (*ProxyClient) Scheme added in v0.7.0

func (pc *ProxyClient) Scheme() *runtime.Scheme

Scheme returns the scheme this client is using

func (*ProxyClient) Status added in v0.7.0

func (pc *ProxyClient) Status() client.StatusWriter

Status returns a StatusWriter for updating object status

func (*ProxyClient) SubResource added in v0.7.0

func (pc *ProxyClient) SubResource(subResource string) client.SubResourceClient

SubResource returns a SubResourceClient for accessing subresources

func (*ProxyClient) Update added in v0.7.0

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

Update updates an object in the data plane Kubernetes API via the cluster gateway

type ProxyTLSConfig added in v0.7.0

type ProxyTLSConfig struct {
	CACertPath     string
	ClientCertPath string
	ClientKeyPath  string
}

ProxyTLSConfig holds TLS configuration for HTTP proxy connections to the cluster gateway

Jump to

Keyboard shortcuts

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