apicall

package
v2.2.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package apicall defines many useful functions to fetch data by kubernetes api

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureFinalizer

func EnsureFinalizer(ctx context.Context, cli client.Client, obj client.Object) error

EnsureFinalizer ensures the finalizer is added to the object and updates the object if necessary.

func Get

func Get[T any, PT Object[T]](ctx context.Context, c client.Client, ns, name string) (*T, error)

func GetClientTLSConfig

func GetClientTLSConfig(ctx context.Context, c client.Client, cluster *v1alpha1.Cluster) (*tls.Config, error)

func GetClientTLSConfigByGroup

func GetClientTLSConfigByGroup[
	S scope.Object[F, T],
	F client.Object,
	T runtime.Object,
](ctx context.Context, c client.Client, obj F) (*tls.Config, error)

func GetCluster

func GetCluster[
	S scope.Object[F, T],
	F client.Object,
	T runtime.Object,
](ctx context.Context, c client.Client, obj F) (*v1alpha1.Cluster, error)

func GetPod

func GetPod[
	S scope.Instance[F, T],
	F client.Object,
	T runtime.Instance,
](ctx context.Context, c client.Client, obj F) (*corev1.Pod, error)

func GetPodIfExists

func GetPodIfExists[
	S scope.Instance[F, T],
	F client.Object,
	T runtime.Instance,
](ctx context.Context, c client.Client, obj F) (*corev1.Pod, error)

func ListClusterInstances

func ListClusterInstances[
	S scope.InstanceList[F, T, L],
	F client.Object,
	T runtime.Instance,
	L client.ObjectList,
](ctx context.Context, c client.Client, ns, cluster string) ([]F, error)

func ListGroups

func ListGroups[
	S scope.GroupList[F, T, L],
	F client.Object,
	T runtime.Group,
	L client.ObjectList,
](ctx context.Context, c client.Client, ns, cluster string) ([]F, error)

func ListInstances

func ListInstances[
	GS scope.GroupInstance[GF, GT, IS],
	IS scope.List[IL, I],
	GF client.Object,
	GT runtime.Group,
	IL client.ObjectList,
	I client.Object,
](ctx context.Context, c client.Client, g GF) ([]I, error)

ListInstances returns instances managed by a specified group

func ListPeerInstances

func ListPeerInstances[
	S scope.InstanceList[F, T, L],
	F client.Object,
	T runtime.Instance,
	L client.ObjectList,
](ctx context.Context, c client.Client, in F) ([]F, error)

ListPeerInstances returns peers of an instance in a same cluster NOTE: - All peers in the same cluster will be returned - Input instance will also be returned

func ListPods

func ListPods[
	S scope.Group[F, T],
	F client.Object,
	T runtime.Group,
](ctx context.Context, c ctrlclient.Client, g F) (*corev1.PodList, error)

func NewInstanceListerWatcher

func NewInstanceListerWatcher[
	GS scope.GroupInstance[GF, GT, IS],
	IS scope.List[IL, I],
	GF client.Object,
	GT runtime.Group,
	IL client.ObjectList,
	I client.Object,
](ctx context.Context, c client.Client, g GF) cache.ListerWatcher

NewInstanceListerWatcher returns a cache.ListerWatcher for a group

func PDTopologyInvolvesMS

func PDTopologyInvolvesMS(ctx context.Context, c client.Client, namespace, cluster string) (bool, error)

func RemoveFinalizer

func RemoveFinalizer(ctx context.Context, cli client.Client, obj client.Object) error

RemoveFinalizer removes the finalizer from the object and updates the object if necessary.

func SetOffline added in v2.0.1

func SetOffline[
	S scope.Instance[F, T],
	F client.Object,
	T runtime.Instance,
](ctx context.Context, c client.Client, obj F) error

SetOffline set spec.offline for the store

Types

type Object

type Object[T any] interface {
	client.Object

	*T
}

type OfflineMetadata added in v2.0.1

type OfflineMetadata struct {
	ResourceVersion string             `json:"resourceVersion"`
	Annotations     map[string]*string `json:"annotations,omitempty"`
}

type OfflinePatch added in v2.0.1

type OfflinePatch struct {
	Metadata OfflineMetadata `json:"metadata"`
	Spec     *OfflineSpec    `json:"spec,omitempty"`
}

type OfflineSpec added in v2.0.1

type OfflineSpec struct {
	Offline bool `json:"offline"`
}

Jump to

Keyboard shortcuts

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