kube

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodPending   PodStatus = "Pending"
	PodRunning             = "Running"
	PodSucceeded           = "Succeeded"
	PodFailed              = "Failed"
	PodUnknown             = "Unknown"
)

pod Pod.Status.Phase

Variables

This section is empty.

Functions

func NewPod

func NewPod(name, ip string, status PodStatus) (*v1.Pod, error)

NewPod new a k8s pod.

Types

type MiniKube

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

MiniKube miniKube主要功能: 1. 创建 pod 可以 调用 cni 插件 add 并打印相关信息 2. 删除 pod 可以调用 cni 插件 del 3. 获取 pod 列表

func NewMiniKube

func NewMiniKube(cli *clientv3.Client, opts ...Option) (*MiniKube, error)

NewMiniKube 声明新的kube client.

Use demo: miniKube,err:=NewMiniKube(etcdCli,WithDBKeyPrefix("/test/db/prefix"))

func (*MiniKube) AddPod

func (m *MiniKube) AddPod(namespace string, pod *v1.Pod, cni bool) error

AddPod 添加一个 pod 并且 支持 同时调用cni add. namespace: 命名空间 pod: pod 信息 cni: 是否调用cni

func (*MiniKube) DelPod

func (m *MiniKube) DelPod(namespace string, podName string, cni bool) error

DelPod 删除pod namespace: 命名空间 podName: pod 名称 cni: 是否调用cni

func (*MiniKube) GetAllPod

func (m *MiniKube) GetAllPod() ([]*v1.Pod, error)

GetAllPod 獲取所有的pod。

func (*MiniKube) GetPod

func (m *MiniKube) GetPod(namespace, podName string) (*v1.Pod, error)

GetPod 获取一个pod 信息 namespace :命名空间 podName : pod name

func (*MiniKube) GetPodByNamespace

func (m *MiniKube) GetPodByNamespace(namespace string) ([]*v1.Pod, error)

GetPodByNamespace GetAllPod 獲取namespace所有pod. namespace: 命名空間.

type Option

type Option func(*MiniKube) error

func WithDBKeyPrefix

func WithDBKeyPrefix(prefix string) Option

WithDBKeyPrefix 设置前缀.

func WithEtcdClient

func WithEtcdClient(cli *clientv3.Client) Option

WithEtcdClient 设置客户端.

type PodStatus

type PodStatus string

Jump to

Keyboard shortcuts

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