mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
feat(health): add grafana-org-operator Health (#25662)
Signed-off-by: Mathieu Parent <math.parent@etik.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
for i, condition in ipairs(obj.status.conditions) do
|
||||
if condition.type == "Ready" then
|
||||
hs.message = condition.message
|
||||
if condition.status == "False" then
|
||||
hs.status = "Degraded"
|
||||
elseif condition.status == "True" then
|
||||
hs.status = "Healthy"
|
||||
else
|
||||
hs.status = "Progressing"
|
||||
end
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting ..."
|
||||
return hs
|
||||
@@ -0,0 +1,17 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Waiting ..."
|
||||
inputPath: testdata/empty.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "Grafana Instance reconciled"
|
||||
inputPath: testdata/healthy.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: >-
|
||||
Failed to reach Grafana instance: Get
|
||||
"http://grafana.grafana.invalid/api/user": dial tcp:
|
||||
lookup grafana.grafana.invalid on 10.20.30.40:53: server
|
||||
misbehaving
|
||||
inputPath: testdata/degraded.yaml
|
||||
20
resource_customizations/grafana-org-operator.kubitus-project.gitlab.io/_/testdata/degraded.yaml
vendored
Normal file
20
resource_customizations/grafana-org-operator.kubitus-project.gitlab.io/_/testdata/degraded.yaml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
apiVersion: grafana-org-operator.kubitus-project.gitlab.io/v1beta1
|
||||
kind: GrafanaInstance
|
||||
metadata:
|
||||
name: grafana
|
||||
namespace: grafana-org-operator
|
||||
spec:
|
||||
url: http://grafana.grafana.svc.invalid
|
||||
secretRef: grafana-admin
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: '2025-12-15T13:20:19Z'
|
||||
message: >-
|
||||
Failed to reach Grafana instance: Get
|
||||
"http://grafana.grafana.invalid/api/user": dial tcp:
|
||||
lookup grafana.grafana.invalid on 10.20.30.40:53: server
|
||||
misbehaving
|
||||
observedGeneration: 42
|
||||
reason: Unreachable
|
||||
status: 'False'
|
||||
type: Ready
|
||||
8
resource_customizations/grafana-org-operator.kubitus-project.gitlab.io/_/testdata/empty.yaml
vendored
Normal file
8
resource_customizations/grafana-org-operator.kubitus-project.gitlab.io/_/testdata/empty.yaml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: grafana-org-operator.kubitus-project.gitlab.io/v1beta1
|
||||
kind: GrafanaOrg
|
||||
metadata:
|
||||
name: my-org
|
||||
namespace: grafana-org-operator
|
||||
spec:
|
||||
grafanaInstanceRef: grafana
|
||||
orgName: My Org.
|
||||
16
resource_customizations/grafana-org-operator.kubitus-project.gitlab.io/_/testdata/healthy.yaml
vendored
Normal file
16
resource_customizations/grafana-org-operator.kubitus-project.gitlab.io/_/testdata/healthy.yaml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: grafana-org-operator.kubitus-project.gitlab.io/v1beta1
|
||||
kind: GrafanaInstance
|
||||
metadata:
|
||||
name: grafana
|
||||
namespace: grafana-org-operator
|
||||
spec:
|
||||
url: http://grafana.grafana.svc
|
||||
secretRef: grafana-admin
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: '2025-10-21T12:33:41Z'
|
||||
message: Grafana Instance reconciled
|
||||
observedGeneration: 1
|
||||
reason: Reconciled
|
||||
status: 'True'
|
||||
type: Ready
|
||||
@@ -1075,5 +1075,10 @@ func Test_getHealthScriptPaths(t *testing.T) {
|
||||
|
||||
// This test will fail any time a glob pattern is added to the health script paths. We don't expect that to happen
|
||||
// often.
|
||||
assert.Equal(t, []string{"_.cnrm.cloud.google.com/_", "_.crossplane.io/_", "_.upbound.io/_"}, paths)
|
||||
assert.Equal(t, []string{
|
||||
"_.cnrm.cloud.google.com/_",
|
||||
"_.crossplane.io/_",
|
||||
"_.upbound.io/_",
|
||||
"grafana-org-operator.kubitus-project.gitlab.io/_",
|
||||
}, paths)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user