scenario

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GrafanaPort = int64(3000)
)
View Source
var WebhookURL string

Functions

func NewController

func NewController(mgr ctrl.Manager, logger logr.Logger, alertingPort int) error

func RandomFixedIndexes

func RandomFixedIndexes(start, end, count uint) []uint

RandomFixedIndexes returns the `count` random indexes between `start` and `end`. [start, end).

Types

type ActionHandler added in v1.0.24

type ActionHandler func(context.Context, *v1alpha1.Scenario, v1alpha1.Action) (client.Object, error)

type Controller

type Controller struct {
	ctrl.Manager
	logr.Logger
	// contains filtered or unexported fields
}

func (*Controller) CreateWebhookServer

func (r *Controller) CreateWebhookServer(ctx context.Context, alertingPort int) error

CreateWebhookServer creates a Webhook for listening for events from Grafana *

func (*Controller) Finalize

func (r *Controller) Finalize(obj client.Object) error

func (*Controller) Finalizer

func (r *Controller) Finalizer() string

func (*Controller) HasFailed

func (r *Controller) HasFailed(ctx context.Context, cr *v1alpha1.Scenario) error

func (*Controller) HasSucceed added in v1.0.24

func (r *Controller) HasSucceed(ctx context.Context, cr *v1alpha1.Scenario) error

func (*Controller) Initialize

func (r *Controller) Initialize(ctx context.Context, cr *v1alpha1.Scenario) error

func (*Controller) ListTelemetryAgents added in v1.0.24

func (r *Controller) ListTelemetryAgents(ctx context.Context, scenario *v1alpha1.Scenario) ([]string, error)

ListTelemetryAgents iterates the referenced services (directly via Service or indirectly via Cluster) and list all telemetry dashboards that need to be imported

func (*Controller) NextJobs added in v1.0.24

func (r *Controller) NextJobs(cr *v1alpha1.Scenario) (runNext []v1alpha1.Action, nextCycle time.Time, err error)

NextJobs returns a list of jobs that meet the logical and time constraints. That is, either the job has no dependencies, or the dependencies are met.

It is possible for the logical dependencies to be met, but the timeout not yet expired. If at least one action exists, when the workflow is updated it will trigger another reconciliation cycle. However, if there are no actions, the workflow will call the reconciliation cycle, and we will miss the next timeout. To handle this scenario, we have to requeue the request with the given duration. In this case, the given duration is the nearest expected timeout.

func (*Controller) PopulateView added in v1.0.24

func (r *Controller) PopulateView(ctx context.Context, req types.NamespacedName) error

PopulateView list all child objects in this namespace that belong to this scenario, and split them into active, successful, and failed jobs.

func (*Controller) Reconcile

func (r *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*Controller) RunActions

func (r *Controller) RunActions(ctx context.Context, t *v1alpha1.Scenario, actionList []v1alpha1.Action) error

func (*Controller) StartTelemetry

func (r *Controller) StartTelemetry(ctx context.Context, t *v1alpha1.Scenario) error

func (*Controller) StopTelemetry added in v1.0.24

func (r *Controller) StopTelemetry(t *v1alpha1.Scenario)

StopTelemetry removes the annotations from the target object, removes the Alert from Grafana, and deleted the client for the specific scenario.

func (*Controller) Validate

func (r *Controller) Validate(ctx context.Context, t *v1alpha1.Scenario) error

Validate validates the execution workflow. 1. Ensures that action names are qualified (since they are used as generators to jobs) 2. Ensures that there are no two actions with the same name. 3. Ensure that dependencies point to a valid action. 4. Ensure that macros point to a valid action.

type SList

type SList []*v1alpha1.Service

SList is a service list

func (SList) GetNames

func (in SList) GetNames() []string

func (SList) ToString

func (in SList) ToString() string

Jump to

Keyboard shortcuts

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