nativekubernetes

package
v0.436.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

README

nativekubernetes package

Non object oriented implementation using the official client-go library to interact with kubernetes.

For the object oriented implmenetation see nativekubernetesoo.

Examples

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOnlyCombinedStreamAvailable = errors.New("specify the stream is not supported. Only combinded stream is availalbe by the kubernetes API, feature flag seems deactivated")

Functions

func CreatePod added in v0.436.0

func DeletePod added in v0.361.0

func DeletePod(ctx context.Context, clientset *kubernetes.Clientset, podName string, namespace string) error

func Exec added in v0.436.0

func GetClientSet

func GetClientSet(ctx context.Context, clusterName string) (*kubernetes.Clientset, error)

Get the kubernetes.Clientset to communicate with the kubernetes cluster.

If in cluster authentication is available (e.g. running in a pod in the cluster) the returned clientset uses this method.

Otherwise a clientset based on ~/.kube/config is returned.

clusterName is optional. If not specified the default cluster is taken.

func GetConfig added in v0.341.0

func GetConfig(ctx context.Context, clusterName string) (*rest.Config, error)

Get the rest.Config to communicate with the kubernetes cluster.

If in cluster authentication is available (e.g. running in a pod in the cluster) the returned config uses this method.

Otherwise a config based on ~/.kube/config is returned.

clusterName is optional. If not specified the default cluster is taken.

func GetConfigFromKubeconfig added in v0.341.0

func GetConfigFromKubeconfig(ctx context.Context, clusterName string) (*rest.Config, error)

func GetContainerAllLogs added in v0.361.0

func GetContainerAllLogs(ctx context.Context, clientset *kubernetes.Clientset, namespace string, podName string, containerName string) ([]byte, error)

'All' combines stdout and stderr.

func GetContainerLogs added in v0.361.0

func GetContainerLogs(ctx context.Context, clientset *kubernetes.Clientset, namespace string, podName string, containerName string) (stdout []byte, stderr []byte, err error)

func GetContainerStderrLogs added in v0.361.0

func GetContainerStderrLogs(ctx context.Context, clientset *kubernetes.Clientset, namespace string, podName string, containerName string) ([]byte, error)

func GetContainerStdoutLogs added in v0.361.0

func GetContainerStdoutLogs(ctx context.Context, clientset *kubernetes.Clientset, namespace string, podName string, containerName string) ([]byte, error)

func GetInClusterConfig added in v0.341.0

func GetInClusterConfig(ctx context.Context) (*rest.Config, error)

func PodExists added in v0.436.0

func PodExists(ctx context.Context, clientSet *kubernetes.Clientset, podName string, namespace string) (bool, error)

func RunCommandInTemporaryPod added in v0.361.0

func WaitForPodDeleted added in v0.436.0

func WaitForPodDeleted(ctx context.Context, clientset *kubernetes.Clientset, namespaceName string, podName string, timeout time.Duration) error

func WaitForPodRunning added in v0.436.0

func WaitForPodRunning(ctx context.Context, clientSet *kubernetes.Clientset, namespace string, podName string, timeout time.Duration) error

func WaitForPodSucceeded added in v0.436.0

func WaitForPodSucceeded(ctx context.Context, clientSet *kubernetes.Clientset, namespace string, podName string, timeout time.Duration) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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