Documentation ¶
Index ¶
- type KubeClient
- func (kc *KubeClient) CreateManagedCluster(ctx context.Context, managedcluster *unstructured.Unstructured) func() error
- func (kc *KubeClient) CreateOrUpdateUnstructuredObject(gvr schema.GroupVersionResource, obj *unstructured.Unstructured, ...)
- func (kc *KubeClient) GetCluster(ctx context.Context, clusterName string) (*unstructured.Unstructured, error)
- func (kc *KubeClient) GetDynamicClient(gvr schema.GroupVersionResource, namespaced bool) dynamic.ResourceInterface
- func (kc *KubeClient) ListK0sControlPlanes(ctx context.Context, clusterName string) ([]unstructured.Unstructured, error)
- func (kc *KubeClient) ListMachineDeployments(ctx context.Context, clusterName string) ([]unstructured.Unstructured, error)
- func (kc *KubeClient) ListMachines(ctx context.Context, clusterName string) ([]unstructured.Unstructured, error)
- func (kc *KubeClient) NewFromCluster(ctx context.Context, namespace, clusterName string) *KubeClient
- func (kc *KubeClient) WriteKubeconfig(ctx context.Context, clusterName string) (string, func() error)
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) CreateManagedCluster ¶
func (kc *KubeClient) CreateManagedCluster( ctx context.Context, managedcluster *unstructured.Unstructured, ) func() error
CreateManagedCluster creates a managedcluster.hmc.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) 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) GetDynamicClient ¶
func (kc *KubeClient) GetDynamicClient(gvr schema.GroupVersionResource, namespaced bool) dynamic.ResourceInterface
GetDynamicClient returns a dynamic client for the given GroupVersionResource.
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) 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.