Skip to content

Commit

Permalink
feat(lifecycle-operator): support linked spans in KeptnAppVersion (#2833
Browse files Browse the repository at this point in the history
)

Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT authored Jan 23, 2024
1 parent 8d884a7 commit 36e19b2
Show file tree
Hide file tree
Showing 26 changed files with 367 additions and 141 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -657,3 +657,4 @@ yannh
yml
YOURNAME
yourregistry
opentracing
17 changes: 15 additions & 2 deletions .github/scripts/.helm-tests/default/result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,9 @@ spec:
items:
type: string
type: array
traceLinks:
spanLinks:
description: |-
TraceLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing.
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
items:
type: string
Expand Down Expand Up @@ -1642,6 +1642,12 @@ spec:
appName:
description: AppName is the name of the KeptnApp.
type: string
metadata:
additionalProperties:
type: string
description: Metadata contains additional key-value pairs for contextual
information.
type: object
postDeploymentEvaluations:
description: |-
PostDeploymentEvaluations is a list of all evaluations to be performed
Expand Down Expand Up @@ -1687,6 +1693,13 @@ spec:
This can be used for restarting a KeptnApp which failed to deploy,
e.g. due to a failed preDeploymentEvaluation/preDeploymentTask.
type: integer
spanLinks:
description: |-
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
items:
type: string
type: array
traceId:
additionalProperties:
type: string
Expand Down
17 changes: 15 additions & 2 deletions .github/scripts/.helm-tests/lifecycle-only/result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ spec:
items:
type: string
type: array
traceLinks:
spanLinks:
description: |-
TraceLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing.
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
items:
type: string
Expand Down Expand Up @@ -1588,6 +1588,12 @@ spec:
appName:
description: AppName is the name of the KeptnApp.
type: string
metadata:
additionalProperties:
type: string
description: Metadata contains additional key-value pairs for contextual
information.
type: object
postDeploymentEvaluations:
description: |-
PostDeploymentEvaluations is a list of all evaluations to be performed
Expand Down Expand Up @@ -1633,6 +1639,13 @@ spec:
This can be used for restarting a KeptnApp which failed to deploy,
e.g. due to a failed preDeploymentEvaluation/preDeploymentTask.
type: integer
spanLinks:
description: |-
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
items:
type: string
type: array
traceId:
additionalProperties:
type: string
Expand Down
17 changes: 15 additions & 2 deletions .github/scripts/.helm-tests/lifecycle-with-certs/result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,9 @@ spec:
items:
type: string
type: array
traceLinks:
spanLinks:
description: |-
TraceLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing.
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
items:
type: string
Expand Down Expand Up @@ -1616,6 +1616,12 @@ spec:
appName:
description: AppName is the name of the KeptnApp.
type: string
metadata:
additionalProperties:
type: string
description: Metadata contains additional key-value pairs for contextual
information.
type: object
postDeploymentEvaluations:
description: |-
PostDeploymentEvaluations is a list of all evaluations to be performed
Expand Down Expand Up @@ -1661,6 +1667,13 @@ spec:
This can be used for restarting a KeptnApp which failed to deploy,
e.g. due to a failed preDeploymentEvaluation/preDeploymentTask.
type: integer
spanLinks:
description: |-
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
items:
type: string
type: array
traceId:
additionalProperties:
type: string
Expand Down
5 changes: 4 additions & 1 deletion docs/docs/reference/api-reference/lifecycle/v1beta1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ KeptnAppContextSpec defines the desired state of KeptnAppContext

