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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName                 attribute.Key = attribute.Key("keptn.deployment.app.name")
	AppVersion              attribute.Key = attribute.Key("keptn.deployment.app.version")
	AppNamespace            attribute.Key = attribute.Key("keptn.deployment.app.namespace")
	AppStatus               attribute.Key = attribute.Key("keptn.deployment.app.status")
	AppPreviousVersion      attribute.Key = attribute.Key("keptn.deployment.app.previousversion")
	WorkloadName            attribute.Key = attribute.Key("keptn.deployment.workload.name")
	WorkloadVersion         attribute.Key = attribute.Key("keptn.deployment.workload.version")
	WorkloadPreviousVersion attribute.Key = attribute.Key("keptn.deployment.workload.previousversion")
	WorkloadNamespace       attribute.Key = attribute.Key("keptn.deployment.workload.namespace")
	WorkloadStatus          attribute.Key = attribute.Key("keptn.deployment.workload.status")
	TaskStatus              attribute.Key = attribute.Key("keptn.deployment.task.status")
	TaskName                attribute.Key = attribute.Key("keptn.deployment.task.name")
	TaskType                attribute.Key = attribute.Key("keptn.deployment.task.type")
	EvaluationStatus        attribute.Key = attribute.Key("keptn.deployment.evaluation.status")
	EvaluationName          attribute.Key = attribute.Key("keptn.deployment.evaluation.name")
	EvaluationType          attribute.Key = attribute.Key("keptn.deployment.evaluation.type")
)
View Source
const AppAnnotation = "keptn.sh/app"
View Source
const CreateAppEvalSpanName = "create_%s_app_evaluation"
View Source
const CreateAppTaskSpanName = "create_%s_app_task"
View Source
const CreateWorkloadEvalSpanName = "create_%s_deployment_evaluation"
View Source
const CreateWorkloadTaskSpanName = "create_%s_deployment_task"
View Source
const K8sRecommendedAppAnnotations = "app.kubernetes.io/part-of"
View Source
const K8sRecommendedVersionAnnotations = "app.kubernetes.io/version"
View Source
const K8sRecommendedWorkloadAnnotations = "app.kubernetes.io/name"
View Source
const MaxAppNameLength = 25
View Source
const MaxTaskNameLength = 25
View Source
const MaxVersionLength = 12
View Source
const MaxWorkloadNameLength = 25
View Source
const NamespaceEnabledAnnotation = "keptn.sh/lifecycle-toolkit"
View Source
const PostDeploymentEvaluationAnnotation = "keptn.sh/post-deployment-evaluations"
View Source
const PostDeploymentTaskAnnotation = "keptn.sh/post-deployment-tasks"
View Source
const PreDeploymentEvaluationAnnotation = "keptn.sh/pre-deployment-evaluations"
View Source
const PreDeploymentTaskAnnotation = "keptn.sh/pre-deployment-tasks"
View Source
const TaskNameAnnotation = "keptn.sh/task-name"
View Source
const VersionAnnotation = "keptn.sh/version"
View Source
const WorkloadAnnotation = "keptn.sh/workload"

Variables

View Source
var (
	PhaseWorkloadPreDeployment  = KeptnPhaseType{LongName: "Workload Pre-Deployment Tasks", ShortName: "WorkloadPreDeployTasks"}
	PhaseWorkloadPostDeployment = KeptnPhaseType{LongName: "Workload Post-Deployment Tasks", ShortName: "WorkloadPostDeployTasks"}
	PhaseWorkloadPreEvaluation  = KeptnPhaseType{LongName: "Workload Pre-Deployment Evaluations", ShortName: "WorkloadPreDeployEvaluations"}
	PhaseWorkloadPostEvaluation = KeptnPhaseType{LongName: "Workload Post-Deployment Evaluations", ShortName: "WorkloadPostDeployEvaluations"}
	PhaseWorkloadDeployment     = KeptnPhaseType{LongName: "Workload Deployment", ShortName: "WorkloadDeploy"}
	PhaseAppPreDeployment       = KeptnPhaseType{LongName: "App Pre-Deployment Tasks", ShortName: "AppPreDeployTasks"}
	PhaseAppPostDeployment      = KeptnPhaseType{LongName: "App Post-Deployment Tasks", ShortName: "AppPostDeployTasks"}
	PhaseAppPreEvaluation       = KeptnPhaseType{LongName: "App Pre-Deployment Evaluations", ShortName: "AppPreDeployEvaluations"}
	PhaseAppPostEvaluation      = KeptnPhaseType{LongName: "App Post-Deployment Evaluations", ShortName: "AppPostDeployEvaluations"}
	PhaseAppDeployment          = KeptnPhaseType{LongName: "App Deployment", ShortName: "AppDeploy"}
	PhaseReconcileEvaluation    = KeptnPhaseType{LongName: "Reconcile Evaluation", ShortName: "ReconcileEvaluation"}
	PhaseCreateEvaluation       = KeptnPhaseType{LongName: "Create Evaluation", ShortName: "Create Evaluation"}
	PhaseCompleted              = KeptnPhaseType{LongName: "Completed", ShortName: "Completed"}
	PhaseCancelled              = KeptnPhaseType{LongName: "Cancelled", ShortName: "Cancelled"}
)
View Source
var ErrCannotCastKeptnApp = errors.New("cannot cast KeptnApp to v1alpha3")
View Source
var ErrCannotCastKeptnAppVersion = errors.New("cannot cast KeptnAppVersion to v1alpha3")
View Source
var ErrCannotCastKeptnEvaluationProvider = errors.New("cannot cast KeptnEvaluationDefinition to v1alpha3")
View Source
var ErrCannotCastKeptnWorkloadInstance = errors.New("cannot cast KeptnWorkloadInstance to v1alpha3")

