This commit is contained in:
Asish Kumar 2026-04-21 09:26:53 +03:00 committed by GitHub
commit 71196932c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 239 additions and 0 deletions

View file

@ -0,0 +1,21 @@
local health_status = {}
if obj.metadata ~= nil and obj.metadata.generation ~= nil and obj.status ~= nil and obj.status.observedGeneration ~= nil and obj.metadata.generation ~= obj.status.observedGeneration then
health_status.status = "Progressing"
health_status.message = "Waiting for DataScienceCluster spec update to be observed"
return health_status
end
if obj.status ~= nil and obj.status.phase ~= nil then
if obj.status.phase == "Ready" then
health_status.status = "Healthy"
health_status.message = "DataScienceCluster is ready"
return health_status
end
if obj.status.phase == "Error" then
health_status.status = "Degraded"
health_status.message = obj.status.errorMessage or "DataScienceCluster encountered an error"
return health_status
end
end
health_status.status = "Progressing"
health_status.message = "Waiting for DataScienceCluster to become ready"
return health_status

View file

@ -0,0 +1,25 @@
tests:
- healthStatus:
status: Healthy
message: "DataScienceCluster is ready"
inputPath: testdata/healthy.yaml
- healthStatus:
status: Progressing
message: "Waiting for DataScienceCluster to become ready"
inputPath: testdata/progressing.yaml
- healthStatus:
status: Progressing
message: "Waiting for DataScienceCluster to become ready"
inputPath: testdata/progressing_not_ready.yaml
- healthStatus:
status: Progressing
message: "Waiting for DataScienceCluster spec update to be observed"
inputPath: testdata/stale_generation.yaml
- healthStatus:
status: Degraded
message: "component dashboard is in error state"
inputPath: testdata/degraded.yaml
- healthStatus:
status: Progressing
message: "Waiting for DataScienceCluster to become ready"
inputPath: testdata/no_status.yaml

View file

@ -0,0 +1,17 @@
apiVersion: datasciencecluster.opendatahub.io/v1
kind: DataScienceCluster
metadata:
name: default-dsc
namespace: opendatahub
spec:
components:
dashboard:
managementState: Managed
status:
phase: Error
errorMessage: "component dashboard is in error state"
conditions:
- type: Ready
status: "False"
reason: Error
message: "component dashboard is in error state"

View file

@ -0,0 +1,16 @@
apiVersion: datasciencecluster.opendatahub.io/v1
kind: DataScienceCluster
metadata:
name: default-dsc
namespace: opendatahub
spec:
components:
dashboard:
managementState: Managed
status:
phase: Ready
conditions:
- type: Ready
status: "True"
reason: Ready
message: "All components are ready"

View file

@ -0,0 +1,9 @@
apiVersion: datasciencecluster.opendatahub.io/v1
kind: DataScienceCluster
metadata:
name: default-dsc
namespace: opendatahub
spec:
components:
dashboard:
managementState: Managed

View file

@ -0,0 +1,16 @@
apiVersion: datasciencecluster.opendatahub.io/v1
kind: DataScienceCluster
metadata:
name: default-dsc
namespace: opendatahub
spec:
components:
dashboard:
managementState: Managed
status:
phase: Progressing
conditions:
- type: Ready
status: "Unknown"
reason: Progressing
message: "Reconciliation in progress"

View file

@ -0,0 +1,16 @@
apiVersion: datasciencecluster.opendatahub.io/v1
kind: DataScienceCluster
metadata:
name: default-dsc
namespace: opendatahub
spec:
components:
dashboard:
managementState: Managed
status:
phase: "Not Ready"
conditions:
- type: Ready
status: "False"
reason: NotReady
message: "Some components are not ready"

View file

@ -0,0 +1,18 @@
apiVersion: datasciencecluster.opendatahub.io/v1
kind: DataScienceCluster
metadata:
name: default-dsc
namespace: opendatahub
generation: 2
spec:
components:
dashboard:
managementState: Managed
status:
phase: Ready
observedGeneration: 1
conditions:
- type: Ready
status: "True"
reason: Ready
message: "All components are ready"

View file

@ -0,0 +1,21 @@
local health_status = {}
if obj.metadata ~= nil and obj.metadata.generation ~= nil and obj.status ~= nil and obj.status.observedGeneration ~= nil and obj.metadata.generation ~= obj.status.observedGeneration then
health_status.status = "Progressing"
health_status.message = "Waiting for DSCInitialization spec update to be observed"
return health_status
end
if obj.status ~= nil and obj.status.phase ~= nil then
if obj.status.phase == "Ready" then
health_status.status = "Healthy"
health_status.message = "DSCInitialization is ready"
return health_status
end
if obj.status.phase == "Error" then
health_status.status = "Degraded"
health_status.message = obj.status.errorMessage or "DSCInitialization encountered an error"
return health_status
end
end
health_status.status = "Progressing"
health_status.message = "Waiting for DSCInitialization to become ready"
return health_status

View file

@ -0,0 +1,21 @@
tests:
- healthStatus:
status: Healthy
message: "DSCInitialization is ready"
inputPath: testdata/healthy.yaml
- healthStatus:
status: Progressing
message: "Waiting for DSCInitialization to become ready"
inputPath: testdata/progressing.yaml
- healthStatus:
status: Progressing
message: "Waiting for DSCInitialization to become ready"
inputPath: testdata/progressing_not_ready.yaml
- healthStatus:
status: Degraded
message: "failed to configure monitoring"
inputPath: testdata/degraded.yaml
- healthStatus:
status: Progressing
message: "Waiting for DSCInitialization to become ready"
inputPath: testdata/no_status.yaml

View file

@ -0,0 +1,14 @@
apiVersion: dscinitialization.opendatahub.io/v1
kind: DSCInitialization
metadata:
name: default-dsci
spec:
applicationsNamespace: opendatahub
status:
phase: Error
errorMessage: "failed to configure monitoring"
conditions:
- type: Ready
status: "False"
reason: Error
message: "failed to configure monitoring"

View file

@ -0,0 +1,13 @@
apiVersion: dscinitialization.opendatahub.io/v1
kind: DSCInitialization
metadata:
name: default-dsci
spec:
applicationsNamespace: opendatahub
status:
phase: Ready
conditions:
- type: Ready
status: "True"
reason: Ready
message: "DSCInitialization is ready"

View file

@ -0,0 +1,6 @@
apiVersion: dscinitialization.opendatahub.io/v1
kind: DSCInitialization
metadata:
name: default-dsci
spec:
applicationsNamespace: opendatahub

View file

@ -0,0 +1,13 @@
apiVersion: dscinitialization.opendatahub.io/v1
kind: DSCInitialization
metadata:
name: default-dsci
spec:
applicationsNamespace: opendatahub
status:
phase: Progressing
conditions:
- type: Ready
status: "Unknown"
reason: Progressing
message: "Reconciliation in progress"

View file

@ -0,0 +1,13 @@
apiVersion: dscinitialization.opendatahub.io/v1
kind: DSCInitialization
metadata:
name: default-dsci
spec:
applicationsNamespace: opendatahub
status:
phase: "Not Ready"
conditions:
- type: Ready
status: "False"
reason: NotReady
message: "DSCInitialization is not ready"