Help us shape the future of Go! Take the 2026 Go Developer Survey

clients

package
v0.0.0-...-26685a3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HelmClient

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

func NewHelmClient

func NewHelmClient(opts ...HelmClientOpt) (*HelmClient, error)

func (*HelmClient) AddRepository

func (h *HelmClient) AddRepository(name, url string) error

AddRepository adds a helm repository. url is the chart repo URL; name is the local alias.

func (*HelmClient) Cleanup

func (h *HelmClient) Cleanup()

func (*HelmClient) InstallChart

func (h *HelmClient) InstallChart(ctx context.Context, chart string, params []string) (string, error)

func (*HelmClient) InstallChartWithTimeout

func (h *HelmClient) InstallChartWithTimeout(ctx context.Context, releaseName, chart, version string, params []string, timeout time.Duration) (string, error)

InstallChartWithTimeout is like InstallChart but accepts a custom timeout, release name, and optional chart version. version may be empty (uses the latest available version).

func (*HelmClient) UninstallAllReleases

func (h *HelmClient) UninstallAllReleases()

UninstallAllReleases uninstalls all helm releases in the client's namespace. Errors are logged but not returned so cleanup continues regardless.

func (*HelmClient) UninstallChart

func (h *HelmClient) UninstallChart() error

func (*HelmClient) UninstallChartByName

func (h *HelmClient) UninstallChartByName(releaseName string) error

UninstallChartByName uninstalls a helm release by name without requiring it was installed by this client.

type HelmClientOpt

type HelmClientOpt func(client *HelmClient)

func WithKubeConfigOption

func WithKubeConfigOption(kubeconf *restclient.Config) HelmClientOpt

func WithNameSpaceOption

func WithNameSpaceOption(namespace string) HelmClientOpt

type K8sClient

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

func NewK8sClient

func NewK8sClient(config *restclient.Config) (*K8sClient, error)

func (*K8sClient) CleanupClusterScopedResources

func (k *K8sClient) CleanupClusterScopedResources(ctx context.Context, oldReleaseName string)

CleanupClusterScopedResources removes cluster-scoped resources left behind by a previous GPU Operator helm release. These persist after namespace deletion and block a fresh install with a different release name.

func (*K8sClient) CreateConfigMap

func (k *K8sClient) CreateConfigMap(ctx context.Context, namespace string, name string, json string) error

func (*K8sClient) CreateNamespace

func (k *K8sClient) CreateNamespace(ctx context.Context, namespace string) error

func (*K8sClient) CreatePod

func (k *K8sClient) CreatePod(ctx context.Context, namespace string, pod *corev1.Pod) error

CreatePod creates a Pod in the given namespace and returns any error.

func (*K8sClient) DeleteCertManagerKubeSystemRoles

func (k *K8sClient) DeleteCertManagerKubeSystemRoles(ctx context.Context)

DeleteCertManagerKubeSystemRoles removes cert-manager Roles from kube-system that may have been left without helm ownership metadata after a previous run's cleanup. Without proper labels/annotations, helm cannot adopt them and fails with "cannot be imported".

func (*K8sClient) DeleteConfigMap

func (k *K8sClient) DeleteConfigMap(ctx context.Context, namespace string, name string) error

func (*K8sClient) DeleteNamespace

func (k *K8sClient) DeleteNamespace(ctx context.Context, namespace string) error

func (*K8sClient) DeleteNamespaceAndWait

func (k *K8sClient) DeleteNamespaceAndWait(ctx context.Context, namespace, _ string, timeout time.Duration) error

DeleteNamespaceAndWait removes GPU Operator CRs and their finalizers, deletes the namespace, and polls until it is fully gone.

func (*K8sClient) DeletePod

func (k *K8sClient) DeletePod(ctx context.Context, namespace, name string) error

DeletePod deletes a pod by name.

func (*K8sClient) ExecCmdOnPod

func (k *K8sClient) ExecCmdOnPod(ctx context.Context, rc *restclient.Config, pod *corev1.Pod, container, execCmd string) (string, error)

func (*K8sClient) GetMetricsCmdFromPod

func (k *K8sClient) GetMetricsCmdFromPod(ctx context.Context, rc *restclient.Config, pod *corev1.Pod) (labels []string, fields []string, err error)

func (*K8sClient) GetNodeAllocatableGPUs

func (k *K8sClient) GetNodeAllocatableGPUs(ctx context.Context, nodeName string) (int64, error)

GetNodeAllocatableGPUs returns the number of amd.com/gpu allocatable resources on a node. Returns -1 if the resource is not present.

func (*K8sClient) GetNodeNames

func (k *K8sClient) GetNodeNames(ctx context.Context) ([]string, error)

GetNodeNames returns all node names in the cluster.

func (*K8sClient) GetNodesByLabel

func (k *K8sClient) GetNodesByLabel(ctx context.Context, labelMap map[string]string) ([]corev1.Node, error)

func (*K8sClient) GetPodLogs

func (k *K8sClient) GetPodLogs(ctx context.Context, namespace, podName string) (string, error)

GetPodLogs returns the logs for a pod's first container.

func (*K8sClient) GetPodsByLabel

func (k *K8sClient) GetPodsByLabel(ctx context.Context, namespace string, labelMap map[string]string) ([]corev1.Pod, error)

func (*K8sClient) GetServiceByLabel

func (k *K8sClient) GetServiceByLabel(ctx context.Context, namespace string, labelMap map[string]string) ([]corev1.Service, error)

func (*K8sClient) NamespaceExists

func (k *K8sClient) NamespaceExists(ctx context.Context, namespace string) bool

func (*K8sClient) UpdateConfigMap

func (k *K8sClient) UpdateConfigMap(ctx context.Context, namespace string, name string, json string) error

func (*K8sClient) ValidatePod

func (k *K8sClient) ValidatePod(ctx context.Context, namespace, podName string) error

func (*K8sClient) WaitForDaemonSetReady

func (k *K8sClient) WaitForDaemonSetReady(ctx context.Context, namespace, name string, timeout time.Duration) error

WaitForDaemonSetReady polls until all desired pods of a DaemonSet are ready, or timeout expires.

func (*K8sClient) WaitForNodeLabel

func (k *K8sClient) WaitForNodeLabel(ctx context.Context, labelKey, labelValue string, timeout time.Duration) error

WaitForNodeLabel polls until at least one node has the given label key=value, or timeout expires.

func (*K8sClient) WaitForPodDeleted

func (k *K8sClient) WaitForPodDeleted(ctx context.Context, namespace, podName string, timeout time.Duration) error

WaitForPodDeleted polls until the named pod no longer exists (or timeout).

func (*K8sClient) WaitForPodSucceeded

func (k *K8sClient) WaitForPodSucceeded(ctx context.Context, namespace, podName string, timeout time.Duration) error

WaitForPodSucceeded polls until the pod reaches Succeeded phase or timeout expires.

Jump to

Keyboard shortcuts

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