Skip to content

Commit

Permalink
feat: add health checks for keptn resources (argoproj#11716)
Browse files Browse the repository at this point in the history
* 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>
Signed-off-by: emirot <emirot.nolan@gmail.com>
  • Loading branch information
2 people authored and emirot committed Jan 27, 2023
1 parent 435d842 commit 296f55e
Show file tree
Hide file tree
Showing 20 changed files with 746 additions and 0 deletions.
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
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
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
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
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
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
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
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"

0 comments on commit 296f55e

Please sign in to comment.