Skip to content

Commit

Permalink
feat(lifecycle-operator): introduce promotionTask parameters in Keptn…
Browse files Browse the repository at this point in the history
…AppContext (keptn#3056)

Signed-off-by: odubajDT <[email protected]>
Signed-off-by: vickysomtee <[email protected]>
  • Loading branch information
odubajDT authored and Vickysomtee committed Apr 22, 2024
1 parent 47903d4 commit caa77d9
Show file tree
Hide file tree
Showing 16 changed files with 443 additions and 3 deletions.
53 changes: 53 additions & 0 deletions .github/scripts/.helm-tests/default/result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,14 @@ spec:
items:
type: string
type: array
promotionTasks:
description: |-
PromotionTasks is a list of all tasks to be performed during the promotion phase of the KeptnApp.
The items of this list refer to the names of KeptnTaskDefinitions
located in the same namespace as the KeptnApp, or in the Keptn namespace.
items:
type: string
type: array
spanLinks:
description: |-
SpanLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing.
Expand Down Expand Up @@ -1614,6 +1622,10 @@ spec:
name: PostDeploymentEvaluationStatus
priority: 1
type: string
- jsonPath: .status.promotionStatus
name: PromotionStatus
priority: 1
type: string
name: v1beta1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -1686,6 +1698,14 @@ spec:
description: PreviousVersion is the version of the KeptnApp that has
been deployed prior to this version.
type: string
promotionTasks:
description: |-
PromotionTasks is a list of all tasks to be performed during the promotion phase of the KeptnApp.
The items of this list refer to the names of KeptnTaskDefinitions
located in the same namespace as the KeptnApp, or in the Keptn namespace.
items:
type: string
type: array
revision:
default: 1
description: |-
Expand Down Expand Up @@ -1886,6 +1906,39 @@ spec:
type: string
type: object
type: array
promotionStatus:
default: Pending
description: PromotionStatus indicates the current status of the KeptnAppVersion's
Promotion phase.
type: string
promotionTaskStatus:
description: PromotionTaskStatus indicates the current state of each
promotionTask of the KeptnAppVersion.
items:
properties:
definitionName:
description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition
type: string
endTime:
description: EndTime represents the time at which the Item (Evaluation/Task)
started.
format: date-time
type: string
name:
description: Name is the name of the Evaluation/Task
type: string
startTime:
description: StartTime represents the time at which the Item
(Evaluation/Task) started.
format: date-time
type: string
status:
default: Pending
description: KeptnState is a string containing current Phase
state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled)
type: string
type: object
type: array
startTime:
description: StartTime represents the time at which the deployment
of the KeptnAppVersion started.
Expand Down
53 changes: 53 additions & 0 deletions .github/scripts/.helm-tests/lifecycle-only/result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,14 @@ spec:
items:
type: string
type: array
promotionTasks:
description: |-
PromotionTasks is a list of all tasks to be performed during the promotion phase of the KeptnApp.
The items of this list refer to the names of KeptnTaskDefinitions
located in the same namespace as the KeptnApp, or in the Keptn namespace.
items:
type: string
type: array
spanLinks:
description: |-
SpanLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing.
Expand Down Expand Up @@ -1560,6 +1568,10 @@ spec:
name: PostDeploymentEvaluationStatus
priority: 1
type: string
- jsonPath: .status.promotionStatus
name: PromotionStatus
priority: 1
type: string
name: v1beta1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -1632,6 +1644,14 @@ spec:
description: PreviousVersion is the version of the KeptnApp that has
been deployed prior to this version.
type: string
promotionTasks:
description: |-
PromotionTasks is a list of all tasks to be performed during the promotion phase of the KeptnApp.
The items of this list refer to the names of KeptnTaskDefinitions
located in the same namespace as the KeptnApp, or in the Keptn namespace.
items:
type: string
type: array
revision:
default: 1
description: |-
Expand Down Expand Up @@ -1832,6 +1852,39 @@ spec:
type: string
type: object
type: array
promotionStatus:
default: Pending
description: PromotionStatus indicates the current status of the KeptnAppVersion's
Promotion phase.
type: string
promotionTaskStatus:
description: PromotionTaskStatus indicates the current state of each
promotionTask of the KeptnAppVersion.
items:
properties:
definitionName:
description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition
type: string
endTime:
description: EndTime represents the time at which the Item (Evaluation/Task)
started.
format: date-time
type: string
name:
description: Name is the name of the Evaluation/Task
type: string
startTime:
description: StartTime represents the time at which the Item
(Evaluation/Task) started.
format: date-time
type: string
status:
default: Pending
description: KeptnState is a string containing current Phase
state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled)
type: string
type: object
type: array
startTime:
description: StartTime represents the time at which the deployment
of the KeptnAppVersion started.
Expand Down
53 changes: 53 additions & 0 deletions .github/scripts/.helm-tests/lifecycle-with-certs/result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,14 @@ spec:
items:
type: string
type: array
promotionTasks:
description: |-
PromotionTasks is a list of all tasks to be performed during the promotion phase of the KeptnApp.
The items of this list refer to the names of KeptnTaskDefinitions
located in the same namespace as the KeptnApp, or in the Keptn namespace.
items:
type: string
type: array
spanLinks:
description: |-
SpanLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing.
Expand Down Expand Up @@ -1588,6 +1596,10 @@ spec:
name: PostDeploymentEvaluationStatus
priority: 1
type: string
- jsonPath: .status.promotionStatus
name: PromotionStatus
priority: 1
type: string
name: v1beta1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -1660,6 +1672,14 @@ spec:
description: PreviousVersion is the version of the KeptnApp that has
been deployed prior to this version.
type: string
promotionTasks:
description: |-
PromotionTasks is a list of all tasks to be performed during the promotion phase of the KeptnApp.
The items of this list refer to the names of KeptnTaskDefinitions
located in the same namespace as the KeptnApp, or in the Keptn namespace.
items:
type: string
type: array
revision:
default: 1
description: |-
Expand Down Expand Up @@ -1860,6 +1880,39 @@ spec:
type: string
type: object
type: array
promotionStatus:
default: Pending
description: PromotionStatus indicates the current status of the KeptnAppVersion's
Promotion phase.
type: string
promotionTaskStatus:
description: PromotionTaskStatus indicates the current state of each
promotionTask of the KeptnAppVersion.
items:
properties:
definitionName:
description: DefinitionName is the name of the EvaluationDefinition/TaskDefinition
type: string
endTime:
description: EndTime represents the time at which the Item (Evaluation/Task)
started.
format: date-time
type: string
name:
description: Name is the name of the Evaluation/Task
type: string
startTime:
description: StartTime represents the time at which the Item
(Evaluation/Task) started.
format: date-time
type: string
status:
default: Pending
description: KeptnState is a string containing current Phase
state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled)
type: string
type: object
type: array
startTime:
description: StartTime represents the time at which the deployment
of the KeptnAppVersion started.
Expand Down
5 changes: 5 additions & 0 deletions docs/docs/reference/api-reference/lifecycle/v1beta1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ _Appears in:_
| `postDeploymentTasks` _string array_ | PostDeploymentTasks is a list of all tasks to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `preDeploymentEvaluations` _string array_ | PreDeploymentEvaluations is a list of all evaluations to be performed during the pre-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `postDeploymentEvaluations` _string array_ | PostDeploymentEvaluations is a list of all evaluations to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `promotionTasks` _string array_ | PromotionTasks is a list of all tasks to be performed during the promotion phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |


