Documentation ¶
Index ¶
- Constants
- type Canary
- type CanaryAction
- type ConfigService
- type ConfigurationChangeEventData
- type ConfigureMonitoringEventData
- type DeploymentFinishedEventData
- type DeploymentStrategy
- type Error
- type EvaluationDetails
- type EvaluationDoneEventData
- type InternalGetSLIDoneEventData
- type InternalGetSLIEventData
- type Keptn
- func (k *Keptn) GetKeptnResource(resource string) (string, error)
- func (k *Keptn) GetShipyard() (*Shipyard, error)
- func (k *Keptn) ReplaceKeptnPlaceholders(input string) string
- func (k *Keptn) SendConfigurationChangeEvent(incomingEvent *cloudevents.Event, labels map[string]string, eventSource string) error
- func (k *Keptn) SendDeploymentFinishedEvent(incomingEvent *cloudevents.Event, ...) error
- func (k *Keptn) SendTestsFinishedEvent(incomingEvent *cloudevents.Event, teststrategy, deploymentstrategy string, ...) error
- type KeptnBase
- type KeptnOpts
- type ProblemEventData
- type ProjectCreateEventData
- type ProjectDeleteEventData
- type Resource
- type ResourceHandler
- func (r *ResourceHandler) CreateProjectResources(project string, resources []*Resource) (string, error)
- func (r *ResourceHandler) CreateServiceResources(project string, stage string, service string, resources []*Resource) (string, error)
- func (r *ResourceHandler) CreateStageResources(project string, stage string, resources []*Resource) (string, error)
- func (r *ResourceHandler) DeleteProjectResource(project string, resourceURI string) error
- func (r *ResourceHandler) DeleteServiceResource(project string, stage string, service string, resourceURI string) error
- func (r *ResourceHandler) DeleteStageResource(project string, stage string, resourceURI string) error
- func (r *ResourceHandler) GetAllServiceResources(project string, stage string, service string) ([]*Resource, error)
- func (r *ResourceHandler) GetAllStageResources(project string, stage string) ([]*Resource, error)
- func (r *ResourceHandler) GetProjectResource(project string, resourceURI string) (*Resource, error)
- func (r *ResourceHandler) GetServiceResource(project string, stage string, service string, resourceURI string) (*Resource, error)
- func (r *ResourceHandler) GetStageResource(project string, stage string, resourceURI string) (*Resource, error)
- func (r *ResourceHandler) UpdateProjectResource(project string, resource *Resource) (string, error)
- func (r *ResourceHandler) UpdateProjectResources(project string, resources []*Resource) (string, error)
- func (r *ResourceHandler) UpdateServiceResource(project string, stage string, service string, resource *Resource) (string, error)
- func (r *ResourceHandler) UpdateServiceResources(project string, stage string, service string, resources []*Resource) (string, error)
- func (r *ResourceHandler) UpdateStageResource(project string, stage string, resource *Resource) (string, error)
- func (r *ResourceHandler) UpdateStageResources(project string, stage string, resources []*Resource) (string, error)
- type Resources
- type SLIEvaluationResult
- type SLIFilter
- type SLIResult
- type SLITarget
- type ServiceCreateEventData
- type Shipyard
- type StartEvaluationEventData
- type TestsFinishedEventData
- type Version
Constants ¶
const ConfigurationChangeEventType = "sh.keptn.event.configuration.change"
ConfigurationChangeEventType is a CloudEvent type for changing the configuration
const ConfigureMonitoringEventType = "sh.keptn.event.monitoring.configure"
ConfigureMonitoringEventType is a CloudEvent for configuring monitoring
const DeploymentFinishedEventType = "sh.keptn.events.deployment-finished"
DeploymentFinishedEventType is a CloudEvent for indicating that the deployment has finished
const EvaluationDoneEventType = "sh.keptn.events.evaluation-done"
EvaluationDoneEventType is a CloudEvent for indicating that the evaluation has finished
const InternalGetSLIDoneEventType = "sh.keptn.internal.event.get-sli.done"
InternalGetSLIDoneEventType is a CloudEvent for submitting SLI values
const InternalGetSLIEventType = "sh.keptn.internal.event.get-sli"
InternalGetSLIEventType is a CloudEvent for retrieving SLI values
const InternalProjectCreateEventType = "sh.keptn.internal.event.project.create"
InternalProjectCreateEventType is a CloudEvent type for creating a new project
const InternalProjectDeleteEventType = "sh.keptn.internal.event.project.delete"
InternalProjectDeleteEventType is a CloudEvent type for deleting a project
const InternalServiceCreateEventType = "sh.keptn.internal.event.service.create"
InternalServiceCreateEventType is a CloudEvent type for creating a new service
const ProblemEventType = "sh.keptn.events.problem"
ProblemEventType is a CloudEvent type to inform about a problem
const ProblemOpenEventType = "sh.keptn.event.problem.open"
ProblemOpenEventType is a CloudEvent type to inform about an open problem
const StartEvaluationEventType = "sh.keptn.event.start-evaluation"
StartEvaluationEventType is a CloudEvent for retrieving SLI values
const TestsFinishedEventType = "sh.keptn.events.tests-finished"
TestsFinishedEventType is a CloudEvent for indicating that tests have finished
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canary ¶
type Canary struct { // Value represents the traffic percentage on the canary Value int32 `json:"value,omitempty"` // Action represents the action of the canary Action CanaryAction `json:"action"` }
Canary describes the new configuration in a canary release
type CanaryAction ¶
type CanaryAction int
CanaryAction describes the excution of a canary release
const ( // Set is used for setting a new traffic weight for the canary Set CanaryAction = iota // Promote is used for promoting the canary Promote // Discard is used for discarding the canary Discard )
func (CanaryAction) MarshalJSON ¶
func (s CanaryAction) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (CanaryAction) String ¶
func (s CanaryAction) String() string
func (*CanaryAction) UnmarshalJSON ¶
func (s *CanaryAction) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type ConfigService ¶
type ConfigService interface {
// contains filtered or unexported methods
}
ConfigService represents the interface for accessing the configuration service
type ConfigurationChangeEventData ¶
type ConfigurationChangeEventData struct { // Project is the name of the project Project string `json:"project"` // Service is the name of the new service Service string `json:"service"` // Stage is the name of the stage Stage string `json:"stage"` // ValuesCanary contains new Helm values for canary ValuesCanary map[string]interface{} `json:"valuesCanary,omitempty"` // Canary contains a new configuration for canary releases Canary *Canary `json:"canary,omitempty"` // FileChangesUserChart provides new content for the user chart. // The key value pairs represent the URI within the chart (i.e. the key) and the new content (i.e. the value). FileChangesUserChart map[string]string `json:"fileChangesUserChart,omitempty"` // FileChangesGeneratedChart provides new content for the generated chart. // The key value pairs represent the URI within the chart (i.e. the key) and the new content (i.e. the value). FileChangesGeneratedChart map[string]string `json:"fileChangesGeneratedChart,omitempty"` // FileChangesUmbrellaChart provides new content for the umbrella chart. // The key value pairs represent the URI within the chart (i.e. the key) and the new content (i.e. the value). FileChangesUmbrellaChart map[string]string `json:"fileChangesUmbrellaChart,omitempty"` // Labels contains labels Labels map[string]string `json:"labels"` }
ConfigurationChangeEventData represents the data for changing the service configuration
type ConfigureMonitoringEventData ¶
type ConfigureMonitoringEventData struct { Type string `json:"type"` // Project is the name of the project Project string `json:"project"` // Service is the name of the new service Service string `json:"service"` }
ConfigureMonitoringEventData represents the data necessary to configure monitoring for a service
type DeploymentFinishedEventData ¶
type DeploymentFinishedEventData struct { // Project is the name of the project Project string `json:"project"` // Stage is the name of the stage Stage string `json:"stage"` // Service is the name of the new service Service string `json:"service"` // TestStrategy is the testing strategy TestStrategy string `json:"teststrategy"` // DeploymentStrategy is the deployment strategy DeploymentStrategy string `json:"deploymentstrategy"` // Tag of the new deployed artifact Tag string `json:"tag"` // Image of the new deployed artifact Image string `json:"image"` // Labels contains labels Labels map[string]string `json:"labels"` // DeploymentURILocal contains the local URL DeploymentURILocal string `json:"deploymentURILocal,omitempty"` // DeploymentURIPublic contains the public URL DeploymentURIPublic string `json:"deploymentURIPublic,omitempty"` }
DeploymentFinishedEventData represents the data for a deployment finished event
type DeploymentStrategy ¶
type DeploymentStrategy int
DeploymentStrategy describes how a keptn-managed service is deployed
const ( // Direct stores the chart which results in the Direct DeploymentStrategy = iota + 1 // Duplicate generates a second chart in order to duplicate the deployments Duplicate )
func GetDeploymentStrategy ¶
func GetDeploymentStrategy(deploymentStrategy string) (DeploymentStrategy, error)
GetDeploymentStrategy tries to parse the deployment strategy into the enum If the provided deployment strategy is unsupported, an error is returned
func (DeploymentStrategy) MarshalJSON ¶
func (s DeploymentStrategy) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (DeploymentStrategy) String ¶
func (s DeploymentStrategy) String() string
func (*DeploymentStrategy) UnmarshalJSON ¶
func (s *DeploymentStrategy) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type EvaluationDetails ¶
type EvaluationDoneEventData ¶
type EvaluationDoneEventData struct { EvaluationDetails *EvaluationDetails `json:"evaluationdetails"` // Result is the result of an evaluation; possible values are: pass, warning, fail Result string `json:"result"` // Project is the name of the project Project string `json:"project"` // Stage is the name of the stage Stage string `json:"stage"` // Service is the name of the new service Service string `json:"service"` // TestStrategy is the testing strategy TestStrategy string `json:"teststrategy"` // DeploymentStrategy is the deployment strategy DeploymentStrategy string `json:"deploymentstrategy"` // Labels contains labels Labels map[string]string `json:"labels"` }
EvaluationDoneEventData contains information about evaluation results
type InternalGetSLIDoneEventData ¶
type InternalGetSLIDoneEventData struct { // Project is the name of the project Project string `json:"project"` // Stage is the name of the stage Stage string `json:"stage"` // Service is the name of the new service Service string `json:"service"` Start string `json:"start"` End string `json:"end"` // TestStrategy is the testing strategy TestStrategy string `json:"teststrategy"` IndicatorValues []*SLIResult `json:"indicatorValues"` // DeploymentStrategy is the deployment strategy DeploymentStrategy string `json:"deploymentstrategy"` Deployment string `json:"deployment"` // Labels contains labels Labels map[string]string `json:"labels"` }
InternalGetSLIDoneEventData contains a list of SLIs and their values
type InternalGetSLIEventData ¶
type InternalGetSLIEventData struct { // SLIProvider is the name of the SLI provider which is queried SLIProvider string `json:"sliProvider"` // Project is the name of the project Project string `json:"project"` // Stage is the name of the stage Stage string `json:"stage"` // Service is the name of the new service Service string `json:"service"` Start string `json:"start"` End string `json:"end"` // TestStrategy is the testing strategy TestStrategy string `json:"teststrategy"` // DeploymentStrategy is the deployment strategy DeploymentStrategy string `json:"deploymentstrategy"` Deployment string `json:"deployment"` Indicators []string `json:"indicators"` CustomFilters []*SLIFilter `json:"customFilters"` // Labels contains labels Labels map[string]string `json:"labels"` }
InternalGetSLIEventData describes a set of SLIs to be retrieved by a data source
type Keptn ¶
type Keptn struct { KeptnContext string KeptnBase *KeptnBase // contains filtered or unexported fields }
func (*Keptn) GetShipyard ¶
GetShipyard returns the shipyard definition of a project
func (*Keptn) ReplaceKeptnPlaceholders ¶
replaces $ placeholders with actual values $CONTEXT, $EVENT, $SOURCE $PROJECT, $STAGE, $SERVICE, $DEPLOYMENT $TESTSTRATEGY $LABEL.XXXX -> will replace that with a label called XXXX $ENV.XXXX -> will replace that with an env variable called XXXX
func (*Keptn) SendConfigurationChangeEvent ¶
func (k *Keptn) SendConfigurationChangeEvent(incomingEvent *cloudevents.Event, labels map[string]string, eventSource string) error
Sends a ConfigurationChangeEventType = "sh.keptn.event.configuration.change"
func (*Keptn) SendDeploymentFinishedEvent ¶
func (k *Keptn) SendDeploymentFinishedEvent(incomingEvent *cloudevents.Event, teststrategy, deploymentstrategy, image, tag, deploymentURILocal, deploymentURIPublic string, labels map[string]string, eventSource string) error
Sends a DeploymentFinishedEventType = "sh.keptn.events.deployment-finished"
func (*Keptn) SendTestsFinishedEvent ¶
func (k *Keptn) SendTestsFinishedEvent(incomingEvent *cloudevents.Event, teststrategy, deploymentstrategy string, startedAt time.Time, result string, labels map[string]string, eventSource string) error
Sends a TestsFinishedEventType = "sh.keptn.events.tests-finished"
type KeptnBase ¶
type KeptnBase struct { Project string `json:"project"` // Service is the name of the new service Service string `json:"service"` // Stage is the name of the stage Stage string `json:"stage"` TestStrategy *string `json:"teststrategy,omitempty"` // DeploymentStrategy is the deployment strategy DeploymentStrategy *string `json:"deploymentstrategy,omitempty"` // Tag of the new deployed artifact Tag *string `json:"tag,omitempty"` // Image of the new deployed artifact Image *string `json:"image,omitempty"` // Labels contains labels Labels map[string]string `json:"labels"` }
KeptnBase contains properties that are shared among most Keptn events
type KeptnOpts ¶
type KeptnOpts struct { UseLocalFileSystem bool ConfigurationServiceURL string EventBrokerURL string IncomingEvent *cloudevents.Event }
type ProblemEventData ¶
type ProblemEventData 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 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"` // Project is the name of the project Project string `json:"project,omitempty"` // Stage is the name of the stage Stage string `json:"stage,omitempty"` // Service is the name of the new service Service string `json:"service,omitempty"` // Labels contains labels Labels map[string]string `json:"labels"` }
ProblemEventData represents the data for describing a problem
type ProjectCreateEventData ¶
type ProjectCreateEventData struct { // Project is the name of the project Project string `json:"project"` // Shipyard is a base64 encoded string of the shipyard file Shipyard string `json:"shipyard"` // GitUser is the name of a git user of an upstream repository GitUser string `json:"gitUser,omitempty"` // GitToken is the authentication token for the git user GitToken string `json:"gitToken,omitempty"` // GitRemoteURL is the remote url of a repository GitRemoteURL string `json:"gitRemoteURL,omitempty"` }
ProjectCreateEventData represents the data for creating a new project
type ProjectDeleteEventData ¶
type ProjectDeleteEventData struct { // Project is the name of the project Project string `json:"project"` }
ProjectDeleteEventData represents the data for deleting a project
type ResourceHandler ¶
type ResourceHandler struct { BaseURL string AuthToken string AuthHeader string HTTPClient *http.Client Scheme string }
ResourceHandler handles resources
func NewAuthenticatedResourceHandler ¶
func NewAuthenticatedResourceHandler(baseURL string, authToken string, authHeader string, httpClient *http.Client, scheme string) *ResourceHandler
NewAuthenticatedResourceHandler returns a new ResourceHandler that authenticates at the endpoint via the provided token
func NewResourceHandler ¶
func NewResourceHandler(baseURL string) *ResourceHandler
NewResourceHandler returns a new ResourceHandler
func (*ResourceHandler) CreateProjectResources ¶
func (r *ResourceHandler) CreateProjectResources(project string, resources []*Resource) (string, error)
CreateProjectResources creates multiple project resources
func (*ResourceHandler) CreateServiceResources ¶
func (r *ResourceHandler) CreateServiceResources(project string, stage string, service string, resources []*Resource) (string, error)
CreateServiceResources creates a service resource
func (*ResourceHandler) CreateStageResources ¶
func (r *ResourceHandler) CreateStageResources(project string, stage string, resources []*Resource) (string, error)
CreateStageResources creates a stage resource
func (*ResourceHandler) DeleteProjectResource ¶
func (r *ResourceHandler) DeleteProjectResource(project string, resourceURI string) error
DeleteProjectResource deletes a project resource
func (*ResourceHandler) DeleteServiceResource ¶
func (r *ResourceHandler) DeleteServiceResource(project string, stage string, service string, resourceURI string) error
DeleteServiceResource deletes a service resource
func (*ResourceHandler) DeleteStageResource ¶
func (r *ResourceHandler) DeleteStageResource(project string, stage string, resourceURI string) error
DeleteStageResource deletes a stage resource
func (*ResourceHandler) GetAllServiceResources ¶
func (r *ResourceHandler) GetAllServiceResources(project string, stage string, service string) ([]*Resource, error)
GetAllServiceResources returns a list of all resources.
func (*ResourceHandler) GetAllStageResources ¶
func (r *ResourceHandler) GetAllStageResources(project string, stage string) ([]*Resource, error)
GetAllStageResources returns a list of all resources.
func (*ResourceHandler) GetProjectResource ¶
func (r *ResourceHandler) GetProjectResource(project string, resourceURI string) (*Resource, error)
GetProjectResource retrieves a project resource from the configuration service
func (*ResourceHandler) GetServiceResource ¶
func (r *ResourceHandler) GetServiceResource(project string, stage string, service string, resourceURI string) (*Resource, error)
GetServiceResource retrieves a service resource from the configuration service
func (*ResourceHandler) GetStageResource ¶
func (r *ResourceHandler) GetStageResource(project string, stage string, resourceURI string) (*Resource, error)
GetStageResource retrieves a stage resource from the configuration service
func (*ResourceHandler) UpdateProjectResource ¶
func (r *ResourceHandler) UpdateProjectResource(project string, resource *Resource) (string, error)
UpdateProjectResource updates a project resource
func (*ResourceHandler) UpdateProjectResources ¶
func (r *ResourceHandler) UpdateProjectResources(project string, resources []*Resource) (string, error)
UpdateProjectResources updates multiple project resources
func (*ResourceHandler) UpdateServiceResource ¶
func (r *ResourceHandler) UpdateServiceResource(project string, stage string, service string, resource *Resource) (string, error)
UpdateServiceResource updates a service resource
func (*ResourceHandler) UpdateServiceResources ¶
func (r *ResourceHandler) UpdateServiceResources(project string, stage string, service string, resources []*Resource) (string, error)
UpdateServiceResources updates multiple service resources
func (*ResourceHandler) UpdateStageResource ¶
func (r *ResourceHandler) UpdateStageResource(project string, stage string, resource *Resource) (string, error)
UpdateStageResource updates a stage resource
func (*ResourceHandler) UpdateStageResources ¶
func (r *ResourceHandler) UpdateStageResources(project string, stage string, resources []*Resource) (string, error)
UpdateStageResources updates multiple stage resources
type Resources ¶
type Resources struct { // Pointer to next page, base64 encoded NextPageKey string `json:"nextPageKey,omitempty"` // Size of returned page PageSize float64 `json:"pageSize,omitempty"` // resources Resources []*Resource `json:"resources"` // Total number of resources TotalCount float64 `json:"totalCount,omitempty"` }
type SLIEvaluationResult ¶
type ServiceCreateEventData ¶
type ServiceCreateEventData struct { // Project is the name of the project Project string `json:"project"` // Service is the name of the new service Service string `json:"service"` // HelmChart are the data of a Helm chart packed as tgz and base64 encoded HelmChart string `json:"helmChart"` // DeploymentStrategies contains the deployment strategy for the stages DeploymentStrategies map[string]DeploymentStrategy `json:"deploymentStrategies"` }
ServiceCreateEventData represents the data for creating a new service
type Shipyard ¶
type Shipyard struct { Stages []struct { Name string `json:"name" yaml:"name"` DeploymentStrategy string `json:"deployment_strategy" yaml:"deployment_strategy"` TestStrategy string `json:"test_strategy,omitempty" yaml:"test_strategy"` RemediationStrategy string `json:"remediation_strategy,omitempty" yaml:"remediation_strategy"` } `json:"stages" yaml:"stages"` }
Shipyard defines the name, deployment strategy and test strategy of each stage
type StartEvaluationEventData ¶
type StartEvaluationEventData struct { // Project is the name of the project Project string `json:"project"` // Service is the name of the new service Service string `json:"service"` // Stage is the name of the stage Stage string `json:"stage"` // TestStrategy is the testing strategy TestStrategy string `json:"teststrategy"` // DeploymentStrategy is the deployment strategy DeploymentStrategy string `json:"deploymentstrategy"` // Start indicates the starting timestamp of the tests Start string `json:"start"` // End indicates the end timestamp of the tests End string `json:"end"` // Labels contains labels Labels map[string]string `json:"labels"` }
StartEvaluationEventData represents the data for a test finished event
type TestsFinishedEventData ¶
type TestsFinishedEventData struct { // Project is the name of the project Project string `json:"project"` // Service is the name of the new service Service string `json:"service"` // Stage is the name of the stage Stage string `json:"stage"` // TestStrategy is the testing strategy TestStrategy string `json:"teststrategy"` // DeploymentStrategy is the deployment strategy DeploymentStrategy string `json:"deploymentstrategy"` // Start indicates the starting timestamp of the tests Start string `json:"start"` // End indicates the end timestamp of the tests End string `json:"end"` // Labels contains labels Labels map[string]string `json:"labels"` // Result shows the status of the test Result string `json:"result"` }
TestsFinishedEventData represents the data for a test finished event