Documentation
¶
Overview ¶
Package k8s provides Kubernetes client utilities for loading configs and creating typed and dynamic clients.
Index ¶
- func DrainNode(ctx context.Context, kubeconfig, contextName, nodeName string) error
- func FormatAge(d time.Duration) string
- func LoadBaseModels(ctx context.Context, client dynamic.Interface) ([]models.BaseModel, error)
- func LoadDedicatedAIClusters(ctx context.Context, client dynamic.Interface) (map[string][]models.DedicatedAICluster, error)
- func LoadGpuNodes(ctx context.Context, clientset kubernetes.Interface) (map[string][]models.GpuNode, error)
- func NewClientsetFromKubeConfig(kubeconfig, ctx string) (kubernetes.Interface, error)
- func NewClientsetFromRestConfig(config *rest.Config) (kubernetes.Interface, error)
- func NewConfig(kubeconfig, ctx string) (*rest.Config, error)
- func NewDynamicClient(config *rest.Config) (dynamic.Interface, error)
- func NewDynamicClientFromKubeConfig(kubeconfig, ctx string) (dynamic.Interface, error)
- func ParseAge(s string) int64
- func ToggleCordon(ctx context.Context, kubeconfig, contextName, nodeName string) (bool, error)
- type PodCache
- type PodStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadBaseModels ¶ added in v0.1.4
LoadBaseModels returns all ClusterBaseModel CRs as a slice.
func LoadDedicatedAIClusters ¶
func LoadDedicatedAIClusters(ctx context.Context, client dynamic.Interface) (map[string][]models.DedicatedAICluster, error)
LoadDedicatedAIClusters loads DedicatedAICluster information using the provided DedicatedAIClusterLister.
func LoadGpuNodes ¶
func LoadGpuNodes(ctx context.Context, clientset kubernetes.Interface) (map[string][]models.GpuNode, error)
LoadGpuNodes returns a map of node pool names to slices of GpuNode. It fetches all GPU nodes and groups them by their node pool label.
func NewClientsetFromKubeConfig ¶ added in v0.1.4
func NewClientsetFromKubeConfig(kubeconfig, ctx string) (kubernetes.Interface, error)
NewClientsetFromKubeConfig creates a new Kubernetes clientset from a kubeconfig file and context. Returns an error if config loading or client creation fails.
func NewClientsetFromRestConfig ¶ added in v0.1.4
func NewClientsetFromRestConfig(config *rest.Config) (kubernetes.Interface, error)
NewClientsetFromRestConfig creates a new Kubernetes clientset from the given rest.Config. Returns an error if the config is nil or client creation fails.
func NewDynamicClient ¶ added in v0.1.4
NewDynamicClient creates a new dynamic Kubernetes client from the given rest.Config. Returns an error if the config is nil or client creation fails.
func NewDynamicClientFromKubeConfig ¶ added in v0.1.4
NewDynamicClientFromKubeConfig creates a new dynamic Kubernetes client from a kubeconfig file and context. Returns an error if config loading or client creation fails.