fix(health): configconnectorcontext and configconnector (#26308) (#26309)

Signed-off-by: solidnerd <github@mietz.io>
Signed-off-by: solidnerd <niclas@mietz.io>
This commit is contained in:
Niclas Mietz
2026-02-11 22:04:13 +01:00
committed by GitHub
parent 1391e2f95f
commit a22f33dbe2
7 changed files with 95 additions and 1 deletions

View File

@@ -3,6 +3,22 @@ local hs = {
message = "Update in progress" message = "Update in progress"
} }
if obj.status ~= nil then 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 if obj.status.conditions ~= nil then
-- Progressing health while the resource status is stale, skip if observedGeneration is not set -- Progressing health while the resource status is stale, skip if observedGeneration is not set

View File

@@ -22,4 +22,24 @@ tests:
- healthStatus: - healthStatus:
status: Progressing status: Progressing
message: 'Update in progress' 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

View 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: false
observedGeneration: 1

View 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

View 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

View 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

View 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