-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add health checks for keptn resources (#11716)
* feat: add keptnappversion Signed-off-by: Thomas Schuetz <thomas.schuetz@dynatrace.com> * feat: added keptn resource tests Signed-off-by: Thomas Schuetz <thomas.schuetz@dynatrace.com> * feat: fix test for KeptnWorkloadInstance Signed-off-by: Thomas Schuetz <thomas.schuetz@dynatrace.com> * fix: apiVersion and quotes Signed-off-by: Thomas Schuetz <thomas.schuetz@dynatrace.com> Signed-off-by: Thomas Schuetz <thomas.schuetz@dynatrace.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
- Loading branch information
1 parent
c4f6ed8
commit 0864a02
Showing
20 changed files
with
746 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
resource_customizations/lifecycle.keptn.sh/KeptnAppVersion/health.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
hs = {} | ||
if obj.status.status == "Succeeded" then | ||
hs.status = "Healthy" | ||
hs.message = "KeptnAppVersion is healthy" | ||
return hs | ||
end | ||
if obj.status.status == "Failed" then | ||
hs.status = "Degraded" | ||
hs.message = "KeptnAppVersion is degraded" | ||
return hs | ||
end | ||
hs.status = "Progressing" | ||
hs.message = "KeptnAppVersion is progressing" | ||
return hs |
13 changes: 13 additions & 0 deletions
13
resource_customizations/lifecycle.keptn.sh/KeptnAppVersion/health_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
tests: | ||
- healthStatus: | ||
status: Progressing | ||
message: "KeptnAppVersion is progressing" | ||
inputPath: testdata/progressing.yaml | ||
- healthStatus: | ||
status: Degraded | ||
message: "KeptnAppVersion is degraded" | ||
inputPath: testdata/degraded.yaml | ||
- healthStatus: | ||
status: Healthy | ||
message: "KeptnAppVersion is healthy" | ||
inputPath: testdata/healthy.yaml |
93 changes: 93 additions & 0 deletions
93
resource_customizations/lifecycle.keptn.sh/KeptnAppVersion/testdata/degraded.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
apiVersion: lifecycle.keptn.sh/v1alpha2 | ||
kind: KeptnAppVersion | ||
metadata: | ||
annotations: | ||
traceparent: 00-adc84f15413da737240dde75de2248fb-e3fcbc6fbdd05b1c-01 | ||
creationTimestamp: "2022-12-14T13:17:36Z" | ||
generation: 1 | ||
name: podtato-head-0.1.1 | ||
namespace: podtato-kubectl | ||
ownerReferences: | ||
- apiVersion: lifecycle.keptn.sh/v1alpha2 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: KeptnApp | ||
name: podtato-head | ||
uid: b0e9773a-3dc7-4639-a4bd-64c8bb3d33ab | ||
resourceVersion: "226500" | ||
uid: 9ae27184-c63d-4e50-bbc7-18e5e289e85c | ||
spec: | ||
appName: podtato-head | ||
preDeploymentEvaluations: | ||
- app-pre-deploy-eval-2 | ||
revision: "1" | ||
traceId: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-3777b2225e0d2dc3-01 | ||
version: 0.1.1 | ||
workloads: | ||
- name: podtato-head-left-arm | ||
version: 0.2.7 | ||
- name: podtato-head-left-leg | ||
version: 0.2.7 | ||
- name: podtato-head-entry | ||
version: 0.2.7 | ||
- name: podtato-head-right-arm | ||
version: 0.1.0 | ||
- name: podtato-head-right-leg | ||
version: 0.2.7 | ||
- name: podtato-head-hat | ||
version: 0.1.0 | ||
status: | ||
currentPhase: Completed | ||
endTime: "2022-12-14T13:19:06Z" | ||
phaseTraceIDs: | ||
"": | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-d566f50faad914b0-01 | ||
AppDeploy: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-0ae50f2d844888ab-01 | ||
AppPostDeployEvaluations: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-f3dd12be90fc6c55-01 | ||
AppPostDeployTasks: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-0ebcfa51b9b3a08b-01 | ||
AppPreDeployEvaluations: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-b5838bedd1703826-01 | ||
AppPreDeployTasks: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-b1c3977a55236160-01 | ||
postDeploymentEvaluationStatus: Succeeded | ||
postDeploymentStatus: Succeeded | ||
preDeploymentEvaluationStatus: Succeeded | ||
preDeploymentEvaluationTaskStatus: | ||
- endTime: "2022-12-14T13:17:41Z" | ||
evaluationDefinitionName: app-pre-deploy-eval-2 | ||
evaluationName: pre-eval-app-pre-deploy-eval-2-48925 | ||
startTime: "2022-12-14T13:17:36Z" | ||
status: Succeeded | ||
preDeploymentStatus: Succeeded | ||
startTime: "2022-12-14T13:17:36Z" | ||
status: Failed | ||
workloadOverallStatus: Failed | ||
workloadStatus: | ||
- status: Failed | ||
workload: | ||
name: podtato-head-left-arm | ||
version: 0.2.7 | ||
- status: Progressing | ||
workload: | ||
name: podtato-head-left-leg | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-entry | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-right-arm | ||
version: 0.1.0 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-right-leg | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-hat | ||
version: 0.1.0 |
93 changes: 93 additions & 0 deletions
93
resource_customizations/lifecycle.keptn.sh/KeptnAppVersion/testdata/healthy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
apiVersion: lifecycle.keptn.sh/v1alpha2 | ||
kind: KeptnAppVersion | ||
metadata: | ||
annotations: | ||
traceparent: 00-adc84f15413da737240dde75de2248fb-e3fcbc6fbdd05b1c-01 | ||
creationTimestamp: "2022-12-14T13:17:36Z" | ||
generation: 1 | ||
name: podtato-head-0.1.1 | ||
namespace: podtato-kubectl | ||
ownerReferences: | ||
- apiVersion: lifecycle.keptn.sh/v1alpha2 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: KeptnApp | ||
name: podtato-head | ||
uid: b0e9773a-3dc7-4639-a4bd-64c8bb3d33ab | ||
resourceVersion: "226500" | ||
uid: 9ae27184-c63d-4e50-bbc7-18e5e289e85c | ||
spec: | ||
appName: podtato-head | ||
preDeploymentEvaluations: | ||
- app-pre-deploy-eval-2 | ||
revision: "1" | ||
traceId: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-3777b2225e0d2dc3-01 | ||
version: 0.1.1 | ||
workloads: | ||
- name: podtato-head-left-arm | ||
version: 0.2.7 | ||
- name: podtato-head-left-leg | ||
version: 0.2.7 | ||
- name: podtato-head-entry | ||
version: 0.2.7 | ||
- name: podtato-head-right-arm | ||
version: 0.1.0 | ||
- name: podtato-head-right-leg | ||
version: 0.2.7 | ||
- name: podtato-head-hat | ||
version: 0.1.0 | ||
status: | ||
currentPhase: Completed | ||
endTime: "2022-12-14T13:19:06Z" | ||
phaseTraceIDs: | ||
"": | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-d566f50faad914b0-01 | ||
AppDeploy: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-0ae50f2d844888ab-01 | ||
AppPostDeployEvaluations: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-f3dd12be90fc6c55-01 | ||
AppPostDeployTasks: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-0ebcfa51b9b3a08b-01 | ||
AppPreDeployEvaluations: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-b5838bedd1703826-01 | ||
AppPreDeployTasks: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-b1c3977a55236160-01 | ||
postDeploymentEvaluationStatus: Succeeded | ||
postDeploymentStatus: Succeeded | ||
preDeploymentEvaluationStatus: Succeeded | ||
preDeploymentEvaluationTaskStatus: | ||
- endTime: "2022-12-14T13:17:41Z" | ||
evaluationDefinitionName: app-pre-deploy-eval-2 | ||
evaluationName: pre-eval-app-pre-deploy-eval-2-48925 | ||
startTime: "2022-12-14T13:17:36Z" | ||
status: Succeeded | ||
preDeploymentStatus: Succeeded | ||
startTime: "2022-12-14T13:17:36Z" | ||
status: Succeeded | ||
workloadOverallStatus: Succeeded | ||
workloadStatus: | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-left-arm | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-left-leg | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-entry | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-right-arm | ||
version: 0.1.0 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-right-leg | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-hat | ||
version: 0.1.0 |
93 changes: 93 additions & 0 deletions
93
resource_customizations/lifecycle.keptn.sh/KeptnAppVersion/testdata/progressing.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
apiVersion: lifecycle.keptn.sh/v1alpha2 | ||
kind: KeptnAppVersion | ||
metadata: | ||
annotations: | ||
traceparent: 00-adc84f15413da737240dde75de2248fb-e3fcbc6fbdd05b1c-01 | ||
creationTimestamp: "2022-12-14T13:17:36Z" | ||
generation: 1 | ||
name: podtato-head-0.1.1 | ||
namespace: podtato-kubectl | ||
ownerReferences: | ||
- apiVersion: lifecycle.keptn.sh/v1alpha2 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: KeptnApp | ||
name: podtato-head | ||
uid: b0e9773a-3dc7-4639-a4bd-64c8bb3d33ab | ||
resourceVersion: "226500" | ||
uid: 9ae27184-c63d-4e50-bbc7-18e5e289e85c | ||
spec: | ||
appName: podtato-head | ||
preDeploymentEvaluations: | ||
- app-pre-deploy-eval-2 | ||
revision: "1" | ||
traceId: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-3777b2225e0d2dc3-01 | ||
version: 0.1.1 | ||
workloads: | ||
- name: podtato-head-left-arm | ||
version: 0.2.7 | ||
- name: podtato-head-left-leg | ||
version: 0.2.7 | ||
- name: podtato-head-entry | ||
version: 0.2.7 | ||
- name: podtato-head-right-arm | ||
version: 0.1.0 | ||
- name: podtato-head-right-leg | ||
version: 0.2.7 | ||
- name: podtato-head-hat | ||
version: 0.1.0 | ||
status: | ||
currentPhase: Completed | ||
endTime: "2022-12-14T13:19:06Z" | ||
phaseTraceIDs: | ||
"": | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-d566f50faad914b0-01 | ||
AppDeploy: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-0ae50f2d844888ab-01 | ||
AppPostDeployEvaluations: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-f3dd12be90fc6c55-01 | ||
AppPostDeployTasks: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-0ebcfa51b9b3a08b-01 | ||
AppPreDeployEvaluations: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-b5838bedd1703826-01 | ||
AppPreDeployTasks: | ||
traceparent: 00-ecdd1f5a7e1068ac9b0d044aa165ca4c-b1c3977a55236160-01 | ||
postDeploymentEvaluationStatus: Succeeded | ||
postDeploymentStatus: Succeeded | ||
preDeploymentEvaluationStatus: Succeeded | ||
preDeploymentEvaluationTaskStatus: | ||
- endTime: "2022-12-14T13:17:41Z" | ||
evaluationDefinitionName: app-pre-deploy-eval-2 | ||
evaluationName: pre-eval-app-pre-deploy-eval-2-48925 | ||
startTime: "2022-12-14T13:17:36Z" | ||
status: Succeeded | ||
preDeploymentStatus: Succeeded | ||
startTime: "2022-12-14T13:17:36Z" | ||
status: Progressing | ||
workloadOverallStatus: Progressing | ||
workloadStatus: | ||
- status: Progressing | ||
workload: | ||
name: podtato-head-left-arm | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-left-leg | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-entry | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-right-arm | ||
version: 0.1.0 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-right-leg | ||
version: 0.2.7 | ||
- status: Succeeded | ||
workload: | ||
name: podtato-head-hat | ||
version: 0.1.0 |
14 changes: 14 additions & 0 deletions
14
resource_customizations/lifecycle.keptn.sh/KeptnEvaluation/health.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
hs = {} | ||
if obj.status.overallStatus == "Succeeded" then | ||
hs.status = "Healthy" | ||
hs.message = "KeptnEvaluation is healthy" | ||
return hs | ||
end | ||
if obj.status.overallStatus == "Failed" then | ||
hs.status = "Degraded" | ||
hs.message = "KeptnEvaluation is degraded" | ||
return hs | ||
end | ||
hs.status = "Progressing" | ||
hs.message = "KeptnEvaluation is progressing" | ||
return hs |
13 changes: 13 additions & 0 deletions
13
resource_customizations/lifecycle.keptn.sh/KeptnEvaluation/health_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
tests: | ||
- healthStatus: | ||
status: Progressing | ||
message: "KeptnEvaluation is progressing" | ||
inputPath: testdata/progressing.yaml | ||
- healthStatus: | ||
status: Degraded | ||
message: "KeptnEvaluation is degraded" | ||
inputPath: testdata/degraded.yaml | ||
- healthStatus: | ||
status: Healthy | ||
message: "KeptnEvaluation is healthy" | ||
inputPath: testdata/healthy.yaml |
33 changes: 33 additions & 0 deletions
33
resource_customizations/lifecycle.keptn.sh/KeptnEvaluation/testdata/degraded.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: lifecycle.keptn.sh/v1alpha2 | ||
kind: KeptnEvaluation | ||
metadata: | ||
creationTimestamp: "2022-12-14T13:17:36Z" | ||
generation: 1 | ||
name: pre-eval-app-pre-deploy-eval-2-48925 | ||
namespace: podtato-kubectl | ||
ownerReferences: | ||
- apiVersion: lifecycle.keptn.sh/v1alpha2 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: KeptnAppVersion | ||
name: podtato-head-0.1.1 | ||
uid: 9ae27184-c63d-4e50-bbc7-18e5e289e85c | ||
resourceVersion: "225737" | ||
uid: 84acabb8-9dca-46ab-b099-4799a732ba43 | ||
spec: | ||
appName: podtato-head | ||
appVersion: 0.1.1 | ||
checkType: pre-eval | ||
evaluationDefinition: app-pre-deploy-eval-2 | ||
retries: 10 | ||
retryInterval: 5s | ||
workloadVersion: "" | ||
status: | ||
endTime: "2022-12-14T13:17:36Z" | ||
evaluationStatus: | ||
available-cpus: | ||
status: Failed | ||
value: "0.25" | ||
overallStatus: Failed | ||
retryCount: 1 | ||
startTime: "2022-12-14T13:17:36Z" |
Oops, something went wrong.