mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
feat(health): Added KeptnMetric (#19210)
Signed-off-by: asamonik <49288593+asamonik@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
local hs = {}
|
||||
if (obj.status.errMsg == nil or obj.status.errMsg == "") and obj.status.value ~= nil then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "KeptnMetric is healthy"
|
||||
return hs
|
||||
end
|
||||
if obj.status.errMsg ~= nil and obj.status.errMsg ~= "" then
|
||||
hs.status = "Degraded"
|
||||
hs.message = "KeptnMetric is degraded"
|
||||
return hs
|
||||
end
|
||||
hs.status = "Progressing"
|
||||
hs.message = "KeptnMetric is progressing"
|
||||
return hs
|
||||
@@ -0,0 +1,17 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "KeptnMetric is progressing"
|
||||
inputPath: testdata/progressing.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "KeptnMetric is degraded"
|
||||
inputPath: testdata/degraded.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "KeptnMetric is healthy"
|
||||
inputPath: testdata/healthy.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "KeptnMetric is healthy"
|
||||
inputPath: testdata/healthy_empty_error.yaml
|
||||
24
resource_customizations/metrics.keptn.sh/KeptnMetric/testdata/degraded.yaml
vendored
Normal file
24
resource_customizations/metrics.keptn.sh/KeptnMetric/testdata/degraded.yaml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: metrics.keptn.sh/v1
|
||||
kind: KeptnMetric
|
||||
metadata:
|
||||
annotations:
|
||||
kubectl.kubernetes.io/last-applied-configuration: >
|
||||
{"apiVersion":"metrics.keptn.sh/v1","kind":"KeptnMetric","metadata":{"annotations":{},"labels":{"app.kubernetes.io/instance":"podtato-head"},"name":"available-cpus","namespace":"podtato-kubectl"},"spec":{"fetchIntervalSeconds":10,"provider":{"name":"my-provider"},"query":"sum(kube_node_status_capacity{resource='cpu'})"}}
|
||||
creationTimestamp: '2024-07-16T07:34:42Z'
|
||||
generation: 1
|
||||
labels:
|
||||
app.kubernetes.io/instance: podtato-head
|
||||
name: available-cpus
|
||||
namespace: podtato-kubectl
|
||||
resourceVersion: '405403'
|
||||
uid: c448a014-b6b6-45a4-91ff-89949b9d0fce
|
||||
spec:
|
||||
fetchIntervalSeconds: 10
|
||||
provider:
|
||||
name: my-provider
|
||||
query: sum(kube_node_status_capacity{resource='cpu'})
|
||||
status:
|
||||
errMsg: >-
|
||||
Post "http://prometheus-k8s.monitoring.svc.cluster.local:9090/api/v1/query":
|
||||
dial tcp: lookup prometheus-k8s.monitoring.svc.cluster.local on
|
||||
lastUpdated: '2024-07-23T12:49:44Z'
|
||||
22
resource_customizations/metrics.keptn.sh/KeptnMetric/testdata/healthy.yaml
vendored
Normal file
22
resource_customizations/metrics.keptn.sh/KeptnMetric/testdata/healthy.yaml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: metrics.keptn.sh/v1
|
||||
kind: KeptnMetric
|
||||
metadata:
|
||||
annotations:
|
||||
kubectl.kubernetes.io/last-applied-configuration: >
|
||||
{"apiVersion":"metrics.keptn.sh/v1","kind":"KeptnMetric","metadata":{"annotations":{},"labels":{"app.kubernetes.io/instance":"podtato-head"},"name":"available-cpus","namespace":"podtato-kubectl"},"spec":{"fetchIntervalSeconds":10,"provider":{"name":"my-provider"},"query":"sum(kube_node_status_capacity{resource='cpu'})"}}
|
||||
creationTimestamp: '2024-07-16T07:34:42Z'
|
||||
generation: 1
|
||||
labels:
|
||||
app.kubernetes.io/instance: podtato-head
|
||||
name: available-cpus
|
||||
namespace: podtato-kubectl
|
||||
resourceVersion: '405403'
|
||||
uid: c448a014-b6b6-45a4-91ff-89949b9d0fce
|
||||
spec:
|
||||
fetchIntervalSeconds: 10
|
||||
provider:
|
||||
name: my-provider
|
||||
query: sum(kube_node_status_capacity{resource='cpu'})
|
||||
status:
|
||||
value: '100'
|
||||
lastUpdated: '2024-07-23T12:49:44Z'
|
||||
23
resource_customizations/metrics.keptn.sh/KeptnMetric/testdata/healthy_empty_error.yaml
vendored
Normal file
23
resource_customizations/metrics.keptn.sh/KeptnMetric/testdata/healthy_empty_error.yaml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: metrics.keptn.sh/v1
|
||||
kind: KeptnMetric
|
||||
metadata:
|
||||
annotations:
|
||||
kubectl.kubernetes.io/last-applied-configuration: >
|
||||
{"apiVersion":"metrics.keptn.sh/v1","kind":"KeptnMetric","metadata":{"annotations":{},"labels":{"app.kubernetes.io/instance":"podtato-head"},"name":"available-cpus","namespace":"podtato-kubectl"},"spec":{"fetchIntervalSeconds":10,"provider":{"name":"my-provider"},"query":"sum(kube_node_status_capacity{resource='cpu'})"}}
|
||||
creationTimestamp: '2024-07-16T07:34:42Z'
|
||||
generation: 1
|
||||
labels:
|
||||
app.kubernetes.io/instance: podtato-head
|
||||
name: available-cpus
|
||||
namespace: podtato-kubectl
|
||||
resourceVersion: '405403'
|
||||
uid: c448a014-b6b6-45a4-91ff-89949b9d0fce
|
||||
spec:
|
||||
fetchIntervalSeconds: 10
|
||||
provider:
|
||||
name: my-provider
|
||||
query: sum(kube_node_status_capacity{resource='cpu'})
|
||||
status:
|
||||
errMsg: ""
|
||||
value: 100
|
||||
lastUpdated: '2024-07-23T12:49:44Z'
|
||||
21
resource_customizations/metrics.keptn.sh/KeptnMetric/testdata/progressing.yaml
vendored
Normal file
21
resource_customizations/metrics.keptn.sh/KeptnMetric/testdata/progressing.yaml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
apiVersion: metrics.keptn.sh/v1
|
||||
kind: KeptnMetric
|
||||
metadata:
|
||||
annotations:
|
||||
kubectl.kubernetes.io/last-applied-configuration: >
|
||||
{"apiVersion":"metrics.keptn.sh/v1","kind":"KeptnMetric","metadata":{"annotations":{},"labels":{"app.kubernetes.io/instance":"podtato-head"},"name":"available-cpus","namespace":"podtato-kubectl"},"spec":{"fetchIntervalSeconds":10,"provider":{"name":"my-provider"},"query":"sum(kube_node_status_capacity{resource='cpu'})"}}
|
||||
creationTimestamp: '2024-07-16T07:34:42Z'
|
||||
generation: 1
|
||||
labels:
|
||||
app.kubernetes.io/instance: podtato-head
|
||||
name: available-cpus
|
||||
namespace: podtato-kubectl
|
||||
resourceVersion: '405403'
|
||||
uid: c448a014-b6b6-45a4-91ff-89949b9d0fce
|
||||
spec:
|
||||
fetchIntervalSeconds: 10
|
||||
provider:
|
||||
name: my-provider
|
||||
query: sum(kube_node_status_capacity{resource='cpu'})
|
||||
status:
|
||||
lastUpdated: '2024-07-23T12:49:44Z'
|
||||
Reference in New Issue
Block a user