kubernetes

package
v0.12.7 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: GPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SingleReplica      = 1
	SidecarPrefix      = "sidecar-"
	LabelKubeName      = "app.kubernetes.io/name"
	LabelKubeInstance  = "app.kubernetes.io/instance"
	LabelKubeVersion   = "app.kubernetes.io/version"
	LabelKubeManagedBy = "app.kubernetes.io/managed-by"
)

Variables

This section is empty.

Functions

func BuildJob added in v0.12.0

func BuildJob(opts *JobOpts) *batchv1.Job

func BuildLabels added in v0.8.1

func BuildLabels(name, instance, version string, extra map[string]string) map[string]string

func BuildResources added in v0.8.1

func BuildResources(opts *ResourcesOpts) (*appsv1.Deployment, *corev1.Service, error)

func NewInClusterKubeConfig added in v0.8.1

func NewInClusterKubeConfig() (*rest.Config, *kubernetes.Clientset, error)

func NewOutOfClusterKubeConfig added in v0.8.1

func NewOutOfClusterKubeConfig(configPath string) (*rest.Config, *kubernetes.Clientset, error)

func NormalizeKubeConfig added in v0.8.1

func NormalizeKubeConfig(configPath string) string

func ObjectToYaml added in v0.12.0

func ObjectToYaml(object runtime.Object) string

Types

type CopyPodOpts added in v0.12.0

type CopyPodOpts struct {
	Namespace     string
	PodName       string
	ContainerName string
	LocalPath     string
	RemotePath    string
}

type DeploymentCreateOpts

type DeploymentCreateOpts struct {
	Namespace             string
	Spec                  *appsv1.Deployment
	OnStatusEventCallback func(event string)
}

type DeploymentDetails added in v0.8.0

type DeploymentDetails struct {
	Info        *DeploymentInfo
	Created     time.Time
	Annotations map[string]string
}

type DeploymentInfo

type DeploymentInfo struct {
	Namespace string
	Name      string
	Healthy   bool
	PodInfo   *PodInfo
}

type JobCreateOpts added in v0.12.0

type JobCreateOpts struct {
	Namespace                    string
	Spec                         *batchv1.Job
	CaptureInterrupt             bool
	OnContainerInterruptCallback func(name string)
	OnStatusEventCallback        func(event string)
}

type JobOpts added in v0.12.0

type JobOpts struct {
	Namespace   string
	Name        string
	Annotations map[string]string
	Labels      map[string]string
	PodInfo     *PodInfo
}

type KubeClient

type KubeClient struct {
	// contains filtered or unexported fields
}

func NewKubeClient added in v0.8.0

func NewKubeClient(inCluster bool, configPath string) (*KubeClient, error)

func (*KubeClient) AppApi added in v0.8.0

func (client *KubeClient) AppApi() app.AppsV1Interface

func (*KubeClient) BatchApi added in v0.12.0

func (client *KubeClient) BatchApi() batch.BatchV1Interface

func (*KubeClient) Close

func (client *KubeClient) Close() error

func (*KubeClient) CopyToPod added in v0.12.0

func (client *KubeClient) CopyToPod(opts *CopyPodOpts) error

func (*KubeClient) CoreApi added in v0.8.0

func (client *KubeClient) CoreApi() core.CoreV1Interface

func (*KubeClient) DeploymentCreate

func (client *KubeClient) DeploymentCreate(opts *DeploymentCreateOpts) error

func (*KubeClient) DeploymentDelete

func (client *KubeClient) DeploymentDelete(namespace string, name string) error

func (*KubeClient) DeploymentDescribe added in v0.8.0

func (client *KubeClient) DeploymentDescribe(namespace string, name string) (*DeploymentDetails, error)

func (*KubeClient) DeploymentList

func (client *KubeClient) DeploymentList(namespace string, namePrefix string, labelSelector string) ([]DeploymentInfo, error)

func (*KubeClient) JobCreate added in v0.12.0