Functions

func GenerateEvaluationName

func GenerateEvaluationName(checkType CheckType, evalName string) string

func GenerateTaskName

func GenerateTaskName(checkType CheckType, taskName string) string

func GetShortPhaseName

func GetShortPhaseName(phase string) string

func TruncateString

func TruncateString(s string, max int) string

Types

type CheckType

type CheckType string
const PostDeploymentCheckType CheckType = "post"
const PostDeploymentEvaluationCheckType CheckType = "post-eval"
const PreDeploymentCheckType CheckType = "pre"
const PreDeploymentEvaluationCheckType CheckType = "pre-eval"

type GaugeFloatValue

type GaugeFloatValue struct {
	Value      float64
	Attributes []attribute.KeyValue
}

type GaugeValue

type GaugeValue struct {
	Value      int64
	Attributes []attribute.KeyValue
}

type KeptnMeters

type KeptnMeters struct {
	TaskCount          metric.Int64Counter
	TaskDuration       metric.Float64Histogram
	DeploymentCount    metric.Int64Counter
	DeploymentDuration metric.Float64Histogram
	AppCount           metric.Int64Counter
	AppDuration        metric.Float64Histogram
	EvaluationCount    metric.Int64Counter
	EvaluationDuration metric.Float64Histogram
}

type KeptnPhase

type KeptnPhase KeptnPhaseType

type KeptnPhaseType

type KeptnPhaseType struct {
	LongName  string
	ShortName string
}

func (KeptnPhaseType) IsEvaluation

func (p KeptnPhaseType) IsEvaluation() bool

func (KeptnPhaseType) IsPostEvaluation

func (p KeptnPhaseType) IsPostEvaluation() bool

func (KeptnPhaseType) IsPostTask

func (p KeptnPhaseType) IsPostTask() bool

func (KeptnPhaseType) IsPreEvaluation

func (p KeptnPhaseType) IsPreEvaluation() bool

func (KeptnPhaseType) IsPreTask

func (p KeptnPhaseType) IsPreTask() bool

func (KeptnPhaseType) IsTask

func (p KeptnPhaseType) IsTask() bool

type KeptnState

type KeptnState string
const (
	StateProgressing KeptnState = "Progressing"
	StateSucceeded   KeptnState = "Succeeded"
	StateFailed      KeptnState = "Failed"
	StateUnknown     KeptnState = "Unknown"
	StatePending     KeptnState = "Pending"
	StateCancelled   KeptnState = "Cancelled"
)

func GetOverallState

func GetOverallState(s StatusSummary) KeptnState

func (KeptnState) IsCancelled

func (k KeptnState) IsCancelled() bool

func (KeptnState) IsCompleted

func (k KeptnState) IsCompleted() bool

func (KeptnState) IsFailed

func (k KeptnState) IsFailed() bool

func (KeptnState) IsPending

func (k KeptnState) IsPending() bool

func (KeptnState) IsSucceeded

func (k KeptnState) IsSucceeded() bool

type PhaseTraceID

type PhaseTraceID map[string]propagation.MapCarrier

func (PhaseTraceID) GetPhaseTraceID

func (pid PhaseTraceID) GetPhaseTraceID(phase string) propagation.MapCarrier

func (PhaseTraceID) SetPhaseTraceID

func (pid PhaseTraceID) SetPhaseTraceID(phase string, carrier propagation.MapCarrier)

type StatusSummary

type StatusSummary struct {
	Total       int
	Progressing int
	Failed      int
	Succeeded   int
	Pending     int
	Unknown     int
	Cancelled   int
}

func UpdateStatusSummary

func UpdateStatusSummary(status KeptnState, summary StatusSummary) StatusSummary

func (StatusSummary) GetTotalCount

func (s StatusSummary) GetTotalCount() int

Jump to

Keyboard shortcuts

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