helper

package
v0.0.0-...-d7d4c15 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ProcVersionPath string = "/proc/version"

Variables

View Source
var ReleaseUnkonwErr = errors.New("Unkonw linux release")

Functions

This section is empty.

Types

type CHelper

type CHelper struct {
	ContainerHelper
	KClient   *kubernetes.Clientset
	PraseFunc ProcPraseFunc
}

CHelper Get container or pod information

func NewCHepler

func NewCHepler(ops *CHelperOps) *CHelper

func (*CHelper) GetContainers

func (c *CHelper) GetContainers(processInfo []*nvml.ProcessInfo) ([]*types.Container, error)

TODO: Implement Get Containers

func (*CHelper) GetK8sPods

func (c *CHelper) GetK8sPods(processesInfo []*nvml.ProcessInfo) ([]*PodGPUInfo, error)

func (*CHelper) GetPodMap

func (c *CHelper) GetPodMap() (map[string]v1.Pod, error)

type CHelperOps

type CHelperOps struct {
	KClient   *kubernetes.Clientset
	PraseFunc ProcPraseFunc
}

type ContainerHelper

type ContainerHelper interface {
	GetContainers(processInfo []*nvml.ProcessInfo) ([]*types.Container, error)
	GetK8sPods(processInfo []*nvml.ProcessInfo) ([]*PodGPUInfo, error)
}

type Phelper

type Phelper struct {
	ProcHelper
	// contains filtered or unexported fields
}

Phelper Register ProcPraseFunc and prase process's pid

func NewPhelper

func NewPhelper(pid uint, opt PhelperOpts) *Phelper

func (*Phelper) PraseProc

func (p *Phelper) PraseProc() (PidPraseOut, error)

type PhelperOpts

type PhelperOpts struct {
	PraseFunc ProcPraseFunc
}

type PidBindDocker

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

func (*PidBindDocker) GetDockerUid

func (o *PidBindDocker) GetDockerUid() (string, error)

func (*PidBindDocker) GetPodUid

func (o *PidBindDocker) GetPodUid() (string, error)

func (*PidBindDocker) SetDockerUid

func (o *PidBindDocker) SetDockerUid(uid string) error

func (*PidBindDocker) SetPodUid

func (o *PidBindDocker) SetPodUid(uid string) error

type PidBindK8sPod

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

PidBindK8sPod Parse output vector

func (*PidBindK8sPod) GetDockerUid

func (o *PidBindK8sPod) GetDockerUid() (string, error)

func (*PidBindK8sPod) GetPodUid

func (o *PidBindK8sPod) GetPodUid() (string, error)

func (*PidBindK8sPod) SetDockerUid

func (o *PidBindK8sPod) SetDockerUid(uid string) error

func (*PidBindK8sPod) SetPodUid

func (o *PidBindK8sPod) SetPodUid(uid string) error

type PidPraseOut

type PidPraseOut interface {
	GetPodUid() (string, error)
	GetDockerUid() (string, error)
	SetPodUid(uid string) error
	SetDockerUid(uid string) error
}

func DefaultProcPraserFunc

func DefaultProcPraserFunc(procInfo string) (PidPraseOut, error)

type PodGPUInfo

type PodGPUInfo struct {
	Pod         v1.Pod
	ProcessInfo *nvml.ProcessInfo
}

type ProcHelper

type ProcHelper interface {
	PraseProc() (PidPraseOut, error)
}

type ProcPraseFunc

type ProcPraseFunc func(procInfo string) (PidPraseOut, error)

ProcPraseFunc to prase the /proc/{pid}/cpuset

func (ProcPraseFunc) Prase

func (p ProcPraseFunc) Prase(procInfo string) (PidPraseOut, error)

type ProcPraser

type ProcPraser interface {
	Prase() error
}

type ProcType

type ProcType int
const (
	K8SPOD ProcType = iota
	DOCKER
	NATIVE
)

type Release

type Release int
const (
	UNKNOW Release = iota
	UBUNTU
	CENTOS
)

func GetHostRelease

func GetHostRelease() (Release, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