func (client *KubeClient) JobCreate(opts *JobCreateOpts) error

func (*KubeClient) JobDelete added in v0.12.0

func (client *KubeClient) JobDelete(namespace string, name string) error

func (*KubeClient) JobDescribe added in v0.12.0

func (client *KubeClient) JobDescribe(namespace string, name string) (*PodInfo, error)

func (*KubeClient) NamespaceApply

func (client *KubeClient) NamespaceApply(name string) error

func (*KubeClient) NamespaceDelete

func (client *KubeClient) NamespaceDelete(name string) error

func (*KubeClient) PodDescribeFromDeployment added in v0.12.0

func (client *KubeClient) PodDescribeFromDeployment(deployment *appsv1.Deployment) (*PodInfo, error)

func (*KubeClient) PodExecCommand added in v0.12.0

func (client *KubeClient) PodExecCommand(opts *PodExecOpts) error

func (*KubeClient) PodExecShell added in v0.12.0

func (client *KubeClient) PodExecShell(opts *PodExecOpts) error

func (*KubeClient) PodLogs added in v0.12.2

func (client *KubeClient) PodLogs(opts *PodLogsOpts) error

func (*KubeClient) PodLogsTee added in v0.12.0

func (client *KubeClient) PodLogsTee(opts *PodLogsOpts, logFileName string) error

func (*KubeClient) PodPortForward

func (client *KubeClient) PodPortForward(opts *PodPortForwardOpts) error

func (*KubeClient) RestApi added in v0.8.0

func (client *KubeClient) RestApi() *rest.Config

func (*KubeClient) SecretCreate added in v0.12.0

func (client *KubeClient) SecretCreate(namespace string, spec *corev1.Secret) error

func (*KubeClient) SecretDelete added in v0.12.0

func (client *KubeClient) SecretDelete(namespace string, name string) (bool, error)

func (*KubeClient) ServiceCreate

func (client *KubeClient) ServiceCreate(namespace string, spec *corev1.Service) error

func (*KubeClient) ServiceDelete

func (client *KubeClient) ServiceDelete(namespace string, name string) error

func (*KubeClient) ServiceDescribe added in v0.8.0

func (client *KubeClient) ServiceDescribe(namespace string, name string) (*ServiceInfo, error)

type KubeEnv added in v0.8.1

type KubeEnv struct {
	Key   string
	Value string
}

type KubePort added in v0.8.1

type KubePort struct {
	Name string
	Port string
}

type KubeResource

type KubeResource struct {
	Memory string
	Cpu    string
}

type PodExecOpts

type PodExecOpts struct {
	Namespace      string
	PodName        string
	ContainerName  string
	Commands       []string
	InStream       io.ReadCloser
	OutStream      io.Writer
	ErrStream      io.Writer
	IsTty          bool
	OnExecCallback func()
}

type PodInfo

type PodInfo struct {
	Namespace     string
	PodName       string
	ContainerName string
	ImageName     string
	Arguments     []string
	Env           []KubeEnv
	Resource      *KubeResource
}

type PodLogsOpts added in v0.12.0

type PodLogsOpts struct {
	Namespace     string
	PodName       string
	ContainerName string
	OutStream     io.Writer
}

type PodPortForwardOpts

type PodPortForwardOpts struct {
	Namespace             string
	PodName               string
	Ports                 []string // format "LOCAL:REMOTE"
	IsWait                bool
	OnTunnelStartCallback func()
	OnTunnelErrorCallback func(error)
}

type ResourcesOpts added in v0.8.1

type ResourcesOpts struct {
	Namespace   string
	Name        string
	Annotations map[string]string
	Labels      map[string]string
	Ports       []KubePort
	PodInfo     *PodInfo
}

type ServiceInfo added in v0.8.0

type ServiceInfo struct {
	Namespace string
	Name      string
	Ports     []KubePort
}

Jump to

Keyboard shortcuts

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