common

package
v0.0.0-...-14494c5 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FunctionRuntimeImageKey = "FUNCTION_RUNNER_IMAGE"
	PythonRuntimeImageKey   = "PYTHON_RUNNER_IMAGE"
	FunctionScriptMountPath = "/var/data/function.ts"
	PythonScriptMountPath   = "/var/data/function.py"
)
View Source
const KLTNamespace = "keptn-lifecycle-toolkit-system"

Variables

This section is empty.

Functions

func AddApp

func AddApp(c client.Client, name string) error

func AddAppVersion

func AddAppVersion(c client.Client, namespace string, appName string, version string, workloads []lfcv1alpha3.KeptnWorkloadRef, status lfcv1alpha3.KeptnAppVersionStatus) error

func GetCmName

func GetCmName(functionName string, spec *klcv1alpha3.RuntimeSpec) string

func GetEvaluationDefinition

func GetEvaluationDefinition(k8sclient client.Client, log logr.Logger, ctx context.Context, definitionName string, namespace string) (*klcv1alpha3.KeptnEvaluationDefinition, error)

func GetItemStatus

func GetItemStatus(name string, instanceStatus []klcv1alpha3.ItemStatus) klcv1alpha3.ItemStatus

GetItemStatus retrieves the state of the task/evaluation, if it does not exists, it creates a default one

func GetOTelTracerProviderOptions

func GetOTelTracerProviderOptions(oTelCollectorUrl string) ([]trace.TracerProviderOption, trace.SpanExporter, error)

func GetOldStatus

func GetOldStatus(name string, statuses []klcv1alpha3.ItemStatus) apicommon.KeptnState

GetOldStatus retrieves the state of the task/evaluation

func GetOtelInstance

func GetOtelInstance() *otelConfig

func GetRuntimeImage

func GetRuntimeImage(def *klcv1alpha3.KeptnTaskDefinition) string

func GetRuntimeMountPath

func GetRuntimeMountPath(def *klcv1alpha3.KeptnTaskDefinition) string

func GetTaskDefinition

func GetTaskDefinition(k8sclient client.Client, log logr.Logger, ctx context.Context, definitionName string, namespace string) (*klcv1alpha3.KeptnTaskDefinition, error)

func InitAppMeters

func InitAppMeters() apicommon.KeptnMeters

func IsContainerEmpty

func IsContainerEmpty(spec *klcv1alpha3.ContainerSpec) bool

func IsInline

func IsInline(spec *klcv1alpha3.RuntimeSpec) bool

func IsRuntimeEmpty

func IsRuntimeEmpty(spec *klcv1alpha3.RuntimeSpec) bool

func IsVolumeMountPresent

func IsVolumeMountPresent(spec *klcv1alpha3.ContainerSpec) bool

func ObserveActiveInstances

func ObserveActiveInstances(ctx context.Context, client client.Client, reconcileObjectList client.ObjectList, gauge metric.Int64ObservableGauge, o metric.Observer) error

func ObserveDeploymentDuration

func ObserveDeploymentDuration(ctx context.Context, client client.Client, reconcileObjectList client.ObjectList, gauge metric.Float64ObservableGauge, o metric.Observer) error

func ObserveDeploymentInterval

func ObserveDeploymentInterval(ctx context.Context, client client.Client, reconcileObjectList client.ObjectList, gauge metric.Float64ObservableGauge, o metric.Observer) error

func SetUpKeptnMeters

func SetUpKeptnMeters(meter interfaces.IMeter, mgr client.Client)

func SetUpKeptnTaskMeters

func SetUpKeptnTaskMeters(meter interfaces.IMeter) common.KeptnMeters

func SpecExists

func SpecExists(definition *klcv1alpha3.KeptnTaskDefinition) bool

check if either the funtions or container spec is set

func UpdateAppRevision

func UpdateAppRevision(c client.Client, name string, revision uint) error

Types

