Skip to content

Commit

Permalink
add health check objects for OpenShift AI
Browse files Browse the repository at this point in the history
  • Loading branch information
strangiato committed Apr 22, 2024
1 parent adb3545 commit b80482c
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# health-check-openshift-ai

## Purpose
This component is designed to enable custom health checks for OpenShift AI.

## Not Yet Imlimented

Several custom resources created by OpenShift AI have not yet been implimented with Health Checks. Those include the following:

KServe/ModelMesh:

- servingruntimes
- inferenceservice
- inferencegraph

Distributed Compute

## Usage

This component can be added to a base by adding the `components` section to your overlay `kustomization.yaml` file:

```
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
components:
- ../../components/health-check-openshift-ai
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- path: patch-datasciencecluster-health-check.yaml
target:
kind: ArgoCD
- path: patch-datasciencepipelineapplication-health-check.yaml
target:
kind: ArgoCD
- path: patch-notebook-health-check.yaml
target:
kind: ArgoCD


Check failure on line 15 in openshift-gitops-operator/instance/components/health-check-openshift-ai/kustomization.yaml

View workflow job for this annotation

GitHub Actions / lint-yaml

15:1 [empty-lines] too many blank lines (2 > 0)
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
- op: add
path: /spec/resourceHealthChecks/-
value:
group: datasciencecluster.opendatahub.io
kind: DataScienceCluster
check: |
health_status = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
msg = ""
componentsDegraded = 0
available = false
progressing = false
degraded = false
for i, condition in pairs(obj.status.conditions) do
if condition.type == "Available" and condition.status == "True" then
available = true
elseif condition.type == "Progressing" then
if condition.status == "True" then
progressing = true
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. " | " .. condition.reason .. " | " .. condition.message .. "\n"
end
elseif condition.type == "Degraded" then
if condition.status == "True" then
degraded = true
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. " | " .. condition.reason .. " | " .. condition.message .. "\n"

Check failure on line 27 in openshift-gitops-operator/instance/components/health-check-openshift-ai/patch-datasciencecluster-health-check.yaml

View workflow job for this annotation

GitHub Actions / lint-yaml

27:153 [trailing-spaces] trailing spaces
end
elseif condition.status == "False" then
componentsDegraded = componentsDegraded + 1
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. " | " .. condition.reason .. " | " .. condition.message .. "\n"

Check failure on line 31 in openshift-gitops-operator/instance/components/health-check-openshift-ai/patch-datasciencecluster-health-check.yaml

View workflow job for this annotation

GitHub Actions / lint-yaml

31:151 [trailing-spaces] trailing spaces
end
end
if available == true and componentsDegraded == 0 then
health_status.status = "Healthy"
elseif progressing == true then
health_status.status = "Progressing"
elseif degraded == true or componentsDegraded > 0 then
health_status.status = "Degraded"
else
health_status.status = "Degraded"
end
health_status.message = msg
else
health_status.status = "Progressing"
health_status.message = "DataScienceCluster is creating..."
end
else
health_status.status = "Progressing"
health_status.message = "DataScienceCluster is creating..."
end
return health_status
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
- op: add
path: /spec/resourceHealthChecks/-
value:
group: datasciencepipelinesapplications.opendatahub.io
kind: DataSciencePipelinesApplication
check: |
health_status = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
msg = ""
progressing = false
degraded = false
for i, condition in pairs(obj.status.conditions) do
if condition.status == "False" then
progressing = true
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. " | " .. condition.reason .. " | " .. condition.message .. "\n"
end
end
if progressing == false and degraded == false then
health_status.status = "Healthy"
elseif progressing == true then
health_status.status = "Progressing"
elseif degraded == false then
-- there is no condition that can help to distinguish between a degraded and progressing object
-- for now, we will just always keep the object as progressing and never set it to degraded
health_status.status = "Degraded"
end
health_status.message = msg
else
health_status.status = "Progressing"
health_status.message = "DataSciencePipelineApplication is creating..."
end
else
health_status.status = "Progressing"
health_status.message = "DataSciencePipelineApplication is creating..."
end
return health_status
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
- op: add
path: /spec/resourceHealthChecks/-
value:
group: kubeflow.org
kind: Notebook
check: |
health_status = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
msg = ""
progressing = false
degraded = false
for i, condition in pairs(obj.status.conditions) do
if condition.status == "False" then
progressing = true
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. " | " .. condition.reason .. " | " .. condition.message .. "\n"
end
end
if progressing == false and degraded == false then
health_status.status = "Healthy"
elseif progressing == true then
health_status.status = "Progressing"
elseif degraded == false then
-- there is no condition that can help to distinguish between a degraded and progressing object
-- for now, we will just always keep the object as progressing and never set it to degraded
health_status.status = "Degraded"
end
health_status.message = msg
else
health_status.status = "Progressing"
health_status.message = "Notebook is creating..."
end
else
health_status.status = "Progressing"
health_status.message = "Notebook is creating..."
end
return health_status

0 comments on commit b80482c

Please sign in to comment.