k8s

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 23 Imported by: 1

Documentation

Overview

Package k8s: initialization, client, and misc. helpers

  • Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.

Package k8s: initialization, client, and misc. helpers

  • Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.

Package k8s: initialization, client, and misc. helpers

  • Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.

Package k8s: initialization, client, and misc. helpers

  • Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.

Index

Constants

View Source
const (
	Default = "default"
	Pod     = "pod"
	Svc     = "svc"
)

Variables

View Source
var (
	NodeName string // assign upon successful initialization

	ErrK8sRequired = errors.New("the operation requires Kubernetes")
)

Functions

func CleanName

func CleanName(name string) string

POD name (K8s doesn't allow `_` and uppercase)

func Init added in v1.3.22

func Init()

func InitMetricsClient added in v1.3.22

func InitMetricsClient()

func IsK8s added in v1.3.22

func IsK8s() bool

func Metrics added in v1.3.22

func Metrics(podName string) (float64, int64, error)

func ValidateEtlName added in v1.3.16

func ValidateEtlName(name string) error

Types

type Client

type Client interface {
	Create(v any) error
	Delete(entityType, entityName string) error
	CheckExists(entityType, entityName string) (bool, error)
	Pod(name string) (*corev1.Pod, error)
	Pods() (*corev1.PodList, error)
	Service(name string) (*corev1.Service, error)
	Logs(podName string) ([]byte, error)
	WatchPodEvents(podName string) (watch.Interface, error)
	Health(podName string) (string, error)
	CheckMetricsAvailability() error
}

Client is simplified version of default `kubernetes.Interface` client.

func GetClient

func GetClient() (Client, error)

func InitTestClient added in v1.4.0

func InitTestClient(namespace ...string) (Client, error)

InitTestClient initializes a K8s client for testing environments using kubeconfig. This is designed for use in Go tests running from shell environments with kubectl access.

type PodStatus added in v1.3.28

type PodStatus struct {
	State    string // "Waiting" | "Running" | "Terminated"
	CtrName  string // main container name
	Reason   string
	Message  string
	ExitCode int32
}

func (PodStatus) Error added in v1.3.30

func (ps PodStatus) Error() string

func (*PodStatus) String added in v1.3.28

func (ps *PodStatus) String() string

Jump to

Keyboard shortcuts

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