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: 10 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 AppTypeAnnotation = "keptn.sh/app-type"
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 K8sRecommendedManagedByAnnotations = "app.kubernetes.io/managed-by"
View Source
const K8sRecommendedVersionAnnotations = "app.kubernetes.io/version"
View Source
const K8sRecommendedWorkloadAnnotations = "app.kubernetes.io/name"
View Source
const MaxK8sObjectLength = 253
View Source
const MinKLTNameLen = 80
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"}
	PhaseReconcileTask            = KeptnPhaseType{LongName: "Reconcile Task", ShortName: "ReconcileTask"}
	PhaseReconcileWorkload        = KeptnPhaseType{LongName: "Reconcile Workloads", ShortName: "ReconcileWorkload"}
	PhaseCreateEvaluation         = KeptnPhaseType{LongName: "Create Evaluation", ShortName: "CreateEvaluation"}
	PhaseCreateTask               = KeptnPhaseType{LongName: "Create Task", ShortName: "CreateTask"}
	PhaseCreateAppCreationRequest = KeptnPhaseType{LongName: "Create AppCreationRequest", ShortName: "CreateAppCreationRequest"}
	PhaseCreateWorkload           = KeptnPhaseType{LongName: "Create Workload", ShortName: "CreateWorkload"}
	PhaseUpdateWorkload           = KeptnPhaseType{LongName: "Update Workload", ShortName: "UpdateWorkload"}
	PhaseCreateWorklodInstance    = KeptnPhaseType{LongName: "Create WorkloadInstance", ShortName: "CreateWorkloadInstance"}
	PhaseCreateAppVersion         = KeptnPhaseType{LongName: "Create AppVersion", ShortName: "CreateAppVersion"}
	PhaseDeprecateAppVersion      = KeptnPhaseType{LongName: "Deprecate AppVersion", ShortName: "DeprecateAppVersion"}
	PhaseAppCompleted             = KeptnPhaseType{LongName: "App Completed", ShortName: "AppCompleted"}
	PhaseWorkloadCompleted        = KeptnPhaseType{LongName: "Workload Completed", ShortName: "WorkloadCompleted"}
	PhaseCompleted                = KeptnPhaseType{LongName: "Completed", ShortName: "Completed"}
	PhaseDeprecated               = KeptnPhaseType{LongName: "Deprecated", ShortName: "Deprecated"}
)
View Source
var (
	PhaseStateFinished         = "Finished"
	PhaseStateStarted          = "Started"
	PhaseStateFailed           = "Failed"
	PhaseStateStatusChanged    = "StatusChanged"
	PhaseStateReconcileError   = "ReconcileError"
	PhaseStateReconcileTimeout = "ReconcileTimeout"
	PhaseStateNotFound         = "NotFound"
)

Functions

func GenerateEvaluationName

func GenerateEvaluationName(checkType CheckType, evalName string) string

func GenerateJobName

func GenerateJobName(taskName string) string

func GenerateTaskName

func GenerateTaskName(checkType CheckType, taskName string) string

func GetShortPhaseName

func GetShortPhaseName(phase string) string

func Hash

func Hash(num int64) string

func IsOwnerSupported

func IsOwnerSupported(owner metav1.OwnerReference) bool

IsOwnerSupported returns whether the owner of the given object is supported to be considered a KeptnWorklooad

func MergeMaps

func MergeMaps(m1 map[string]string, m2 map[string]string) map[string]string

MergeMaps merges two maps into a new map. If a key exists in both maps, the value of the second map is picked.

func TruncateString

func TruncateString(s string, max int) string

Types

type AppType

type AppType string
const (
	AppTypeSingleService AppType = "single-service"
	AppTypeMultiService  AppType = "multi-service"
)

type CheckType

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

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"
	StateDeprecated  KeptnState = "Deprecated"
	// StateCancelled represents state that was cancelled due to a previous step having failed.
	// Deprecated: Use StateDeprecated instead. Should only be used in checks for backwards compatibility reasons
	StateCancelled KeptnState = "Cancelled"
)

func GetOverallState

func GetOverallState(s StatusSummary) KeptnState

func (KeptnState) IsCompleted

func (k KeptnState) IsCompleted() bool

func (KeptnState) IsDeprecated

func (k KeptnState) IsDeprecated() 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
	Deprecated  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