v0_2_0

package
v0.7.2-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 13 Imported by: 98

Documentation

Index

Constants

View Source
const ApprovalTaskName = "approval"
View Source
const DefaultLocalEventBrokerURL = "http://localhost:8081/event"
View Source
const DeploymentTaskName = "deployment"
View Source
const EvaluationTaskName = "evaluation"
View Source
const MAX_SEND_RETRIES = 3
View Source
const ReleaseTaskName = "release"
View Source
const TestTaskName = "test"

Variables

This section is empty.

Functions

func GetFinishedEventType

func GetFinishedEventType(task string) string

GetFinishedEventType returns for the given task the name of the finished event type

func GetStartedEventType

func GetStartedEventType(task string) string

GetStartedEventType returns for the given task the name of the started event type

func GetStatusChangedEventType

func GetStatusChangedEventType(task string) string

GetStatusChangedEventType returns for the given task the name of the status.changed event type

func GetTriggeredEventType

func GetTriggeredEventType(task string) string

GetTriggeredEventType returns for the given task the name of the triggered event type

Types

type ApprovalFinishedEventData

type ApprovalFinishedEventData struct {
	EventData
}

type ApprovalStartedEventData

type ApprovalStartedEventData struct {
	EventData
}

type ApprovalStatusChangedEventData

type ApprovalStatusChangedEventData struct {
	EventData
}

type ApprovalTriggeredEventData

type ApprovalTriggeredEventData struct {
	EventData
}

type DeploymentData

type DeploymentData struct {
	// DeploymentStrategy defines the used deployment strategy
	DeploymentStrategy string `json:"deploymentstrategy,omitempty"`
	// DeploymentURILocal contains the local URL
	DeploymentURIsLocal []string `json:"deploymentURIsLocal,omitempty"`
	// DeploymentURIPublic contains the public URL
	DeploymentURIsPublic []string `json:"deploymentURIsPublic,omitempty"`
	// DeploymentNames gives the names of the deployments
	DeploymentNames []string `json:"deploymentNames"`
	// GitCommit indicates the version which should be deployed
	GitCommit string `json:"gitCommit"`
}

type DeploymentFinishedEventData

type DeploymentFinishedEventData struct {
	EventData
	Deployment DeploymentData `json:"deployment"`
}

type DeploymentStartedEventData

type DeploymentStartedEventData struct {
	EventData
}

type DeploymentStatusChangedEventData

type DeploymentStatusChangedEventData struct {
	EventData
}

type DeploymentTriggeredEventData

type DeploymentTriggeredEventData struct {
	EventData

	ConfigurationChange struct {
		Values map[string]interface{} `json:"values"`
	} `json:"configurationChange"`

	Deployment DeploymentData `json:"deployment"`
}

type EvaluationDetails

type EvaluationDetails struct {
	TimeStart        string                 `json:"timeStart"`
	TimeEnd          string                 `json:"timeEnd"`
	Result           string                 `json:"result"`
	Score            float64                `json:"score"`
	SLOFileContent   string                 `json:"sloFileContent"`
	IndicatorResults []*SLIEvaluationResult `json:"indicatorResults"`
	ComparedEvents   []string               `json:"comparedEvents"`
	// GitCommit indicates the version which should be deployed
	GitCommit string `json:"gitCommit"`
}

type EvaluationFinishedEventData

type EvaluationFinishedEventData struct {
	EventData
	Evaluation EvaluationDetails `json:"evaluation"`
}

type EvaluationStartedEventData

type EvaluationStartedEventData struct {
	EventData
}

type EvaluationStatusChangedEventData

type EvaluationStatusChangedEventData struct {
	EventData
}

type EvaluationTriggeredEventData

