probe

package
v0.0.0-...-220305e Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonProbeProperties

type CommonProbeProperties struct {
	ProbeTimeout      string  `bson:"probe_timeout"`
	Interval          string  `bson:"interval"`
	PollingInterval   *string `bson:"polling_interval,omitempty"`
	InitialDelay      *string `bson:"initial_delay,omitempty"`
	EvaluationTimeout *string `bson:"evaluation_timeout,omitempty"`
	Retry             *int    `bson:"retry,omitempty"`
	Attempt           *int    `bson:"attempt,omitempty"`
	StopOnFailure     *bool   `bson:"stop_on_failure,omitempty"`
}

type Comparator

type Comparator struct {
	Type     string `bson:"type"`
	Value    string `bson:"value"`
	Criteria string `bson:"criteria"`
}

type ExecutionHistory

type ExecutionHistory struct {
	ExperimentID   string                     `bson:"experiment_id"`
	ExperimentName string                     `bson:"experiment_name"`
	UpdatedBy      mongodb.UserDetailResponse `bson:"updated_by"`
	ExecutionData  string                     `bson:"execution_data"`
	UpdatedAt      int                        `bson:"updated_at"`
	Probes         []Probes                   `bson:"probes"`
	Phase          model.ExperimentRunStatus  `bson:"phase"`
}

type GET

type GET struct {
	Criteria     string `bson:"criteria"`
	ResponseCode string `bson:"response_code"`
}

type K8SProbe

type K8SProbe struct {
	Group             *string `bson:"group,omitempty"`
	Version           string  `bson:"version"`
	Resource          string  `bson:"resource"`
	ResourceNames     *string `bson:"resourceNames,omitempty"`
	Namespace         *string `bson:"namespace,omitempty"`
	FieldSelector     *string `bson:"field_selector,omitempty"`
	LabelSelector     *string `bson:"label_selector,omitempty"`
	Operation         string  `bson:"operation"`
	ProbeTimeout      string  `bson:"probe_timeout"`
	Interval          string  `bson:"interval"`
	InitialDelay      *string `bson:"initial_delay,omitempty"`
	PollingInterval   *string `bson:"polling_interval,omitempty"`
	EvaluationTimeout *string `bson:"evaluation_timeout,omitempty"`
	Retry             *int    `bson:"retry,omitempty"`
	Attempt           *int    `bson:"attempt,omitempty"`
	StopOnFailure     *bool   `bson:"stop_on_failure,omitempty"`
}

type KubernetesCMDProbe

type KubernetesCMDProbe struct {
	Command           string                  `bson:"command"`
	ProbeTimeout      string                  `bson:"probe_timeout"`
	Interval          string                  `bson:"interval"`
	EvaluationTimeout *string                 `bson:"evaluation_timeout,omitempty"`
	PollingInterval   *string                 `bson:"polling_interval,omitempty"`
	InitialDelay      *string                 `bson:"initial_delay,omitempty"`
	Retry             *int                    `bson:"retry,omitempty"`
	Attempt           *int                    `bson:"attempt,omitempty"`
	Comparator        Comparator              `bson:"comparator"`
	Source            *v1alpha1.SourceDetails `bson:"source,omitempty"`
	StopOnFailure     *bool                   `bson:"stop_on_failure,omitempty"`
}

type KubernetesHTTPProbe

type KubernetesHTTPProbe struct {
	URL                string  `bson:"url"`
	ProbeTimeout       string  `bson:"probe_timeout"`
	Interval           string  `bson:"interval"`
	EvaluationTimeout  *string `bson:"evaluation_timeout,omitempty"`
	PollingInterval    *string `bson:"polling_interval,omitempty"`
	InitialDelay       *string `bson:"initial_delay,omitempty"`
	Retry              *int    `bson:"retry,omitempty"`
	Attempt            *int    `bson:"attempt,omitempty"`
	Method             Method  `bson:"method"`
	StopOnFailure      *bool   `bson:"stop_on_failure,omitempty"`
	InsecureSkipVerify *bool   `bson:"insecure_skip_verify,omitempty"`
}

type Method

type Method struct {
	GET  *GET  `bson:"get,omitempty"`
	POST *POST `bson:"post,omitempty"`
}

type Operator

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

