Documentation ¶
Index ¶
- type ArchiveExperiment
- func (e *ArchiveExperiment) ParseIOChaos() (ExperimentInfo, error)
- func (e *ArchiveExperiment) ParseKernelChaos() (ExperimentInfo, error)
- func (e *ArchiveExperiment) ParseNetworkChaos() (ExperimentInfo, error)
- func (e *ArchiveExperiment) ParsePodChaos() (ExperimentInfo, error)
- func (e *ArchiveExperiment) ParseStressChaos() (ExperimentInfo, error)
- func (e *ArchiveExperiment) ParseTimeChaos() (ExperimentInfo, error)
- type ArchiveExperimentMeta
- type Event
- type EventStore
- type ExperimentInfo
- type ExperimentStore
- type Filter
- type IOChaosInfo
- type KernelChaosInfo
- type NetworkChaosInfo
- type PodChaosInfo
- type PodRecord
- type SchedulerInfo
- type ScopeInfo
- type SelectorInfo
- type StressChaosInfo
- type TargetInfo
- type TimeChaosInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArchiveExperiment ¶
type ArchiveExperiment struct { ArchiveExperimentMeta Experiment string `gorm:"size:2048"` }
ArchiveExperiment represents an experiment instance.
func (*ArchiveExperiment) ParseIOChaos ¶
func (e *ArchiveExperiment) ParseIOChaos() (ExperimentInfo, error)
func (*ArchiveExperiment) ParseKernelChaos ¶
func (e *ArchiveExperiment) ParseKernelChaos() (ExperimentInfo, error)
func (*ArchiveExperiment) ParseNetworkChaos ¶
func (e *ArchiveExperiment) ParseNetworkChaos() (ExperimentInfo, error)
func (*ArchiveExperiment) ParsePodChaos ¶
func (e *ArchiveExperiment) ParsePodChaos() (ExperimentInfo, error)
func (*ArchiveExperiment) ParseStressChaos ¶
func (e *ArchiveExperiment) ParseStressChaos() (ExperimentInfo, error)
func (*ArchiveExperiment) ParseTimeChaos ¶
func (e *ArchiveExperiment) ParseTimeChaos() (ExperimentInfo, error)
type ArchiveExperimentMeta ¶
type ArchiveExperimentMeta struct { ID uint `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `sql:"index" json:"deleted_at"` Name string `json:"name"` Namespace string `json:"namespace"` Kind string `json:"kind"` Action string `json:"action"` UID string `gorm:"index:uid" json:"uid"` StartTime time.Time `json:"start_time"` FinishTime time.Time `json:"finish_time"` Archived bool `json:"archived"` }
ArchiveExperimentMeta defines the meta data for ArchiveExperiment.
type Event ¶
type Event struct { ID uint `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `sql:"index" json:"deleted_at"` Experiment string `gorm:"index:experiment" json:"experiment"` Namespace string `json:"namespace"` Kind string `json:"kind"` Message string `json:"message"` StartTime *time.Time `gorm:"index:start_time" json:"start_time"` FinishTime *time.Time `json:"finish_time"` Duration string `json:"duration"` Pods []*PodRecord `gorm:"-" json:"pods"` ExperimentID string `gorm:"index:experiment_id" json:"experiment_id"` }
Event represents an event instance.
type EventStore ¶
type EventStore interface { // List returns an event list from the datastore. List(context.Context) ([]*Event, error) // ListByFilter returns an event list by podName, podNamespace, experimentName, experimentNamespace, uid, kind, startTime and finishTime. ListByFilter(context.Context, Filter) ([]*Event, error) // ListByExperiment returns an event list by the name and namespace of the experiment. ListByExperiment(context.Context, string, string) ([]*Event, error) // ListByNamespace returns an event list by the namespace of the pod. ListByNamespace(context.Context, string) ([]*Event, error) // ListByPod returns an event list by the name and namespace of the pod. ListByPod(context.Context, string, string) ([]*Event, error) // ListByUID returns an event list by the UID. ListByUID(context.Context, string) ([]*Event, error) // DryListByFilter returns an event list by experimentName, experimentNamespace, uid, kind, startTime and finishTime. DryListByFilter(context.Context, Filter) ([]*Event, error) // Find returns an event from the datastore by ID. Find(context.Context, uint) (*Event, error) // FindByExperimentAndStartTime returns an event by the experiment and start time. FindByExperimentAndStartTime(context.Context, string, string, *time.Time) (*Event, error) // Create persists a new event to the datastore. Create(context.Context, *Event) error // Update persists an updated event to the datastore. Update(context.Context, *Event) error // DeleteIncompleteEvent deletes all incomplete events. // If the chaos-dashboard was restarted, some incomplete events would be stored in datastore, // which means the event would never save the finish_time. // DeleteIncompleteEvent can be used to delete all incomplete events to avoid this case. DeleteIncompleteEvents(context.Context) error // DeleteByFinishTime deletes events and podrecords whose time difference is greater than the given time from FinishTime. DeleteByFinishTime(context.Context, time.Duration) error // UpdateIncompleteEvents updates the incomplete event by the namespace and name // If chaos is deleted before an event is over, then the incomplete event would be stored in datastore, // which means the event would never save the finish_time. // UpdateIncompleteEvents can update the finish_time when the chaos is deleted. UpdateIncompleteEvents(context.Context, string, string) error }
EventStore defines operations for working with event.
type ExperimentInfo ¶
type ExperimentInfo struct { Name string `json:"name" binding:"required,NameValid"` Namespace string `json:"namespace" binding:"required,NameValid"` Labels map[string]string `json:"labels" binding:"MapSelectorsValid"` Annotations map[string]string `json:"annotations" binding:"MapSelectorsValid"` Scope ScopeInfo `json:"scope"` Target TargetInfo `json:"target"` Scheduler SchedulerInfo `json:"scheduler"` }
ExperimentInfo defines a form data of Experiment from API.
type ExperimentStore ¶
type ExperimentStore interface { // List returns an archive experiment list from the datastore. List(ctx context.Context, kind, namespace, name string) ([]*ArchiveExperiment, error) // ListMeta returns an archive experiment metadata list from the datastore. ListMeta(ctx context.Context, kind, namespace, name string) ([]*ArchiveExperimentMeta, error) // Find returns an archive experiment by ID. Find(context.Context, int64) (*ArchiveExperiment, error) // Delete deletes the experiment from the datastore. Delete(context.Context, *ArchiveExperiment) error // DetailList returns a list of archive experiments from the datastore. DetailList(ctx context.Context, kind, namespace, name, uid string) ([]*ArchiveExperiment, error) // DeleteByFinishTime deletes experiments whose time difference is greater than the given time from FinishTime. DeleteByFinishTime(context.Context, time.Duration) error // Archive archives experiments whose "archived" field is false, Archive(ctx context.Context, namespace, name string) error // Set sets the experiment. Set(context.Context, *ArchiveExperiment) error // FindByUID returns an experiment record by the UID of the experiment. FindByUID(ctx context.Context, UID string) (*ArchiveExperiment, error) // FindMetaByUID returns an archive experiment by UID. FindMetaByUID(context.Context, string) (*ArchiveExperimentMeta, error) // DeleteIncompleteExperiments deletes all incomplete experiments. // If the chaos-dashboard was restarted and the experiment is completed during the restart, // which means the experiment would never save the finish_time. // DeleteIncompleteExperiments can be used to delete all incomplete experiments to avoid this case. DeleteIncompleteExperiments(context.Context) error }
ExperimentStore defines operations for working with archive experiments
type Filter ¶
type Filter struct { PodName string PodNamespace string StartTimeStr string FinishTimeStr string ExperimentName string ExperimentNamespace string UID string Kind string LimitStr string }
Filter represents the filter to list events
type IOChaosInfo ¶
type IOChaosInfo struct { Action string `json:"action" binding:"oneof='' 'latency' 'fault' 'attrOverride'"` Delay string `json:"delay"` Errno uint32 `json:"errno"` Attr *v1alpha1.AttrOverrideSpec `json:"attr"` Path string `json:"path"` Percent int `json:"percent"` Methods []v1alpha1.IoMethod `json:"methods"` VolumePath string `json:"volume_path"` }
IOChaosInfo defines the basic information of io chaos for creating a new IOChaos.
type KernelChaosInfo ¶
type KernelChaosInfo struct {
FailKernRequest v1alpha1.FailKernRequest `json:"fail_kern_request"`
}
KernelChaosInfo defines the basic information of kernel chaos for creating a new KernelChaos.
type NetworkChaosInfo ¶
type NetworkChaosInfo struct { Action string `json:"action" binding:"oneof='' 'netem' 'delay' 'loss' 'duplicate' 'corrupt' 'partition' 'bandwidth'"` Delay *v1alpha1.DelaySpec `json:"delay" binding:"RequiredFieldEqual=Action:delay"` Loss *v1alpha1.LossSpec `json:"loss" binding:"RequiredFieldEqual=Action:loss"` Duplicate *v1alpha1.DuplicateSpec `json:"duplicate" binding:"RequiredFieldEqual=Action:duplicate"` Corrupt *v1alpha1.CorruptSpec `json:"corrupt" binding:"RequiredFieldEqual=Action:corrupt"` Bandwidth *v1alpha1.BandwidthSpec `json:"bandwidth" binding:"RequiredFieldEqual=Action:bandwidth"` Direction string `json:"direction" binding:"oneof='' 'to' 'from' 'both'"` TargetScope *ScopeInfo `json:"target"` }
NetworkChaosInfo defines the basic information of network chaos for creating a new NetworkChaos.
type PodChaosInfo ¶
type PodChaosInfo struct { Action string `json:"action" binding:"oneof='' 'pod-kill' 'pod-failure' 'container-kill'"` ContainerName string `json:"container_name"` }
PodChaosInfo defines the basic information of pod chaos for creating a new PodChaos.
type PodRecord ¶
type PodRecord struct { ID uint `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `sql:"index" json:"deleted_at"` EventID uint `gorm:"index:event_id" json:"event_id"` PodIP string `gorm:"index:pod_id" json:"pod_ip"` PodName string `json:"pod_name"` Namespace string `json:"namespace"` Message string `json:"message"` Action string `json:"action"` }
PodRecord represents a pod record with event ID.
type SchedulerInfo ¶
type SchedulerInfo struct { Cron string `json:"cron" binding:"CronValid"` Duration string `json:"duration" binding:"DurationValid"` }
SchedulerInfo defines the scheduler information.
type ScopeInfo ¶
type ScopeInfo struct { SelectorInfo Mode string `json:"mode" binding:"oneof='' 'one' 'all' 'fixed' 'fixed-percent' 'random-max-percent'"` Value string `json:"value" binding:"ValueValid"` }
ScopeInfo defines the scope of the Experiment.
type SelectorInfo ¶
type SelectorInfo struct { NamespaceSelectors []string `json:"namespace_selectors" binding:"NamespaceSelectorsValid"` LabelSelectors map[string]string `json:"label_selectors" binding:"MapSelectorsValid"` AnnotationSelectors map[string]string `json:"annotation_selectors" binding:"MapSelectorsValid"` FieldSelectors map[string]string `json:"field_selectors" binding:"MapSelectorsValid"` PhaseSelector []string `json:"phase_selectors" binding:"PhaseSelectorsValid"` // Pods is a map of string keys and a set values that used to select pods. // The key defines the namespace which pods belong, // and the each values is a set of pod names. Pods map[string][]string `json:"pods" binding:"PodsValid"` }
TODO: consider moving this to a common package SelectorInfo defines the selector options of the Experiment.
func (*SelectorInfo) ParseSelector ¶
func (s *SelectorInfo) ParseSelector() v1alpha1.SelectorSpec
ParseSelector parses SelectorInfo to v1alpha1.SelectorSpec
type StressChaosInfo ¶
type StressChaosInfo struct { Stressors *v1alpha1.Stressors `json:"stressors"` StressngStressors string `json:"stressng_stressors,omitempty"` ContainerName *string `json:"container_name,omitempty"` }
StressChaosInfo defines the basic information of stress chaos for creating a new StressChaos.
type TargetInfo ¶
type TargetInfo struct { Kind string `json:"kind" binding:"required,oneof=PodChaos NetworkChaos IoChaos KernelChaos TimeChaos StressChaos"` PodChaos *PodChaosInfo `json:"pod_chaos,omitempty" binding:"RequiredFieldEqual=Kind:PodChaos"` NetworkChaos *NetworkChaosInfo `json:"network_chaos,omitempty" binding:"RequiredFieldEqual=Kind:NetworkChaos"` IOChaos *IOChaosInfo `json:"io_chaos,omitempty" binding:"RequiredFieldEqual=Kind:IoChaos"` KernelChaos *KernelChaosInfo `json:"kernel_chaos,omitempty" binding:"RequiredFieldEqual=Kind:KernelChaos"` TimeChaos *TimeChaosInfo `json:"time_chaos,omitempty" binding:"RequiredFieldEqual=Kind:TimeChaos"` StressChaos *StressChaosInfo `json:"stress_chaos,omitempty" binding:"RequiredFieldEqual=Kind:StressChaos"` }
TargetInfo defines the information of target objects.
type TimeChaosInfo ¶
type TimeChaosInfo struct { TimeOffset string `json:"time_offset"` ClockIDs []string `json:"clock_ids"` ContainerNames []string `json:"container_names"` }
TimeChaosInfo defines the basic information of time chaos for creating a new TimeChaos.