type EvaluationTriggeredEventData struct {
	EventData

	Test struct {
		// Start indicates the starting timestamp of the tests
		Start string `json:"start"`
		// End indicates the end timestamp of the tests
		End string `json:"end"`
	} `json:"test"`

	Evaluation struct {
		// Start indicates the starting timestamp of the tests
		Start string `json:"start"`
		// End indicates the end timestamp of the tests
		End string `json:"end"`
	} `json:"evaluation"`

	Deployment struct {
		// DeploymentNames gives the names of the deployments
		DeploymentNames []string `json:"deploymentNames"`
	} `json:"deployment"`
}

type EventData

type EventData struct {
	Project string            `json:"project"`
	Stage   string            `json:"stage"`
	Service string            `json:"service"`
	Labels  map[string]string `json:"labels"`

	Status  StatusType `json:"status"`
	Result  ResultType `json:"result"`
	Message string     `json:"message"`
}

EventData contains mandatory fields of all Keptn CloudEvents

func (EventData) GetLabels added in v0.8.0

func (e EventData) GetLabels() map[string]string

func (EventData) GetProject added in v0.8.0

func (e EventData) GetProject() string

func (EventData) GetService added in v0.8.0

func (e EventData) GetService() string

func (EventData) GetStage added in v0.8.0

func (e EventData) GetStage() string

type Keptn added in v0.8.0

type Keptn struct {
	keptn.KeptnBase
}

func NewKeptn added in v0.8.0

func NewKeptn(incomingEvent *cloudevents.Event, opts keptn.KeptnOpts) (*Keptn, error)

func (*Keptn) GetShipyard added in v0.8.0

func (k *Keptn) GetShipyard() (*Shipyard, error)

GetShipyard returns the shipyard definition of a project

func (*Keptn) SendCloudEvent added in v0.8.0

func (k *Keptn) SendCloudEvent(event cloudevents.Event) error

SendCloudEvent sends a cloudevent to the event broker

type Metadata

type Metadata struct {
	Name string `json:"name" yaml:"name"`
}

Metadata contains meta-data of a resource

type ProblemDetails

type ProblemDetails struct {
	// State is the state of the problem; possible values are: OPEN, RESOLVED
	State string `json:"State,omitempty"`
	// ProblemID is a unique system identifier of the reported problem
	ProblemID string `json:"ProblemID"`
	// ProblemTitle is the display number of the reported problem.
	ProblemTitle string `json:"ProblemTitle"`
	// ProblemDetails are all problem event details including root cause
	ProblemDetails json.RawMessage `json:"ProblemDetails"`
	// PID is a unique system identifier of the reported problem.
	PID string `json:"PID"`
	// ImpcatedEntity is an identifier of the impacted entity
	// ProblemURL is a back link to the original problem
	ProblemURL     string `json:"ProblemURL,omitempty"`
	ImpactedEntity string `json:"ImpactedEntity,omitempty"`
	// Tags is a comma separated list of tags that are defined for all impacted entities.
	Tags string `json:"Tags,omitempty"`
}

ProblemDetails contains information about a problem

type ReleaseFinishedEventData

type ReleaseFinishedEventData struct {
	EventData
	Release struct {
		// GitCommit indicates the version which should be deployed
		GitCommit string `json:"gitCommit"`
	} `json:"Release"`
}

type ReleaseStartedEventData

type ReleaseStartedEventData struct {
	EventData
}

type ReleaseStatusChangedEventData

type ReleaseStatusChangedEventData struct {
	EventData
}

type ReleaseTriggeredEventData

type ReleaseTriggeredEventData struct {
	EventData
}

type Remediation

type Remediation struct {
	// ActionIndex is the index of the action
	ActionIndex int `json:"actionIndex"`
	// ActionName is the name of the action
	ActionName string `json:"actionName"`
}

RemediationStatus describes the status of a remediation

type RemediationFinishedEventData

type RemediationFinishedEventData struct {
	EventData
}

RemediationFinishedEventData describes a finished remediation

type RemediationStartedEventData

type RemediationStartedEventData struct {
	EventData
}

RemediationTriggeredEventType is a CloudEvent to indicate the start of a remediation

