kubeclient

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubeClient

type KubeClient struct {
	Client         kubernetes.Interface
	ExtendedClient apiextensionsclientset.Interface
	Config         *rest.Config

	Namespace string
}

func NewFromLocal

func NewFromLocal(namespace string) *KubeClient

NewFromLocal creates a new instance of KubeClient from a given namespace using the locally found kubeconfig.

func (*KubeClient) CreateClusterDeployment

func (kc *KubeClient) CreateClusterDeployment(
	ctx context.Context, clusterDeployment *unstructured.Unstructured,
) func() error

CreateClusterDeployment creates a clusterdeployment.k0rdent.mirantis.com in the given namespace and returns a DeleteFunc to clean up the deployment. The DeleteFunc is a no-op if the deployment has already been deleted.

func (*KubeClient) CreateMultiClusterService added in v0.1.0

func (kc *KubeClient) CreateMultiClusterService(
	ctx context.Context,
	multiClusterService *unstructured.Unstructured,
) func() error

func (*KubeClient) CreateOrUpdateUnstructuredObject

func (kc *KubeClient) CreateOrUpdateUnstructuredObject(gvr schema.GroupVersionResource, obj *unstructured.Unstructured, namespaced bool)

func (*KubeClient) GetCluster

func (kc *KubeClient) GetCluster(ctx context.Context, clusterName string) (*unstructured.Unstructured, error)

GetCluster returns a Cluster resource by name.

func (*KubeClient) GetCredential added in v0.1.0

func (kc *KubeClient) GetCredential(ctx context.Context, name string) (*unstructured.Unstructured, error)

func (*KubeClient) GetDynamicClient

func (kc *KubeClient) GetDynamicClient(gvr schema.GroupVersionResource, namespaced bool) dynamic.ResourceInterface

GetDynamicClient returns a dynamic client for the given GroupVersionResource.

func (*KubeClient) GetKubeconfigSecretData added in v0.1.0

func (kc *KubeClient) GetKubeconfigSecretData(ctx context.Context, clusterName string) []byte

func (*KubeClient) GetSveltosCluster added in v0.1.0

func (kc *KubeClient) GetSveltosCluster(ctx context.Context, name string) (*unstructured.Unstructured, error)

func (*KubeClient) ListAWSManagedControlPlanes added in v0.1.0

func (kc *KubeClient) ListAWSManagedControlPlanes(
	ctx context.Context, clusterName string,
) ([]unstructured.Unstructured, error)

func (*KubeClient) ListClusterTemplates added in v0.1.0

func (kc *KubeClient) ListClusterTemplates(ctx context.Context) ([]unstructured.Unstructured, error)

func (*KubeClient) ListK0sControlPlanes

func (kc *KubeClient) ListK0sControlPlanes(
	ctx context.Context, clusterName string,
) ([]unstructured.Unstructured, error)

func (*KubeClient) ListMachineDeployments

func (kc *KubeClient) ListMachineDeployments(
	ctx context.Context, clusterName string,
) ([]unstructured.Unstructured, error)

ListMachineDeployments returns a list of MachineDeployment resources for the given cluster.

func (*KubeClient) ListMachines

func (kc *KubeClient) ListMachines(ctx context.Context, clusterName string) ([]unstructured.Unstructured, error)

ListMachines returns a list of Machine resources for the given cluster.

func (*KubeClient) NewFromCluster

func (kc *KubeClient) NewFromCluster(ctx context.Context, namespace, clusterName string) *KubeClient

NewFromCluster creates a new KubeClient using the kubeconfig stored in the secret affiliated with the given clusterName. Since it relies on fetching the kubeconfig from secret it needs an existing kubeclient.

func (*KubeClient) PatchMachineDeployment added in v0.1.0

func (kc *KubeClient) PatchMachineDeployment(
	ctx context.Context,
	name string,
	pt types.PatchType,
	data []byte,
) (*unstructured.Unstructured, error)

PatchMachineDeployment patches a MachineDeployment resource with the given data.

func (*KubeClient) WriteKubeconfig

func (kc *KubeClient) WriteKubeconfig(ctx context.Context, clusterName string) (string, func() error)

WriteKubeconfig writes the kubeconfig for the given clusterName to the test/e2e directory returning the path to the file and a function to delete it later.

Jump to

Keyboard shortcuts

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