_Appears in:_
- [KeptnAppContext](#keptnappcontext)
- [KeptnAppVersionSpec](#keptnappversionspec)

| Field | Description | Default | Optional |
| --- | --- | --- | --- |
Expand All @@ -252,7 +253,7 @@ _Appears in:_
| `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 |
| `metadata` _object (keys:string, values:string)_ | Refer to Kubernetes API documentation for fields of `metadata`. |||
| `traceLinks` _string array_ | TraceLinks 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 |||
| `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 |||


#### KeptnAppContextStatus
Expand Down Expand Up @@ -413,6 +414,8 @@ _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 |
| `metadata` _object (keys:string, values:string)_ | Refer to Kubernetes API documentation for fields of `metadata`. |||
| `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 |
| `revision` _integer_ | Revision can be modified to trigger another deployment of a KeptnApp of the same version. This can be used for restarting a KeptnApp which failed to deploy, e.g. due to a failed preDeploymentEvaluation/preDeploymentTask. |1||
| `workloads` _[KeptnWorkloadRef](#keptnworkloadref) array_ | Workloads is a list of all KeptnWorkloads that are part of the KeptnApp. |||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,20 @@ func TestKeptnAppVersion_ConvertFrom(t *testing.T) {
},
},
},
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
KeptnAppContextSpec: v1beta1.KeptnAppContextSpec{
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
},
},
},
AppName: "app",
Expand Down Expand Up @@ -474,18 +476,20 @@ func TestKeptnAppVersion_ConvertTo(t *testing.T) {
},
},
},
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
KeptnAppContextSpec: v1beta1.KeptnAppContextSpec{
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
},
},
},
AppName: "app",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,20 @@ func TestKeptnAppVersion_ConvertFrom(t *testing.T) {
},
},
},
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
KeptnAppContextSpec: v1beta1.KeptnAppContextSpec{
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
},
},
},
AppName: "app",
Expand Down Expand Up @@ -474,18 +476,20 @@ func TestKeptnAppVersion_ConvertTo(t *testing.T) {
},
},
},
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
KeptnAppContextSpec: v1beta1.KeptnAppContextSpec{
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
},
},
},
AppName: "app",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,20 @@ func TestKeptnAppVersion_ConvertFrom(t *testing.T) {
},
},
},
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
KeptnAppContextSpec: v1beta1.KeptnAppContextSpec{
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
},
},
},
AppName: "app",
Expand Down Expand Up @@ -476,18 +478,20 @@ func TestKeptnAppVersion_ConvertTo(t *testing.T) {
},
},
},
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
KeptnAppContextSpec: v1beta1.KeptnAppContextSpec{
DeploymentTaskSpec: v1beta1.DeploymentTaskSpec{
PreDeploymentTasks: []string{
"some-pre-deployment-task1",
},
PostDeploymentTasks: []string{
"some-post-deployment-task2",
},
PreDeploymentEvaluations: []string{
"some-pre-evaluation-task1",
},
PostDeploymentEvaluations: []string{
"some-pre-evaluation-task2",
},
},
},
AppName: "app",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ type KeptnAppContextSpec struct {
Metadata map[string]string `json:"metadata,omitempty"`

// +optional
// TraceLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing.
// 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
TraceLinks []string `json:"traceLinks,omitempty"`
SpanLinks []string `json:"spanLinks,omitempty"`
}

// KeptnAppContextStatus defines the observed state of KeptnAppContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

// KeptnAppVersionSpec defines the desired state of KeptnAppVersion
type KeptnAppVersionSpec struct {
DeploymentTaskSpec `json:",inline"`
KeptnAppSpec `json:",inline"`
KeptnAppContextSpec `json:",inline"`
KeptnAppSpec `json:",inline"`
// AppName is the name of the KeptnApp.
AppName string `json:"appName"`
// PreviousVersion is the version of the KeptnApp that has been deployed prior to this version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ func TestKeptnAppVersion(t *testing.T) {
KeptnAppSpec: KeptnAppSpec{
Version: "version",
},
DeploymentTaskSpec: DeploymentTaskSpec{
PreDeploymentTasks: []string{"task1", "task2"},
PostDeploymentTasks: []string{"task3", "task4"},
PreDeploymentEvaluations: []string{"task5", "task6"},
PostDeploymentEvaluations: []string{"task7", "task8"},
KeptnAppContextSpec: KeptnAppContextSpec{
DeploymentTaskSpec: DeploymentTaskSpec{
PreDeploymentTasks: []string{"task1", "task2"},
PostDeploymentTasks: []string{"task3", "task4"},
PreDeploymentEvaluations: []string{"task5", "task6"},
PostDeploymentEvaluations: []string{"task7", "task8"},
},
},
PreviousVersion: "prev",
AppName: "appname",
Expand Down
Loading

0 comments on commit 36e19b2

Please sign in to comment.