k8smeta

package
v0.0.0-...-4030fd3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// entity type
	POD                   = "pod"
	SERVICE               = "service"
	DEPLOYMENT            = "deployment"
	REPLICASET            = "replicaset"
	STATEFULSET           = "statefulset"
	DAEMONSET             = "daemonset"
	CRONJOB               = "cronjob"
	JOB                   = "job"
	NODE                  = "node"
	NAMESPACE             = "namespace"
	CONFIGMAP             = "configmap"
	PERSISTENTVOLUME      = "persistentvolume"
	PERSISTENTVOLUMECLAIM = "persistentvolumeclaim"
	STORAGECLASS          = "storageclass"
	INGRESS               = "ingress"
	CONTAINER             = "container"
	// entity link type
	//revive:disable:var-naming
	LINK_SPLIT_CHARACTER     = "->"
	POD_NODE                 = "pod->node"
	REPLICASET_DEPLOYMENT    = "replicaset->deployment"
	POD_REPLICASET           = "pod->replicaset"
	POD_STATEFULSET          = "pod->statefulset"
	POD_DAEMONSET            = "pod->daemonset"
	JOB_CRONJOB              = "job->cronjob"
	POD_JOB                  = "pod->job"
	POD_PERSISENTVOLUMECLAIN = "pod->persistentvolumeclaim"
	POD_CONFIGMAP            = "pod->configmap"
	POD_SERVICE              = "pod->service"
	POD_CONTAINER            = "pod->container"
	POD_PROCESS              = "pod->process"
)
View Source
const (
	EventTypeAdd            = "add"
	EventTypeUpdate         = "update"
	EventTypeDelete         = "delete"
	EventTypeDeferredDelete = "deferredDelete"
	EventTypeTimer          = "timer"
)

Variables

Functions

func GetMetaManagerMetrics

func GetMetaManagerMetrics() []map[string]string

Types

type DeferredDeletionMetaStore

type DeferredDeletionMetaStore struct {

	// cache
	Items map[string]*ObjectWrapper
	Index map[string][]string
	// contains filtered or unexported fields
}

func NewDeferredDeletionMetaStore

func NewDeferredDeletionMetaStore(eventCh chan *K8sMetaEvent, stopCh <-chan struct{}, gracePeriod int64, keyFunc cache.KeyFunc, indexRules ...IdxFunc) *DeferredDeletionMetaStore

func (*DeferredDeletionMetaStore) Get

func (*DeferredDeletionMetaStore) List

func (*DeferredDeletionMetaStore) RegisterSendFunc

func (m *DeferredDeletionMetaStore) RegisterSendFunc(key string, f SendFunc, interval int)

func (*DeferredDeletionMetaStore) Start

func (m *DeferredDeletionMetaStore) Start()

func (*DeferredDeletionMetaStore) UnRegisterSendFunc

func (m *DeferredDeletionMetaStore) UnRegisterSendFunc(key string)

type FlushCh

type FlushCh struct {
	Ch         chan *K8sMetaEvent
	ConfigName string
}

type IdxFunc

type IdxFunc func(obj interface{}) ([]string, error)

type JobCronJob

type JobCronJob struct {
	CronJob *batch.CronJob
	Job     *batch.Job
}

type K8sMetaEvent

type K8sMetaEvent struct {
	//revive:enable:exported
	EventType string
	Object    *ObjectWrapper
}

type LinkGenerator

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

func NewK8sMetaLinkGenerator

func NewK8sMetaLinkGenerator(metaCache map[string]MetaCache) *LinkGenerator
func (g *LinkGenerator) GenerateLinks(events []*K8sMetaEvent, linkType string) []*K8sMetaEvent

type MetaCache

type MetaCache interface {
	Get(key []string) map[string][]*ObjectWrapper
	GetSize() int
	GetQueueSize() int
	List() []*ObjectWrapper
	RegisterSendFunc(key string, sendFunc SendFunc, interval int)
	UnRegisterSendFunc(key string)
	// contains filtered or unexported methods
}

type MetaManager

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

func GetMetaManagerInstance

func GetMetaManagerInstance() *MetaManager

func (*MetaManager) Init

func (m *MetaManager) Init(configPath string) (err error)

func (*MetaManager) IsReady

func (m *MetaManager) IsReady() bool

func (*MetaManager) RegisterSendFunc

func (m *MetaManager) RegisterSendFunc(projectName, configName, resourceType string, sendFunc SendFunc, interval int)

func (*MetaManager) Run

func (m *MetaManager) Run(stopCh chan struct{})

func (*MetaManager) UnRegisterSendFunc

func (m *MetaManager) UnRegisterSendFunc(projectName, configName, resourceType string)

type NodePod

type NodePod struct {
	Node *v1.Node
	Pod  *v1.Pod
}

type ObjectWrapper

type ObjectWrapper struct {
	ResourceType      string
	Raw               interface{}
	FirstObservedTime int64
	LastObservedTime  int64
	Deleted           bool
}

type PodConfigMap

type PodConfigMap struct {
	Pod       *v1.Pod
	ConfigMap *v1.ConfigMap
}

type PodContainer

type PodContainer struct {
	Pod       *v1.Pod
	Container *v1.Container
}

type PodDaemonSet

type PodDaemonSet struct {
	DaemonSet *app.DaemonSet
	Pod       *v1.Pod
}

type PodJob

type PodJob struct {
	Job *batch.Job
	Pod *v1.Pod
}

type PodMetadata

type PodMetadata struct {
	Namespace    string            `json:"namespace"`
	WorkloadName string            `json:"workloadName"`
	WorkloadKind string            `json:"workloadKind"`
	ServiceName  string            `json:"serviceName"`
	Labels       map[string]string `json:"labels"`
	Envs         map[string]string `json:"envs"`
	Images       map[string]string `json:"images"`
	IsDeleted    bool              `json:"-"`
}

type PodPersistentVolumeClaim

type PodPersistentVolumeClaim struct {
	Pod                   *v1.Pod
	PersistentVolumeClaim *v1.PersistentVolumeClaim
}

type PodReplicaSet

type PodReplicaSet struct {
	ReplicaSet *app.ReplicaSet
	Pod        *v1.Pod
}

type PodService

type PodService struct {
	Service *v1.Service
	Pod     *v1.Pod
}

type PodStatefulSet

type PodStatefulSet struct {
	StatefulSet *app.StatefulSet
	Pod         *v1.Pod
}

type ReplicaSetDeployment

type ReplicaSetDeployment struct {
	Deployment *app.Deployment
	ReplicaSet *app.ReplicaSet
}

type SendFunc

type SendFunc func(events []*K8sMetaEvent)

type SendFuncWithStopCh

type SendFuncWithStopCh struct {
	SendFunc SendFunc
	StopCh   chan struct{}
}

type TimerEvent

type TimerEvent struct {
	ConfigName string
	Interval   int
}

Jump to

Keyboard shortcuts

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