keptn

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigurationServiceURL = "resource-service:8080"
View Source
const DatastoreURL = "mongodb-datastore:8080"
View Source
const DefaultLoggingServiceName = "keptn"

Variables

This section is empty.

Functions

func GetExpBackoffTime

func GetExpBackoffTime(retryNr int) time.Duration

func GetServiceEndpoint

func GetServiceEndpoint(service string) (url.URL, error)

getServiceEndpoint gets an endpoint stored in an environment variable and sets http as default scheme

func ValidateKeptnEntityName

func ValidateKeptnEntityName(name string) bool

ValidateKeptnEntityName checks whether the provided name represents a valid project, service, or stage name

func ValidateUnixDirectoryName

func ValidateUnixDirectoryName(dirName string) bool

ValidateUnixDirectoryName checks whether the provided dirName contains any special character according to https://www.cyberciti.biz/faq/linuxunix-rules-for-naming-file-and-directory-names/

Types

type EventProperties

type EventProperties interface {
	GetProject() string
	GetStage() string
	GetService() string
	GetLabels() map[string]string
	SetProject(string)
	SetStage(string)
	SetService(string)
	SetLabels(map[string]string)
}

type EventSender

type EventSender interface {
	// SendEvent sends a cloud event
	// Deprecated: use EventSender.Send instead
	SendEvent(event cloudevents.Event) error

	// Send sends a cloud event
	Send(ctx context.Context, event cloudevents.Event) error
}

type KeptnBase

type KeptnBase struct {
	KeptnContext string

	Event      EventProperties
	CloudEvent *cloudevents.Event
	Logger     LoggerInterface

	// EventSender object that is responsible for sending events
	EventSender EventSender

	EventBrokerURL     string // Deprecated: use EventSender instead
	UseLocalFileSystem bool
	ResourceHandler    *api.ResourceHandler
	EventHandler       *api.EventHandler
}

func (*KeptnBase) GetKeptnResource

func (k *KeptnBase) GetKeptnResource(resource string) ([]byte, error)

GetKeptnResource returns a resource from the configuration repo based on the incoming cloud events project, service and stage

func (*KeptnBase) GetSLIConfiguration

func (k *KeptnBase) GetSLIConfiguration(project string, stage string, service string, resourceURI string) (map[string]string, error)

GetSLIConfiguration retrieves the SLI configuration for a service considering SLI configuration on stage and project level. First, the configuration of project-level is retrieved, which is then overridden by configuration on stage level, overridden by configuration on service level.

type KeptnOpts

type KeptnOpts struct {
	UseLocalFileSystem      bool
	ConfigurationServiceURL string
	EventBrokerURL          string // Deprecated: use EventSender instead
	DatastoreURL            string
	IncomingEvent           *cloudevents.Event
	LoggingOptions          *LoggingOpts
	EventSender             EventSender
}

type Logger

type Logger struct {
	KeptnContext string `json:"keptnContext"`
	EventID      string `json:"eventId"`
	ServiceName  string `json:"keptnService"`
}

Logger contains data for logging

func NewLogger

func NewLogger(keptnContext string, eventID string, serviceName string) *Logger

NewLogger creates a new Logger

func (*Logger) Debug

func (l *Logger) Debug(message string)

Debug logs a debug message

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf formats and logs a debug message

func (*Logger) Error

func (l *Logger) Error(message string)

Error logs an error message

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

Errorf formats and logs an error message

func (*Logger) Info

func (l *Logger) Info(message string)

Info logs an info message

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

Infof formats and logs an info message

func (*Logger) Terminate

func (l *Logger) Terminate(message string)

Terminate logs an info message

func (*Logger) Terminatef

func (l *Logger) Terminatef(format string, v ...interface{})

Terminatef formats and logs a terminate message

type LoggerInterface

type LoggerInterface interface {
	Info(message string)
	Infof(format string, v ...interface{})
	Error(message string)
	Errorf(format string, v ...interface{})
	Debug(message string)
	Debugf(format string, v ...interface{})
	Terminate(message string)
	Terminatef(format string, v ...interface{})
}

LoggerInterface collects signatures of the logger

type LoggingOpts

type LoggingOpts struct {
	EnableWebsocket   bool
	WebsocketEndpoint *string
	ServiceName       *string
}

type SLIConfig

type SLIConfig struct {
	Indicators map[string]string `json:"indicators" yaml:"indicators"`
}

SLIConfig represents the struct of a SLI file

Jump to

Keyboard shortcuts

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