#### EvaluationStatusItem
Expand Down Expand Up @@ -252,6 +253,7 @@ _Appears in:_
| `postDeploymentTasks` _string array_ | PostDeploymentTasks is a list of all tasks to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `preDeploymentEvaluations` _string array_ | PreDeploymentEvaluations is a list of all evaluations to be performed during the pre-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `postDeploymentEvaluations` _string array_ | PostDeploymentEvaluations is a list of all evaluations to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `promotionTasks` _string array_ | PromotionTasks is a list of all tasks to be performed during the promotion phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `metadata` _object (keys:string, values:string)_ | Metadata contains additional key-value pairs for contextual information. |||
| `spanLinks` _string array_ | SpanLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing. For more information on OpenTelemetry span links, refer to the documentation: https://opentelemetry.io/docs/concepts/signals/traces/#span-links |||

Expand Down Expand Up @@ -414,6 +416,7 @@ _Appears in:_
| `postDeploymentTasks` _string array_ | PostDeploymentTasks is a list of all tasks to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `preDeploymentEvaluations` _string array_ | PreDeploymentEvaluations is a list of all evaluations to be performed during the pre-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `postDeploymentEvaluations` _string array_ | PostDeploymentEvaluations is a list of all evaluations to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `promotionTasks` _string array_ | PromotionTasks is a list of all tasks to be performed during the promotion phase of the KeptnApp. The items of this list refer to the names of KeptnTaskDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `metadata` _object (keys:string, values:string)_ | Metadata contains additional key-value pairs for contextual information. |||
| `spanLinks` _string array_ | SpanLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing. For more information on OpenTelemetry span links, refer to the documentation: https://opentelemetry.io/docs/concepts/signals/traces/#span-links |||
| `version` _string_ | Version defines the version of the application. For automatically created KeptnApps, the version is a function of all KeptnWorkloads that are part of the KeptnApp. || x |
Expand All @@ -437,13 +440,15 @@ _Appears in:_
| --- | --- | --- | --- |
| `preDeploymentStatus` _string_ | PreDeploymentStatus indicates the current status of the KeptnAppVersion's PreDeployment phase. |Pending||
| `postDeploymentStatus` _string_ | PostDeploymentStatus indicates the current status of the KeptnAppVersion's PostDeployment phase. |Pending||
| `promotionStatus` _string_ | PromotionStatus indicates the current status of the KeptnAppVersion's Promotion phase. |Pending||
| `preDeploymentEvaluationStatus` _string_ | PreDeploymentEvaluationStatus indicates the current status of the KeptnAppVersion's PreDeploymentEvaluation phase. |Pending||
| `postDeploymentEvaluationStatus` _string_ | PostDeploymentEvaluationStatus indicates the current status of the KeptnAppVersion's PostDeploymentEvaluation phase. |Pending||
| `workloadOverallStatus` _string_ | WorkloadOverallStatus indicates the current status of the KeptnAppVersion's Workload deployment phase. |Pending||
| `workloadStatus` _[WorkloadStatus](#workloadstatus) array_ | WorkloadStatus contains the current status of each KeptnWorkload that is part of the KeptnAppVersion. |||
| `currentPhase` _string_ | CurrentPhase indicates the current phase of the KeptnAppVersion. |||
| `preDeploymentTaskStatus` _[ItemStatus](#itemstatus) array_ | PreDeploymentTaskStatus indicates the current state of each preDeploymentTask of the KeptnAppVersion. |||
| `postDeploymentTaskStatus` _[ItemStatus](#itemstatus) array_ | PostDeploymentTaskStatus indicates the current state of each postDeploymentTask of the KeptnAppVersion. |||
| `promotionTaskStatus` _[ItemStatus](#itemstatus) array_ | PromotionTaskStatus indicates the current state of each promotionTask of the KeptnAppVersion. |||
| `preDeploymentEvaluationTaskStatus` _[ItemStatus](#itemstatus) array_ | PreDeploymentEvaluationTaskStatus indicates the current state of each preDeploymentEvaluation of the KeptnAppVersion. |||
| `postDeploymentEvaluationTaskStatus` _[ItemStatus](#itemstatus) array_ | PostDeploymentEvaluationTaskStatus indicates the current state of each postDeploymentEvaluation of the KeptnAppVersion. |||
| `phaseTraceIDs` _[MapCarrier](https://pkg.go.dev/go.opentelemetry.io/otel/propagation#MapCarrier)_ | PhaseTraceIDs contains the trace IDs of the OpenTelemetry spans of each phase of the KeptnAppVersion. |||
Expand Down
6 changes: 6 additions & 0 deletions lifecycle-operator/apis/lifecycle/v1beta1/common/phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var phases = []KeptnPhaseType{
PhaseAppPostDeployment,
PhaseAppPreEvaluation,
PhaseAppPostEvaluation,
PhasePromotion,
PhaseAppDeployment,
PhaseReconcileEvaluation,
PhaseReconcileTask,
Expand Down Expand Up @@ -65,6 +66,10 @@ func (p KeptnPhaseType) IsPostTask() bool {
return strings.Contains(p.ShortName, "PostDeployTasks")
}

func (p KeptnPhaseType) IsPromotionTask() bool {
return strings.Contains(p.ShortName, "PromotionTasks")
}

func GetShortPhaseName(phase string) string {
for _, p := range phases {
if phase == p.ShortName {
Expand All @@ -91,6 +96,7 @@ var (
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"}
PhasePromotion = KeptnPhaseType{LongName: "Promotion Tasks", ShortName: "PromotionTasks"}
PhaseAppDeployment = KeptnPhaseType{LongName: "App Deployment", ShortName: "AppDeploy"}
PhaseReconcileEvaluation = KeptnPhaseType{LongName: "Reconcile Evaluation", ShortName: "ReconcileEvaluation"}
PhaseReconcileTask = KeptnPhaseType{LongName: "Reconcile Task", ShortName: "ReconcileTask"}
Expand Down
Loading

0 comments on commit caa77d9

Please sign in to comment.