Documentation
¶
Index ¶
- type HelmClient
- func (h *HelmClient) AddRepository(name, url string) error
- func (h *HelmClient) Cleanup()
- func (h *HelmClient) InstallChart(ctx context.Context, chart string, params []string) (string, error)
- func (h *HelmClient) InstallChartWithTimeout(ctx context.Context, releaseName, chart, version string, params []string, ...) (string, error)
- func (h *HelmClient) UninstallAllReleases()
- func (h *HelmClient) UninstallChart() error
- func (h *HelmClient) UninstallChartByName(releaseName string) error
- type HelmClientOpt
- type K8sClient
- func (k *K8sClient) CleanupClusterScopedResources(ctx context.Context, oldReleaseName string)
- func (k *K8sClient) CreateConfigMap(ctx context.Context, namespace string, name string, json string) error
- func (k *K8sClient) CreateNamespace(ctx context.Context, namespace string) error
- func (k *K8sClient) CreatePod(ctx context.Context, namespace string, pod *corev1.Pod) error
- func (k *K8sClient) DeleteCertManagerKubeSystemRoles(ctx context.Context)
- func (k *K8sClient) DeleteConfigMap(ctx context.Context, namespace string, name string) error
- func (k *K8sClient) DeleteNamespace(ctx context.Context, namespace string) error
- func (k *K8sClient) DeleteNamespaceAndWait(ctx context.Context, namespace, _ string, timeout time.Duration) error
- func (k *K8sClient) DeletePod(ctx context.Context, namespace, name string) error
- func (k *K8sClient) ExecCmdOnPod(ctx context.Context, rc *restclient.Config, pod *corev1.Pod, ...) (string, error)
- func (k *K8sClient) GetMetricsCmdFromPod(ctx context.Context, rc *restclient.Config, pod *corev1.Pod) (labels []string, fields []string, err error)
- func (k *K8sClient) GetNodeAllocatableGPUs(ctx context.Context, nodeName string) (int64, error)
- func (k *K8sClient) GetNodeNames(ctx context.Context) ([]string, error)
- func (k *K8sClient) GetNodesByLabel(ctx context.Context, labelMap map[string]string) ([]corev1.Node, error)
- func (k *K8sClient) GetPodLogs(ctx context.Context, namespace, podName string) (string, error)
- func (k *K8sClient) GetPodsByLabel(ctx context.Context, namespace string, labelMap map[string]string) ([]corev1.Pod, error)
- func (k *K8sClient) GetServiceByLabel(ctx context.Context, namespace string, labelMap map[string]string) ([]corev1.Service, error)
- func (k *K8sClient) NamespaceExists(ctx context.Context, namespace string) bool
- func (k *K8sClient) UpdateConfigMap(ctx context.Context, namespace string, name string, json string) error
- func (k *K8sClient) ValidatePod(ctx context.Context, namespace, podName string) error
- func (k *K8sClient) WaitForDaemonSetReady(ctx context.Context, namespace, name string, timeout time.Duration) error
- func (k *K8sClient) WaitForNodeLabel(ctx context.Context, labelKey, labelValue string, timeout time.Duration) error
- func (k *K8sClient) WaitForPodDeleted(ctx context.Context, namespace, podName string, timeout time.Duration) error
- func (k *K8sClient) WaitForPodSucceeded(ctx context.Context, namespace, podName string, timeout time.Duration) error
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 (*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 ¶
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 (*K8sClient) CreateNamespace ¶
func (*K8sClient) DeleteCertManagerKubeSystemRoles ¶
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 (*K8sClient) DeleteNamespace ¶
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) ExecCmdOnPod ¶
func (*K8sClient) GetMetricsCmdFromPod ¶
func (*K8sClient) GetNodeAllocatableGPUs ¶
GetNodeAllocatableGPUs returns the number of amd.com/gpu allocatable resources on a node. Returns -1 if the resource is not present.
func (*K8sClient) GetNodeNames ¶
GetNodeNames returns all node names in the cluster.
func (*K8sClient) GetNodesByLabel ¶
func (*K8sClient) GetPodLogs ¶
GetPodLogs returns the logs for a pod's first container.
func (*K8sClient) GetPodsByLabel ¶
func (*K8sClient) GetServiceByLabel ¶
func (*K8sClient) NamespaceExists ¶
func (*K8sClient) UpdateConfigMap ¶
func (*K8sClient) ValidatePod ¶
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.