kube

package
v0.0.0-...-5032473 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InClusterAuth    = "inCluster"
	OutOfClusterAuth = "outOfCluster"
	LeaseRun         = leaderelection.RunOrDie
)

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Type     string
	Token    string
	FilePath string
	CAFile   string
	RestConf *rest.Config
}

type Config

type Config struct {
	Namespace string
	URL       string
	Auth

	metav1.ListOptions

	Fetch
}

type DeploymentClient

type DeploymentClient interface {
	Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1.Deployment, error)
}

type EventClient

type EventClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.EventList, error)
}

type Fetch

type Fetch struct {
	Interval int
	Retry    int
}

type Helper

type Helper struct {
	EventClient
	PodClient
	DeploymentClient
	NamespaceClient
	NodeClient
	SVCClient

	LeaseClient
	LeaseID       string
	LeaseCallback leaderelection.LeaderCallbacks

	Config
	// contains filtered or unexported fields
}

func (*Helper) GetDeployment

func (h *Helper) GetDeployment(name string) (*appsv1.Deployment, error)

func (*Helper) GetNode

func (h *Helper) GetNode(name string) (*corev1.Node, error)

func (*Helper) GetNodeIP

func (h *Helper) GetNodeIP(nodeName string, addrType string) (string, error)

func (*Helper) GetSVC

func (h *Helper) GetSVC(name string) (*corev1.Service, error)

func (*Helper) GetSVCNodePortByTargetPort

func (h *Helper) GetSVCNodePortByTargetPort(svcName string, targetPort int) (int, error)

func (*Helper) IsNamespaceExist

func (h *Helper) IsNamespaceExist(namespace string) bool

func (*Helper) ListEvent

func (h *Helper) ListEvent(opt metav1.ListOptions) (*corev1.EventList, error)

func (*Helper) ListPod

func (h *Helper) ListPod(opt metav1.ListOptions) (*corev1.PodList, error)

func (*Helper) RunLeaseCron

func (h *Helper) RunLeaseCron(ctx *context.Context)

func (*Helper) SetDeploymentClient

func (h *Helper) SetDeploymentClient()

func (*Helper) SetEventClient

func (h *Helper) SetEventClient()

func (*Helper) SetKubeAuth

func (h *Helper) SetKubeAuth()

func (*Helper) SetLeaseClient

func (h *Helper) SetLeaseClient(id string, name string, namespace string)

func (*Helper) SetLeaseCron

func (h *Helper) SetLeaseCron(schedule func())

func (*Helper) SetNamespaceClient

func (h *Helper) SetNamespaceClient()

func (*Helper) SetNodeClient

func (h *Helper) SetNodeClient()

func (*Helper) SetPodClient

func (h *Helper) SetPodClient()

func (*Helper) SetSVCClient

func (h *Helper) SetSVCClient()

type NamespaceClient

type NamespaceClient interface {
	Get(context.Context, string, metav1.GetOptions) (*v1.Namespace, error)
}

type NodeClient

type NodeClient interface {
	Get(context.Context, string, metav1.GetOptions) (*corev1.Node, error)
}

type PodClient

type PodClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.PodList, error)
}

type SVCClient

type SVCClient interface {
	Get(context.Context, string, metav1.GetOptions) (*corev1.Service, error)
}

Jump to

Keyboard shortcuts

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