Operator is the model for probe collection

func NewChaosProbeOperator

func NewChaosProbeOperator(mongodbOperator mongodb.MongoOperator) *Operator

NewChaosProbeOperator returns a new instance of Operator

func (*Operator) CreateProbe

func (p *Operator) CreateProbe(ctx context.Context, probe Probe) error

CreateProbe creates a probe of a specific type (HTTP, PROM, K8s or CMD) as a shared entity in the database

func (*Operator) GetAggregateProbes

func (p *Operator) GetAggregateProbes(ctx context.Context, pipeline mongo.Pipeline) (*mongo.Cursor, error)

GetAggregateProbes takes a mongo pipeline to retrieve the project details from the database

func (*Operator) GetProbeByName

func (p *Operator) GetProbeByName(ctx context.Context, probeName string, projectID string) (Probe, error)

GetProbeByName fetches the details of a single Probe with its Probe Name

func (*Operator) IsProbeUnique

func (p *Operator) IsProbeUnique(ctx context.Context, query bson.D) (bool, error)

IsProbeUnique returns true if probe is unique

func (*Operator) UpdateProbe

func (p *Operator) UpdateProbe(ctx context.Context, query bson.D, updateQuery bson.D) (*mongo.UpdateResult, error)

UpdateProbe updates details of a Probe

func (*Operator) UpdateProbes

func (p *Operator) UpdateProbes(ctx context.Context, query bson.D, updateQuery bson.D) (*mongo.UpdateResult, error)

UpdateProbes updates details of Probe

type POST

type POST struct {
	ContentType  *string `bson:"content_type,omitempty"`
	Body         *string `bson:"body,omitempty"`
	BodyPath     *string `bson:"body_path, omitempty"`
	Criteria     string  `bson:"criteria"`
	ResponseCode string  `bson:"response_code"`
}

type PROMProbe

type PROMProbe struct {
	Endpoint          string     `bson:"endpoint"`
	Query             *string    `bson:"query"`
	EvaluationTimeout *string    `bson:"evaluation_timeout,omitempty"`
	PollingInterval   *string    `bson:"polling_interval"`
	InitialDelay      *string    `bson:"initial_delay,omitempty"`
	QueryPath         *string    `bson:"query_path,omitempty"`
	ProbeTimeout      string     `bson:"probe_timeout"`
	Interval          string     `bson:"interval"`
	Retry             *int       `bson:"retry,omitempty"`
	Attempt           *int       `bson:"attempt,omitempty"`
	Comparator        Comparator `bson:"comparator"`
	StopOnFailure     *bool      `bson:"stop_on_failure,omitempty"`
}

type Probe

type Probe struct {
	ProjectID                string `bson:"project_id"`
	mongodb.ResourceDetails  `bson:",inline"`
	mongodb.Audit            `bson:",inline"`
	Type                     ProbeType                      `bson:"type"`
	InfrastructureType       model.InfrastructureType       `bson:"infrastructure_type"`
	KubernetesHTTPProperties *KubernetesHTTPProbe           `bson:"kubernetes_http_properties,omitempty"`
	KubernetesCMDProperties  *KubernetesCMDProbe            `bson:"kubernetes_cmd_properties,omitempty"`
	PROMProperties           *PROMProbe                     `bson:"prom_properties,omitempty"`
	K8SProperties            *K8SProbe                      `bson:"k8s_properties,omitempty"`
	RecentExecutions         []*model.ProbeRecentExecutions `bson:"recent_executions"`
	AverageSuccessPercentage float64                        `bson:"average_success_percentage"`
}

func (*Probe) GetOutputProbe

func (probe *Probe) GetOutputProbe() *model.Probe

GetOutputProbe

type ProbeResponseDetails

type ProbeResponseDetails struct {
	FaultName string `bson:"fault_name"`
}

type ProbeType

type ProbeType string

type ProbeWithExecutionHistory

type ProbeWithExecutionHistory struct {
	Probe            `bson:",inline"`
	ExecutionHistory []ExecutionHistory `bson:"execution_history"`
}

type Probes

type Probes struct {
	FaultName  string   `bson:"fault_name"`
	ProbeNames []string `bson:"probe_names"`
}

Jump to

Keyboard shortcuts

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