Documentation ¶
Index ¶
- Constants
- func GetTargetContainer(containerName string, status []corev1.ContainerStatus) (container *model.ContainerInfo, err error)
- func GetTargetContainers(containerReg string, status []corev1.ContainerStatus) (containers []model.ContainerInfo, err error)
- func SetupAnalyzer(apiServer client.Client)
- type Analyzer
- func (a *Analyzer) GetContainer(ctx context.Context, ns, podName, containerName string) (*model.ContainerObject, error)
- func (a *Analyzer) GetDaemonSetByName(ctx context.Context, namespace, name string) (*model.DaemonSetObject, error)
- func (a *Analyzer) GetDeploymentListByLabel(ctx context.Context, namespace string, label map[string]string) ([]*model.DeploymentObject, error)
- func (a *Analyzer) GetDeploymentListByName(ctx context.Context, namespace string, name []string) ([]*model.DeploymentObject, error)
- func (a *Analyzer) GetExperimentListByPhase(ctx context.Context, phase string) (*v1alpha1.ExperimentList, error)
- func (a *Analyzer) GetNodeListByLabel(ctx context.Context, label map[string]string, containerName string) ([]*model.NodeObject, error)
- func (a *Analyzer) GetNodeListByNodeIP(ctx context.Context, nodeIP []string, containerName string) ([]*model.NodeObject, error)
- func (a *Analyzer) GetNodeListByNodeName(ctx context.Context, nodeName []string, containerName string) ([]*model.NodeObject, error)
- func (a *Analyzer) GetPod(ctx context.Context, ns, podName, containerName string) (*model.PodObject, error)
- func (a *Analyzer) GetPodListByLabel(ctx context.Context, namespace string, label map[string]string, ...) ([]*model.PodObject, error)
- func (a *Analyzer) GetPodListByLabelInNode(ctx context.Context, namespace string, label map[string]string, nodeIP string) ([]*model.PodObject, error)
- func (a *Analyzer) GetPodListByPodName(ctx context.Context, namespace string, podName []string, containerName string) ([]*model.PodObject, error)
- type IAnalyzer
Constants ¶
View Source
const ( HostIPKey = ".status.hostIP" PhaseKey = ".status.phase" )
Variables ¶
This section is empty.
Functions ¶
func GetTargetContainer ¶
func GetTargetContainer(containerName string, status []corev1.ContainerStatus) (container *model.ContainerInfo, err error)
func GetTargetContainers ¶
func GetTargetContainers(containerReg string, status []corev1.ContainerStatus) (containers []model.ContainerInfo, err error)
func SetupAnalyzer ¶
Types ¶
type Analyzer ¶
func (*Analyzer) GetContainer ¶
func (a *Analyzer) GetContainer(ctx context.Context, ns, podName, containerName string) (*model.ContainerObject, error)
func (a *Analyzer) GetNodeListByNodeIP(ctx context.Context, nodeIP []string, containerName string) ([]*model.NodeObject, error) { var nodeIPMap = make(map[string]bool) var result []*model.NodeObject for _, unit := range nodeIP { if !nodeIPMap[unit] { nodeIPMap[unit] = true tmpNode := &model.NodeObject{ NodeInternalIP: unit, } if containerName != "" { r, id, err := model.ParseContainerID(containerName) if err != nil { return nil, fmt.Errorf("parse container info error: %s", err.Error()) } tmpNode.ContainerRuntime, tmpNode.ContainerID = r, id } result = append(result, tmpNode) } } return result, nil }
func (*Analyzer) GetDaemonSetByName ¶
func (*Analyzer) GetDeploymentListByLabel ¶
func (*Analyzer) GetDeploymentListByName ¶
func (*Analyzer) GetExperimentListByPhase ¶
func (*Analyzer) GetNodeListByLabel ¶
func (a *Analyzer) GetNodeListByLabel(ctx context.Context, label map[string]string, containerName string) ([]*model.NodeObject, error)
GetNodeListByLabel return all node when label is empty map or nil
func (*Analyzer) GetNodeListByNodeIP ¶
func (a *Analyzer) GetNodeListByNodeIP(ctx context.Context, nodeIP []string, containerName string) ([]*model.NodeObject, error)
GetNodeListByNodeIP In order to support non-k8s machines, so do not filter from apiServer
func (*Analyzer) GetNodeListByNodeName ¶
func (*Analyzer) GetPodListByLabel ¶
func (*Analyzer) GetPodListByLabelInNode ¶
type IAnalyzer ¶
type IAnalyzer interface { GetExperimentListByPhase(ctx context.Context, phase string) (*v1alpha1.ExperimentList, error) GetContainer(ctx context.Context, ns, podName, containerName string) (*model.ContainerObject, error) GetPod(ctx context.Context, ns, podName, containerName string) (*model.PodObject, error) GetPodListByLabelInNode(ctx context.Context, namespace string, label map[string]string, nodeIP string) ([]*model.PodObject, error) GetPodListByLabel(ctx context.Context, namespace string, label map[string]string, containerName string) ([]*model.PodObject, error) GetPodListByPodName(ctx context.Context, namespace string, podName []string, containerName string) ([]*model.PodObject, error) GetNodeListByLabel(ctx context.Context, label map[string]string, containerName string) ([]*model.NodeObject, error) GetNodeListByNodeName(ctx context.Context, nodeName []string, containerName string) ([]*model.NodeObject, error) GetNodeListByNodeIP(ctx context.Context, nodeIP []string, containerName string) ([]*model.NodeObject, error) GetDeploymentListByLabel(ctx context.Context, namespace string, label map[string]string) ([]*model.DeploymentObject, error) GetDeploymentListByName(ctx context.Context, namespace string, name []string) ([]*model.DeploymentObject, error) GetDaemonSetByName(ctx context.Context, namespace string, name string) (*model.DaemonSetObject, error) }
func GetAnalyzer ¶
func GetAnalyzer() IAnalyzer
Click to show internal directories.
Click to hide internal directories.