k8sutil

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

k8sutil is utilites to operate the k8s clusters

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClusterConfig

func BuildClusterConfig(masterURL, kubeconfigPath string) (*rest.Config, error)

BuildClusterConfig returns a config from masterUrl or kubeconfigPath, kubeconfigPath default is ~/.kube/config

func CascadeDeleteOptions

func CascadeDeleteOptions(gracePeriodSeconds int64) *metav1.DeleteOptions

func CreateOrUpdateEndpoints

func CreateOrUpdateEndpoints(eclient clientv1.EndpointsInterface, eps *corev1.Endpoints) error

CreateOrUpdateEndpoints creates or updates the endpoints

func CreateOrUpdateService

func CreateOrUpdateService(sclient clientv1.ServiceInterface, svc *corev1.Service) error

CreateOrUpdateService creates or updates the given service

func CreatePatch

func CreatePatch(o, n, datastruct interface{}) ([]byte, error)

func CreateRecorder

func CreateRecorder(kubecli kubernetes.Interface, name, namespace string) record.EventRecorder

CreateRecorder returns a new event recorder

func IsResourceNotFoundError

func IsResourceNotFoundError(err error) bool

IsResourceNotFoundError checks if it is a NotFoundError

func PatchDeployment

func PatchDeployment(kubecli kubernetes.Interface, namespace, name string, updateFunc func(*appsv1.Deployment)) error

func PodRunningAndReady

func PodRunningAndReady(pod corev1.Pod) (bool, error)

PodRunningAndReady returns whether a pod is running and each container has passed it's ready state.

Types

type Tunnel

type Tunnel struct {
	Local     int
	Remote    int
	Namespace string
	PodName   string
	Out       io.Writer
	// contains filtered or unexported fields
}

Tunnel describes a ssh-like tunnel to a kubernetes pod

func NewTunnel

func NewTunnel(client rest.Interface, config *rest.Config, namespace, podName string, remote int) *Tunnel

NewTunnel creates a new tunnel

func (*Tunnel) Close

func (t *Tunnel) Close()

Close disconnects a tunnel connection

func (*Tunnel) ForwardPort

func (t *Tunnel) ForwardPort() error

ForwardPort opens a tunnel to a kubernetes pod

Jump to

Keyboard shortcuts

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