type RemediationStatusChangedEventData

type RemediationStatusChangedEventData struct {
	EventData

	// Remediation indicates the result
	Remediation Remediation `json:"remediation"`
}

RemediationStatus describes the result and status of a remediation

type RemediationTriggeredEventData

type RemediationTriggeredEventData struct {
	EventData

	// Problem contains details about the problem
	Problem ProblemDetails `json:"problem"`
}

RemediationTriggeredEventData is a CloudEvent for triggering remediations

type ResultType

type ResultType string
const (
	ResultPass    ResultType = "pass"
	ResultWarning ResultType = "warning"
	ResultFailed  ResultType = "fail"
)

type SLIEvaluationResult

type SLIEvaluationResult struct {
	Score   float64      `json:"score"`
	Value   *SLIResult   `json:"value"`
	Targets []*SLITarget `json:"targets"`
	Status  string       `json:"status"` // pass | warning | fail
}

type SLIResult

type SLIResult struct {
	Metric  string  `json:"metric"`
	Value   float64 `json:"value"`
	Success bool    `json:"success"`
	Message string  `json:"message,omitempty"`
}

type SLITarget

type SLITarget struct {
	Criteria    string  `json:"criteria"`
	TargetValue float64 `json:"targetValue"`
	Violated    bool    `json:"violated"`
}

type Sequence

type Sequence struct {
	Name     string   `json:"name" yaml:"name"`
	Triggers []string `json:"triggers" yaml:"triggers"`
	Tasks    []Task   `json:"tasks" yaml:"tasks"`
}

Sequence defines a task sequence by its name and tasks. The triggers property is optional

type Shipyard

type Shipyard struct {
	ApiVersion string       `json:"apiVersion" yaml:"apiVersion"`
	Kind       string       `json:"kind" yaml:"kind"`
	Metadata   Metadata     `json:"metadata" yaml:"metadata"`
	Spec       ShipyardSpec `json:"spec" yaml:"spec"`
}

Shipyard describes a shipyard specification according to Keptn spec 0.2.0

type ShipyardSpec

type ShipyardSpec struct {
	Stages []Stage `json:"stages" yaml:"stages"`
}

ShipyardSpec consists of any number of stages

type Stage

type Stage struct {
	Name      string     `json:"name" yaml:"name"`
	Sequences []Sequence `json:"sequences" yaml:"sequences"`
}

Stage defines a stage by its name and list of task sequences

type StatusType

type StatusType string
const (
	StatusSucceeded StatusType = "succeeded"
	StatusErrored   StatusType = "errored"
	StatusUnknown   StatusType = "unknown"
)

type Task

type Task struct {
	Name       string      `json:"name" yaml:"name"`
	Properties interface{} `json:"properties" yaml:"properties"`
}

Task defines a task by its name and optional properties

type TestFinishedEventData

type TestFinishedEventData struct {
	EventData
	Test struct {
		// Start indicates the starting timestamp of the tests
		Start string `json:"start"`
		// End indicates the end timestamp of the tests
		End string `json:"end"`
		// GitCommit indicates the version which should be deployed
		GitCommit string `json:"gitCommit"`
	} `json:"test"`
}

type TestStartedEventData

type TestStartedEventData struct {
	EventData
}

type TestStatusChangedEventData

type TestStatusChangedEventData struct {
	EventData
}

type TestTriggeredEventData

type TestTriggeredEventData struct {
	EventData

	Test struct {
		// TestStrategy is the testing strategy and is defined in the shipyard
		TestStrategy string `json:"teststrategy"`
	} `json:"test"`

	Deployment struct {
		// DeploymentURILocal contains the local URL
		DeploymentURIsLocal []string `json:"deploymentURIsLocal,omitempty"`
		// DeploymentURIPublic contains the public URL
		DeploymentURIsPublic []string `json:"deploymentURIsPublic,omitempty"`
	} `json:"deployment"`
}

Jump to

Keyboard shortcuts

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