xsearch

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodDeleteMileStoneIndex = "pod_delete_milestone_cache"
	PodDeleteMileStoneType  = "_doc"
)

Variables

This section is empty.

Functions

func DeleteAllPodDeleteMilestone

func DeleteAllPodDeleteMilestone(cluster string) *utils.SafeMap

删除所有 podDeleteMileStone

func EnsureIndex

func EnsureIndex(client *elastic.Client, index, mapping string) error

EnsureIndex to check if an index exists, create it if not exists.

func EnsurePipeline

func EnsurePipeline(client *elastic.Client, index, mapping string) error

func GetAllPodDeleteMilestoneByScroll

func GetAllPodDeleteMilestoneByScroll(cluster string) (*utils.SafeMap, error)

获取所有 PodDeleteMilestone

func GetIndexNameForPodDeleteMileStone

func GetIndexNameForPodDeleteMileStone(cluster string) string

func GetSloPodInfoIndexByDocID

func GetSloPodInfoIndexByDocID(docID string) string

查询一个 PodInfo 所属于的 Index 由于 slo_pod_info 是天级别的索引,需要先找到这个 docID 对应的索引名称,然后再写入

func GetXSearchClient

func GetXSearchClient() *elastic.Client

func InitSloPodInfo

func InitSloPodInfo(cluster string, podInfoCacheUid utils.LRU) error

查询 SLO Pod

func InitZsearch

func InitZsearch(zsearchEndPoint, username, password string, extraInfo interface{})

func SaveDeleteSloMilestoneMapToZsearch

func SaveDeleteSloMilestoneMapToZsearch(podDeleteMileStoneMap *utils.SafeMap)

func SaveNodeYaml

func SaveNodeYaml(cluster string, node *corev1.Node, t time.Time, auditID string) error

func SavePodInfoToZSearch

func SavePodInfoToZSearch(cluster string, pod *corev1.Pod, deliveryStatus string, currentTime time.Time, auditID string, deliveryProgress string, isUpdate bool) error

func SavePodLifePhase

func SavePodLifePhase(clusterName string, namespace string, podUID string, podName string, operationName string,
	hasErr bool, startTime, endTime time.Time, extraInfo map[string]interface{}, dataSourceID string) error

func SavePodYaml

func SavePodYaml(cluster string, pod *corev1.Pod, t time.Time, auditID string, isBeginDelete, isDeleted bool) error

func SaveSloData

func SaveSloData(cluster string, namespace string, podName string, podUID string, sloType string, sloData []byte) error

func SaveSloTraceData

func SaveSloTraceData(cluster string, namespace string, name string, uid string, sloType string, sloData []byte) error

func Scroll

func Scroll(client *elastic.Client, index string, query elastic.Query, f func(json.RawMessage) error, workers int) error

Scroll use scroll service to query multiple documents from es.

Types

type Cleaner

type Cleaner []func()
var (
	XSearchClear Cleaner
)

func (*Cleaner) AddCleanWork

func (c *Cleaner) AddCleanWork(w func())

func (*Cleaner) DoClear

func (c *Cleaner) DoClear()

type CondLocker

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

type ElasticSearchConf

type ElasticSearchConf struct {
	Endpoint string
	User     string
	Password string
	Index    string
	Type     string
}
var EsConfig *ElasticSearchConf

type PodDeleteMileStone

type PodDeleteMileStone struct {
	Cluster             string
	Namespace           string
	PodName             string
	PodUID              string
	Type                string
	TrigerAuditLog      string
	NodeIP              string
	DeleteResult        string //删除结果:success、failed reason
	KubeletKillingHost  string
	DebugUrl            string
	HostingStatus       string //删除托管状态
	CreatedTime         time.Time
	DeleteEndTime       time.Time
	KubeletKillingTime  time.Time
	LifeDuration        time.Duration // DeletionTimeStamp - CreationTimeStamp
	RemainingFinalizers []string
	DeleteTimeoutTime   time.Time
	IsJob               bool
	Key                 string
	Mutex               sync.Mutex
}

pod删除SLO相关

type PodYamlDic

type PodYamlDic struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

SavePodYaml save pod yaml

type SloPodInfo

type SloPodInfo struct {
	PodUid         string `json:"podUID"`
	PodName        string `json:"podName"`
	DeliveryStatus string `json:"deliveryStatus"`
}

Jump to

Keyboard shortcuts

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