mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
Signed-off-by: solidnerd <github@mietz.io> Signed-off-by: solidnerd <niclas@mietz.io>
This commit is contained in:
@@ -3,6 +3,22 @@ local hs = {
|
||||
message = "Update in progress"
|
||||
}
|
||||
if obj.status ~= nil then
|
||||
-- ConfigConnector and ConfigConnectorContext use status.healthy instead of conditions
|
||||
if (obj.kind == "ConfigConnector" or obj.kind == "ConfigConnectorContext") and obj.status.healthy ~= nil then
|
||||
-- Check if status is stale
|
||||
if obj.status.observedGeneration == nil or obj.status.observedGeneration == obj.metadata.generation then
|
||||
if obj.status.healthy == true then
|
||||
hs.status = "Healthy"
|
||||
hs.message = obj.kind .. " is healthy"
|
||||
return hs
|
||||
else
|
||||
hs.status = "Degraded"
|
||||
hs.message = obj.kind .. " is not healthy"
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if obj.status.conditions ~= nil then
|
||||
|
||||
-- Progressing health while the resource status is stale, skip if observedGeneration is not set
|
||||
|
||||
@@ -22,4 +22,24 @@ tests:
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: 'Update in progress'
|
||||
inputPath: testdata/generation.yaml
|
||||
inputPath: testdata/generation.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "ConfigConnectorContext is healthy"
|
||||
inputPath: testdata/config-connector-context.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "ConfigConnectorContext is not healthy"
|
||||
inputPath: testdata/config-connector-context-unhealthy.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "ConfigConnector is healthy"
|
||||
inputPath: testdata/config-connector-healthy.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "ConfigConnector is not healthy"
|
||||
inputPath: testdata/config-connector-unhealthy.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Update in progress"
|
||||
inputPath: testdata/config-connector-stale.yaml
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: core.cnrm.cloud.google.com/v1beta1
|
||||
kind: ConfigConnectorContext
|
||||
metadata:
|
||||
generation: 1
|
||||
name: configconnectorcontext.core.cnrm.cloud.google.com
|
||||
namespace: foo
|
||||
spec:
|
||||
googleServiceAccount: foo@bar.iam.gserviceaccount.com
|
||||
status:
|
||||
healthy: false
|
||||
observedGeneration: 1
|
||||
11
resource_customizations/_.cnrm.cloud.google.com/_/testdata/config-connector-context.yaml
vendored
Normal file
11
resource_customizations/_.cnrm.cloud.google.com/_/testdata/config-connector-context.yaml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
apiVersion: core.cnrm.cloud.google.com/v1beta1
|
||||
kind: ConfigConnectorContext
|
||||
metadata:
|
||||
generation: 1
|
||||
name: configconnectorcontext.core.cnrm.cloud.google.com
|
||||
namespace: foo
|
||||
spec:
|
||||
googleServiceAccount: foo@bar.iam.gserviceaccount.com
|
||||
status:
|
||||
healthy: true
|
||||
observedGeneration: 1
|
||||
12
resource_customizations/_.cnrm.cloud.google.com/_/testdata/config-connector-healthy.yaml
vendored
Normal file
12
resource_customizations/_.cnrm.cloud.google.com/_/testdata/config-connector-healthy.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: core.cnrm.cloud.google.com/v1beta1
|
||||
kind: ConfigConnector
|
||||
metadata:
|
||||
finalizers:
|
||||
- configconnector.cnrm.cloud.google.com/finalizer
|
||||
generation: 2
|
||||
name: configconnector.core.cnrm.cloud.google.com
|
||||
spec:
|
||||
mode: namespaced
|
||||
status:
|
||||
healthy: true
|
||||
observedGeneration: 2
|
||||
12
resource_customizations/_.cnrm.cloud.google.com/_/testdata/config-connector-stale.yaml
vendored
Normal file
12
resource_customizations/_.cnrm.cloud.google.com/_/testdata/config-connector-stale.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: core.cnrm.cloud.google.com/v1beta1
|
||||
kind: ConfigConnector
|
||||
metadata:
|
||||
finalizers:
|
||||
- configconnector.cnrm.cloud.google.com/finalizer
|
||||
generation: 3
|
||||
name: configconnector.core.cnrm.cloud.google.com
|
||||
spec:
|
||||
mode: namespaced
|
||||
status:
|
||||
healthy: true
|
||||
observedGeneration: 2
|
||||
12
resource_customizations/_.cnrm.cloud.google.com/_/testdata/config-connector-unhealthy.yaml
vendored
Normal file
12
resource_customizations/_.cnrm.cloud.google.com/_/testdata/config-connector-unhealthy.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: core.cnrm.cloud.google.com/v1beta1
|
||||
kind: ConfigConnector
|
||||
metadata:
|
||||
finalizers:
|
||||
- configconnector.cnrm.cloud.google.com/finalizer
|
||||
generation: 2
|
||||
name: configconnector.core.cnrm.cloud.google.com
|
||||
spec:
|
||||
mode: namespaced
|
||||
status:
|
||||
healthy: false
|
||||
observedGeneration: 2
|
||||
Reference in New Issue
Block a user