forked from redhat-cop/gitops-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add health check objects for OpenShift AI
- Loading branch information
1 parent
adb3545
commit b80482c
Showing
5 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
openshift-gitops-operator/instance/components/health-check-openshift-ai/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
15 changes: 15 additions & 0 deletions
15
openshift-gitops-operator/instance/components/health-check-openshift-ai/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
56 changes: 56 additions & 0 deletions
56
.../instance/components/health-check-openshift-ai/patch-datasciencecluster-health-check.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
end | ||
elseif condition.status == "False" then | ||
componentsDegraded = componentsDegraded + 1 | ||
msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. " | " .. condition.reason .. " | " .. condition.message .. "\n" | ||
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 |
42 changes: 42 additions & 0 deletions
42
...mponents/health-check-openshift-ai/patch-datasciencepipelineapplication-health-check.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
42 changes: 42 additions & 0 deletions
42
...s-operator/instance/components/health-check-openshift-ai/patch-notebook-health-check.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |