store

package
v0.0.0-...-309b3d5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldType

type FieldType string
const (
	FieldTypeString FieldType = "string"
	FieldTypeInt    FieldType = "int"
	FieldTypeFloat  FieldType = "float"
)

type HTTPMetricConfig

type HTTPMetricConfig struct {
	MetricName string `json:"metricName"` // 指标名称
}

type InKubeConfig

type InKubeConfig struct {
	// Target is the target kube object, if is empty, means current pod
	Target        *TargetKubeObject   `json:"target,omitempty"`
	JsonPath      *string             `json:"jsonPath,omitempty"`      // JsonPatch中的路径
	AnnotationKey *string             `json:"annotationKey,omitempty"` // Pod 注解的键名
	LabelKey      *string             `json:"labelKey,omitempty"`      // Pod 注解的键名
	MarkerPolices []ProbeMarkerPolicy `json:"markerPolices,omitempty"` // 适用于 ProbeMarkerPolicy 的配置
	// contains filtered or unexported fields
}

InKubeConfig is the configuration for storing data in kube object

func (*InKubeConfig) GetPolicyOfState

func (c *InKubeConfig) GetPolicyOfState(state string) (*ProbeMarkerPolicy, bool)

func (*InKubeConfig) IsValid

func (c *InKubeConfig) IsValid() error

func (*InKubeConfig) Preprocess

func (c *InKubeConfig) Preprocess()

type JSONPathConfig

type JSONPathConfig struct {
	JSONPath  string    `json:"jsonPath"`  // JSONPath 表达式
	FieldType FieldType `json:"fieldType"` // 提取结果的数据类型
}

type PersistentConfig

type PersistentConfig struct {
	Type   string            `json:"type"`
	Result map[string]string `json:"result"`
}

func (*PersistentConfig) GetPersistenceInfo

func (p *PersistentConfig) GetPersistenceInfo() error

func (*PersistentConfig) SetPersistenceInfo

func (p *PersistentConfig) SetPersistenceInfo() error

type ProbeMarkerPolicy

type ProbeMarkerPolicy struct {
	// probe status,
	// For example: State=Succeeded, annotations[controller.kubernetes.io/pod-deletion-cost] = '10'.
	// State=Failed, annotations[controller.kubernetes.io/pod-deletion-cost] = '-10'.
	// In addition, if State=Failed is not defined, probe execution fails, and the annotations[controller.kubernetes.io/pod-deletion-cost] will be Deleted
	State string `json:"state"`
	// Patch Labels pod.labels
	Labels map[string]string `json:"labels,omitempty"`
	// Patch annotations pod.annotations
	Annotations map[string]string `json:"annotations,omitempty"`
}

ProbeMarkerPolicy convert prob value to user defined values

type Storage

type Storage interface {
	IsInitialized() bool
	SetupWithManager(mgr api.SidecarManager) error
	Store(data string, config interface{}) error
}

type StorageConfig

type StorageConfig struct {
	Type       StorageType       `json:"type"` // 存储类型
	InKube     *InKubeConfig     `json:"inKube,omitempty"`
	HTTPMetric *HTTPMetricConfig `json:"httpMetric,omitempty"` // 适用于 HTTP 指标的配
}

func (*StorageConfig) StoreData

func (s *StorageConfig) StoreData(factory StorageFactory, data string) error

type StorageFactory

type StorageFactory interface {
	GetStorage(storageType StorageType) (Storage, error)
}

func NewStorageFactory

func NewStorageFactory(mgr api.SidecarManager) StorageFactory

type StorageType

type StorageType string
const (
	// StorageTypeInKube represent store in kube object
	StorageTypeInKube     StorageType = "InKube"
	StorageTypeHTTPMetric StorageType = "HTTPMetric"
)

type TargetKubeObject

type TargetKubeObject struct {
	Group     string `json:"group,omitempty"`                  // CRD 中的 Group 名称
	Version   string `json:"version"`                          // CRD 中的版本
	Resource  string `json:"resource"`                         // CRD 中的 resource 名称,一般都是复数形式,比如pods
	Namespace string `json:"namespace,omitempty" parse:"true"` // CRD 中的 namespace 名称
	Name      string `json:"name" parse:"true"`                // CRD 中的名称
	PodOwner  bool   `json:"podOwner,omitempty"`               // 是否是 Pod 的拥有者
}

TargetKubeObject is the target kube object

func (*TargetKubeObject) IsValid

func (t *TargetKubeObject) IsValid() error

func (*TargetKubeObject) ToGvr

Jump to

Keyboard shortcuts

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