type CreateEvaluationAttributes

type CreateEvaluationAttributes struct {
	SpanName   string
	Definition klcv1alpha3.KeptnEvaluationDefinition
	CheckType  apicommon.CheckType
}

type CreateTaskAttributes

type CreateTaskAttributes struct {
	SpanName   string
	Definition klcv1alpha3.KeptnTaskDefinition
	CheckType  apicommon.CheckType
}

type EvaluationHandler

type EvaluationHandler struct {
	client.Client
	EventSender EventSender
	Log         logr.Logger
	Tracer      trace.Tracer
	Scheme      *runtime.Scheme
	SpanHandler ISpanHandler
}

func (EvaluationHandler) CreateKeptnEvaluation

func (r EvaluationHandler) CreateKeptnEvaluation(ctx context.Context, namespace string, reconcileObject client.Object, evaluationCreateAttributes CreateEvaluationAttributes) (string, error)

func (EvaluationHandler) ReconcileEvaluations

func (r EvaluationHandler) ReconcileEvaluations(ctx context.Context, phaseCtx context.Context, reconcileObject client.Object, evaluationCreateAttributes CreateEvaluationAttributes) ([]klcv1alpha3.ItemStatus, apicommon.StatusSummary, error)

type EventSender

type EventSender struct {
	// contains filtered or unexported fields
}

func NewEventSender

func NewEventSender(recorder record.EventRecorder) EventSender

func (*EventSender) SendK8sEvent

func (s *EventSender) SendK8sEvent(phase apicommon.KeptnPhaseType, eventType string, reconcileObject client.Object, shortReason string, longReason string, version string)

SendK8sEvent creates k8s Event and adds it to Eventqueue

type ISpanHandler

type ISpanHandler interface {
	GetSpan(ctx context.Context, tracer trace.Tracer, reconcileObject client.Object, phase string) (context.Context, trace.Span, error)
	UnbindSpan(reconcileObject client.Object, phase string) error
}

type ITracer

type ITracer = trace.Tracer

type PhaseHandler

type PhaseHandler struct {
	client.Client
	EventSender EventSender
	Log         logr.Logger
	SpanHandler ISpanHandler
}

func (PhaseHandler) HandlePhase

func (r PhaseHandler) HandlePhase(ctx context.Context, ctxTrace context.Context, tracer trace.Tracer, reconcileObject client.Object, phase apicommon.KeptnPhaseType, span trace.Span, reconcilePhase func(phaseCtx context.Context) (apicommon.KeptnState, error)) (*PhaseResult, error)

type PhaseResult

type PhaseResult struct {
	Continue bool
	ctrl.Result
}

type SpanHandler

type SpanHandler struct {
	// contains filtered or unexported fields
}

func (*SpanHandler) GetSpan

func (r *SpanHandler) GetSpan(ctx context.Context, tracer trace.Tracer, reconcileObject client.Object, phase string) (context.Context, trace.Span, error)

func (*SpanHandler) UnbindSpan

func (r *SpanHandler) UnbindSpan(reconcileObject client.Object, phase string) error

type TaskHandler

type TaskHandler struct {
	client.Client
	EventSender EventSender
	Log         logr.Logger
	Tracer      trace.Tracer
	Scheme      *runtime.Scheme
	SpanHandler ISpanHandler
}

func (TaskHandler) CreateKeptnTask

func (r TaskHandler) CreateKeptnTask(ctx context.Context, namespace string, reconcileObject client.Object, taskCreateAttributes CreateTaskAttributes) (string, error)

func (TaskHandler) ReconcileTasks

func (r TaskHandler) ReconcileTasks(ctx context.Context, phaseCtx context.Context, reconcileObject client.Object, taskCreateAttributes CreateTaskAttributes) ([]klcv1alpha3.ItemStatus, apicommon.StatusSummary, error)

type TracerFactory

type TracerFactory interface {
	GetTracer(name string) ITracer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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