diff --git a/content/patterns/openshift-aiops-platform/_index.adoc b/content/patterns/openshift-aiops-platform/_index.adoc new file mode 100644 index 0000000000..18c19e0396 --- /dev/null +++ b/content/patterns/openshift-aiops-platform/_index.adoc @@ -0,0 +1,43 @@ +--- +title: OpenShift AIOps Self-Healing Platform +date: 2026-02-26 +tier: sandbox +summary: This pattern provides an AI-powered self-healing platform for OpenShift clusters, combining deterministic automation with machine learning for intelligent incident response. +rh_products: +- Red Hat OpenShift Container Platform +- Red Hat OpenShift Service on AWS +- Red Hat OpenShift AI +- Red Hat OpenShift GitOps +- Red Hat OpenShift Pipelines +- Red Hat OpenShift Data Foundation +industries: +- General +pattern_logo: openshift-aiops-platform.png +links: + github: https://github.com/KubeHeal/openshift-aiops-platform + install: getting-started + arch: https://github.com/KubeHeal/openshift-aiops-platform/blob/main/docs/adrs/002-hybrid-self-healing-approach.md + bugs: https://github.com/KubeHeal/openshift-aiops-platform/issues + feedback: https://github.com/KubeHeal/openshift-aiops-platform/discussions +ci: openshift-aiops-platform +--- +:toc: +:imagesdir: /images +:_content-type: ASSEMBLY +include::modules/comm-attributes.adoc[] +include::modules/openshift-aiops-platform/metadata-openshift-aiops-platform.adoc[] + +include::modules/oaiops-about.adoc[leveloffset=+1] + +include::modules/oaiops-solution-elements.adoc[leveloffset=+2] + +include::modules/oaiops-architecture.adoc[leveloffset=+1] + +[id="next-steps_openshift-aiops-platform-index"] +== Next steps + +* link:getting-started[Deploy the OpenShift AIOps Self-Healing Platform] +* Review the link:cluster-sizing[cluster sizing requirements] +* Explore link:ideas-for-customization[customization options] +* Read link:{repo_url}/blob/main/docs/adrs/002-hybrid-self-healing-approach.md[the hybrid self-healing architecture decision record] +* Report a problem at link:{issues_url}[GitHub issues] diff --git a/content/patterns/openshift-aiops-platform/cluster-sizing.adoc b/content/patterns/openshift-aiops-platform/cluster-sizing.adoc new file mode 100644 index 0000000000..d3845f4438 --- /dev/null +++ b/content/patterns/openshift-aiops-platform/cluster-sizing.adoc @@ -0,0 +1,144 @@ +--- +title: Cluster sizing +weight: 50 +aliases: /openshift-aiops-platform/openshift-aiops-platform-cluster-sizing/ +--- + +:toc: +:imagesdir: /images +:_content-type: ASSEMBLY + +include::modules/comm-attributes.adoc[] +include::modules/openshift-aiops-platform/metadata-openshift-aiops-platform.adoc[] + +include::modules/cluster-sizing-template.adoc[] + +[id="additional-sizing-considerations-openshift-aiops"] +== Additional sizing considerations + +The tested minimum is the table above. +On Amazon Web Services that minimum is {requirements_hub_compute_platform_aws_replicas} worker replica of type {requirements_hub_compute_platform_aws_type}, and {requirements_hub_controlPlane_platform_aws_replicas} control plane replica of type {requirements_hub_controlPlane_platform_aws_type}. +Managed clusters are out of scope. +`spoke_support` is `false` in `pattern-metadata.yaml`, so this page has no spoke size. + +[id="oaiops-optional-scale-up"] +=== Optional larger layouts + +These layouts are larger than the tested minimum. +Use one of them when the workload needs it. + +*ROSA Classic highly available*:: +ROSA manages the control plane. +You configure only worker nodes by using machine pools. +Three `m5.2xlarge` workers are a common production starting point. +Add a `g5.2xlarge` machine pool when you want a GPU for training. + +*Installer-provisioned infrastructure or bare metal*:: +A larger self-managed layout is three control plane nodes and six compute nodes. +That layout is guidance, not the tested minimum in the table. + +*Single-node OpenShift*:: +One node can run the pattern for a lab or an edge site. +Start with 8 vCPUs, 32 GB of memory, and 120 GB of disk. +16 vCPUs and 64 GB of memory leave more room for notebooks and model serving. + +[NOTE] +==== +A single-node deployment has no node failover. +It fits a lab, an edge site, or a case where you manage a single cluster. +The install detects the topology when `cluster.topology` is `sno`. +==== + +Confirm the topology before you install: + +[source,terminal] +---- +$ make show-cluster-info +---- + +[id="oaiops-configure-storage"] +== Storage for clusters without S3 + +The install procedure does not install OpenShift Data Foundation. +ROSA clusters use Amazon S3, so they skip this section. + +`scripts/configure-cluster-infrastructure.sh` does all of the following: + +* Detects ROSA, highly available, or single-node topology. +* On installer-provisioned infrastructure, scales worker MachineSets when the cluster has fewer than three workers. +On ROSA, it leaves MachinePools alone. +* Installs OpenShift Data Foundation unless you pass `--skip-odf`. +Highly available clusters get Ceph and NooBaa. +Single-node clusters get NooBaa only. +* Waits until the storage objects are ready. + +Pass `--skip-odf` when S3-compatible storage already exists, including ROSA with Amazon S3: + +[source,terminal] +---- +$ ./scripts/configure-cluster-infrastructure.sh --skip-odf +---- + +Omit `--skip-odf` when the script should install OpenShift Data Foundation: + +[source,terminal] +---- +$ make configure-cluster +---- + +`make configure-cluster` is the same script with no extra flags. + +[id="oaiops-storage-guidance"] +== Storage guidance + +These sizes are examples from the default values, not a second minimum. + +[cols="2,2,3",options="header"] +|=== +|Use |Size |Storage class + +|Model files shared by notebooks and KServe +|10Gi +|`ocs-storagecluster-cephfs` on a highly available cluster with OpenShift Data Foundation, or `gp3-csi` on ROSA and single-node + +|Workbench notebook data +|20Gi +|`gp3-csi` or the cluster default ReadWriteOnce class + +|Model artifacts in object storage +|Bucket you create +|Amazon S3 on ROSA, or NooBaa on installer-provisioned infrastructure, bare metal, and single-node +|=== + +An example highly available cluster with seven nodes had about 57 cores and 185 GB of memory. +That example is not the tested minimum. + +Component requests you can plan for: + +[cols="2,1,1",options="header"] +|=== +|Component |CPU request |Memory request + +|Anomaly detector +|500m +|1Gi + +|Predictive analytics +|2 +|4Gi + +|Coordination engine +|200m +|256Mi + +|Workbench +|2 +|4Gi +|=== + +A GPU is optional. +Add one when training time matters. +Inference for the shipped models runs on CPU. + +Prometheus traffic for this pattern stays on the same cluster. +There is no spoke bandwidth requirement. diff --git a/content/patterns/openshift-aiops-platform/developing.adoc b/content/patterns/openshift-aiops-platform/developing.adoc new file mode 100644 index 0000000000..c35b3eeb87 --- /dev/null +++ b/content/patterns/openshift-aiops-platform/developing.adoc @@ -0,0 +1,131 @@ +--- +title: Developing with notebooks +weight: 20 +aliases: /openshift-aiops-platform/developing/ +--- +:toc: +:imagesdir: /images +:_content-type: ASSEMBLY +include::modules/comm-attributes.adoc[] + +[id="oaiops-developing"] += Developing with notebooks + +Access the Jupyter workbench through the OpenShift AI dashboard using OAuth authentication. +The workbench is the place to run the pattern notebooks, train models, and try a change before you commit it. + +[id="oaiops-open-workbench"] +== Open the workbench + +.Procedure + +. Read the dashboard route: ++ +[source,terminal] +---- +$ oc get route data-science-gateway -n openshift-ingress -o jsonpath='{.spec.host}{"\n"}' +---- ++ +.Example output ++ +[source,terminal] +---- +data-science-gateway.apps.cluster.example.com +---- + +. Open `https://data-science-gateway.apps.cluster.example.com` and sign in with your OpenShift user. + +. Open *Data Science Projects*, then *self-healing-platform*. + +. In *Workbenches*, select *Open* next to `self-healing-workbench`. + +The workbench mounts notebook data at `/opt/app-root/src/data` and model files at `/mnt/models`. + +[id="oaiops-notebook-catalog"] +== Notebook catalog + +The repository includes notebooks under `notebooks/`. +They are the templates for data collection, training, and remediation. + +[cols="1,1,3",options="header"] +|=== +|Directory |Count |What you use it for + +|`00-setup/` +|3 +|Cluster checks, KServe onboarding, and the Python environment + +|`01-data-collection/` +|5 +|Prometheus metrics, events, logs, and features + +|`02-anomaly-detection/` +|5 +|Isolation Forest, time-series models, and the predictive analytics notebook + +|`03-self-healing-logic/` +|3 +|Remediation workflows that call the coordination engine + +|`04-model-serving/` +|3 +|KServe deployment and model versions + +|`05-end-to-end-scenarios/` +|4 +|Pod crash loops, resource exhaustion, and network anomalies + +|`06-mcp-lightspeed-integration/` +|4 +|Model Context Protocol (MCP) server and OpenShift Lightspeed + +|`07-monitoring-operations/` +|3 +|Prometheus metrics and model performance + +|`08-advanced-scenarios/` +|3 +|Security response, capacity, and cost examples +|=== + +A hands-on walkthrough of the same workflow is the link:https://kubeheal.github.io/self-healing-workshop/[Self-Healing Workshop]. + +[id="oaiops-train-models"] +== Train a model + +Train from the workbench notebooks, not from a separate pipeline you have to build first. + +. Open `notebooks/01-data-collection/` and collect metrics from in-cluster Prometheus. +. Open `notebooks/02-anomaly-detection/01-isolation-forest-implementation.ipynb` for anomaly detection. +. Open `notebooks/02-anomaly-detection/05-predictive-analytics-kserve.ipynb` for the predictive model. +. Save the model file under `/mnt/models/` so the KServe InferenceService can load it from object storage. + +GPU time is optional. +The anomaly detector trains on CPU. +The predictive analytics notebook can use a GPU when the cluster has one. + +[id="oaiops-submit-anomaly"] +== Submit an anomaly from a notebook + +Notebooks in `notebooks/03-self-healing-logic/` call the coordination engine. +A minimal client looks like this: + +[source,python] +---- +import requests +from datetime import datetime + +response = requests.post( + "http://coordination-engine:8080/api/v1/anomalies", + json={ + "timestamp": datetime.utcnow().isoformat(), + "type": "custom_performance_degradation", + "severity": "warning", + "confidence": 0.85, + }, + timeout=30, +) +print(response.json()) +---- + +Run the notebook in the workbench so the service name `coordination-engine` resolves. diff --git a/content/patterns/openshift-aiops-platform/getting-started.adoc b/content/patterns/openshift-aiops-platform/getting-started.adoc new file mode 100644 index 0000000000..3e528275a6 --- /dev/null +++ b/content/patterns/openshift-aiops-platform/getting-started.adoc @@ -0,0 +1,20 @@ +--- +title: Getting started +weight: 10 +aliases: /openshift-aiops-platform/getting-started/ +--- +:toc: +:imagesdir: /images +:_content-type: ASSEMBLY +include::modules/comm-attributes.adoc[] + +include::modules/oaiops-deploying.adoc[leveloffset=+1] + +[id="next-steps_openshift-aiops-platform-getting-started"] +== Next steps + +* Review link:../cluster-sizing[cluster sizing] to confirm the cluster meets the pattern requirements. +* Change topology or storage in link:../ideas-for-customization[Ideas for customization]. +* Open the workbench from link:../developing[Developing with notebooks]. +* Add link:../integrations[integrations] such as ServiceNow, PagerDuty, or Slack. +* If the install does not become healthy, see link:../troubleshooting[Troubleshooting]. diff --git a/content/patterns/openshift-aiops-platform/ideas-for-customization.adoc b/content/patterns/openshift-aiops-platform/ideas-for-customization.adoc new file mode 100644 index 0000000000..30dfa500ea --- /dev/null +++ b/content/patterns/openshift-aiops-platform/ideas-for-customization.adoc @@ -0,0 +1,102 @@ +--- +title: Ideas for customization +weight: 60 +aliases: /openshift-aiops-platform/ideas-for-customization/ +--- +:toc: +:imagesdir: /images +:_content-type: ASSEMBLY +include::modules/comm-attributes.adoc[] + +[id="about-customizing-openshift-aiops-pattern"] += About customizing the OpenShift AIOps Self-Healing Platform + +Change the pattern by editing `values-hub.yaml` in your fork, then commit and push that file. +Argo CD applies the change. + +The install procedure documents ROSA Classic. +The values on this page cover single-node OpenShift, storage class, object storage, and the platform ConfigMap. + +Notebooks, model training, and the workbench are in link:../developing[Developing with notebooks]. +OpenShift Lightspeed and notification examples are in link:../integrations[Integrations]. + +[id="oaiops-single-node-values"] +== Single-node OpenShift + +Set the topology and a ReadWriteOnce storage class before you install on a single node. +`gp3-csi` is the class used on Amazon Web Services. + +[source,yaml] +---- +cluster: + topology: "sno" + +storage: + modelStorage: + storageClass: "gp3-csi" +---- + +CephFS is not available on a single node. +Use `gp3-csi` for persistent volumes on that topology. + +[id="oaiops-object-storage-values"] +== Object storage + +ROSA uses Amazon S3. +Set the bucket name in `values-hub.yaml`: + +[source,yaml] +---- +objectStore: + enabled: true + backend: "aws-s3" + aws: + region: "us-east-1" + bucketName: "your-model-storage-bucket" +---- + +For installer-provisioned infrastructure or bare metal, use NooBaa from OpenShift Data Foundation: + +[source,yaml] +---- +objectStore: + enabled: true + backend: "noobaa" + endpoint: "https://s3.openshift-storage.svc:443" +---- + +Create the NooBaa service with the storage steps in link:../cluster-sizing[Cluster sizing] when the cluster does not already have S3-compatible storage. + +[id="oaiops-storage-class-selection"] +== Storage classes + +* Highly available clusters with OpenShift Data Foundation use `ocs-storagecluster-cephfs` (ReadWriteMany) for shared model storage, and `gp3-csi` (ReadWriteOnce) for a GPU training volume. +* ROSA clusters use `gp3-csi` for persistent volumes and Amazon S3 for model artifacts. +* Single-node clusters use `gp3-csi` only. + +[id="oaiops-platform-config"] +== Platform configuration + +You can add a ConfigMap for operational settings in the `self-healing-platform` namespace: + +[source,yaml] +---- +apiVersion: v1 +kind: ConfigMap +metadata: + name: platform-config + namespace: self-healing-platform +data: + CLUSTER_NAME: hub + COORDINATION_ENGINE_PORT: "8080" + METRICS_PORT: "8090" + ENVIRONMENT: development + LOG_LEVEL: INFO + MODEL_SERVING_TIMEOUT: 30s + PROMETHEUS_SCRAPE_INTERVAL: 30s + MAX_CONCURRENT_REMEDIATIONS: "5" + ENABLE_DRY_RUN_MODE: "false" +---- + +Use `LOG_LEVEL: DEBUG` while you are developing. +Use `LOG_LEVEL: WARN` for a production cluster. diff --git a/content/patterns/openshift-aiops-platform/integrations.adoc b/content/patterns/openshift-aiops-platform/integrations.adoc new file mode 100644 index 0000000000..d6526938ed --- /dev/null +++ b/content/patterns/openshift-aiops-platform/integrations.adoc @@ -0,0 +1,102 @@ +--- +title: Integrations +weight: 30 +aliases: /openshift-aiops-platform/integrations/ +--- +:toc: +:imagesdir: /images +:_content-type: ASSEMBLY +include::modules/comm-attributes.adoc[] + +[id="oaiops-integrations"] += Integrations + +The pattern ships a Model Context Protocol (MCP) server that OpenShift Lightspeed can call. +ServiceNow, Slack, and PagerDuty are not installed for you. +The examples below show ConfigMaps you can add in `self-healing-platform` when you want those notifications. + +[id="oaiops-mcp-server"] +== MCP server + +The MCP server runs in the pattern namespace and exposes cluster health tools over HTTP: + +* Service: `http://mcp-server.self-healing-platform.svc.cluster.local:8080` +* Tools include cluster health, pod lists, Prometheus queries, and log analysis. + +The server source is the link:https://github.com/KubeHeal/openshift-cluster-health-mcp[openshift-cluster-health-mcp] repository. + +[id="oaiops-lightspeed"] +== OpenShift Lightspeed + +Open Lightspeed from the Help menu in the OpenShift console. +Ask it about pod memory, coordination-engine anomalies, or InferenceService status. +Lightspeed uses the MCP server for live cluster data. + +The notebooks under `notebooks/06-mcp-lightspeed-integration/` show the same calls from the workbench. +See link:../developing[Developing with notebooks]. + +[id="oaiops-servicenow"] +== ServiceNow example + +This ConfigMap is an example. +The pattern does not create the ServiceNow objects. + +[source,yaml] +---- +apiVersion: v1 +kind: ConfigMap +metadata: + name: servicenow-integration + namespace: self-healing-platform +data: + config.yaml: | + servicenow: + instance_url: https://mycompany.service-now.com + username: aiops-integration + password_secret: servicenow-credentials + create_incident_on: + - severity: "critical" + update_incident_on_resolution: true +---- + +Store the password in a secret referenced by `password_secret`. +Do not commit the password. + +[id="oaiops-slack"] +== Slack example + +[source,yaml] +---- +apiVersion: v1 +kind: ConfigMap +metadata: + name: slack-integration + namespace: self-healing-platform +data: + config.yaml: | + slack: + webhook_url_secret: slack-webhook + notify_on_remediation: + enabled: true + channel: "#platform-ops" +---- + +[id="oaiops-pagerduty"] +== PagerDuty example + +[source,yaml] +---- +apiVersion: v1 +kind: ConfigMap +metadata: + name: pagerduty-integration + namespace: self-healing-platform +data: + config.yaml: | + pagerduty: + integration_key_secret: pagerduty-key + auto_resolve_on_success: true + create_incident_on: + - remediation_status: "failed" + - severity: "critical" +---- diff --git a/content/patterns/openshift-aiops-platform/troubleshooting.adoc b/content/patterns/openshift-aiops-platform/troubleshooting.adoc new file mode 100644 index 0000000000..52f80d911b --- /dev/null +++ b/content/patterns/openshift-aiops-platform/troubleshooting.adoc @@ -0,0 +1,11 @@ +--- +title: Troubleshooting +weight: 40 +aliases: /openshift-aiops-platform/troubleshooting/ +--- +:toc: +:imagesdir: /images +:_content-type: ASSEMBLY +include::modules/comm-attributes.adoc[] + +include::modules/oaiops-troubleshooting.adoc[leveloffset=+1] diff --git a/modules/oaiops-about.adoc b/modules/oaiops-about.adoc new file mode 100644 index 0000000000..82cfc2d52e --- /dev/null +++ b/modules/oaiops-about.adoc @@ -0,0 +1,69 @@ +:_content-type: CONCEPT +:imagesdir: ../../images + +[id="about-openshift-aiops-platform"] += About the OpenShift AIOps Self-Healing Platform + +Use case:: + +* Detect unusual CPU, memory, and error-rate behavior on one OpenShift cluster. +* Call a coordination engine API with a recommended action and a confidence score. +* Restart a pod, or ask OpenShift GitOps to sync an application. +* Train the models again from notebooks when you have new metrics. + +This pattern manages one cluster. +Managed clusters are out of scope for this release. +`spoke_support` is `false` in the pattern metadata. + +Background:: + +The pattern pairs two machine-learning models with a small coordination service. +Notebooks or the Model Context Protocol (MCP) server score the current metrics. +The coordination engine then restarts a pod or syncs the OpenShift GitOps application that owns it. + +Both models are served by KServe. +Isolation Forest scores anomalies. +A second model forecasts resource use. +Weekly training runs as a Tekton pipeline from the notebooks in this repository. + +The primary install target is Red Hat OpenShift Service on AWS (ROSA) Classic. +The same pattern runs on installer-provisioned infrastructure, bare metal, and single-node OpenShift. +It has been exercised on OpenShift 4.20, 4.21, and 4.22. + +A walkthrough of that loop is the link:https://kubeheal.github.io/self-healing-workshop/[Self-Healing Workshop]. + +[id="about-solution"] +== About the solution + +* *Models.* KServe serves an anomaly detector and a predictive model. The notebooks under `notebooks/02-anomaly-detection/` train both. +* *Coordination engine.* A Go service on port 8080 records the request, checks how the workload was deployed, and runs the matching action. It also publishes Prometheus metrics on port 9090. +* *Notebooks.* The workbench is where you collect metrics, train, and call the coordination engine. See link:/patterns/openshift-aiops-platform/developing[Developing with notebooks]. +* *MCP server.* OpenShift Lightspeed can query cluster health through the MCP server. See link:/patterns/openshift-aiops-platform/integrations[Integrations]. +* *Topology.* Set `cluster.topology` to `ha` or `sno`. Storage classes follow that choice. See link:/patterns/openshift-aiops-platform/ideas-for-customization[Ideas for customization]. + +[id="about-technology"] +== About the technology + +link:https://www.redhat.com/en/technologies/cloud-computing/openshift[Red Hat OpenShift]:: +The cluster that runs the pattern and the workloads it watches. + +link:https://www.redhat.com/en/technologies/cloud-computing/openshift/aws[Red Hat OpenShift Service on AWS]:: +The primary place to install the pattern. +The control plane is managed. +You size worker machine pools. + +link:https://www.redhat.com/en/technologies/cloud-computing/openshift/openshift-ai[Red Hat OpenShift AI]:: +Hosts the workbench and the KServe InferenceServices. + +link:https://www.redhat.com/en/technologies/cloud-computing/openshift/gitops[Red Hat OpenShift GitOps]:: +Deploys the pattern from your fork and syncs applications when the coordination engine asks it to. + +link:https://docs.redhat.com/en/documentation/red_hat_openshift_pipelines[Red Hat OpenShift Pipelines]:: +Runs the notebook training jobs with Tekton. + +link:https://www.redhat.com/en/technologies/cloud-computing/openshift-data-foundation[Red Hat OpenShift Data Foundation]:: +Optional object storage for clusters that do not use Amazon S3. +ROSA uses Amazon S3 and does not require this product. + +Design notes for these choices are the link:https://github.com/KubeHeal/openshift-aiops-platform/tree/main/docs/adrs[architecture decision records (ADRs)]. +Start with the link:https://github.com/KubeHeal/openshift-aiops-platform/blob/main/docs/adrs/002-hybrid-self-healing-approach.md[hybrid self-healing decision record]. diff --git a/modules/oaiops-architecture.adoc b/modules/oaiops-architecture.adoc new file mode 100644 index 0000000000..bbae9877da --- /dev/null +++ b/modules/oaiops-architecture.adoc @@ -0,0 +1,103 @@ +:_content-type: CONCEPT +:imagesdir: ../../images + +[id="architecture-openshift-aiops"] += Architecture + +The pattern runs on one OpenShift cluster. +Managed clusters are out of scope for this release. + +== Overview + +OpenShift cluster:: +Runs Red Hat OpenShift AI, KServe, the coordination engine, OpenShift GitOps, and Prometheus. + +Git repository:: +Your fork is the source of truth. +OpenShift GitOps syncs the pattern and application manifests from that repository. + +Model storage and serving:: +Model files live in S3-compatible storage. +On ROSA that storage is Amazon S3. +KServe serves `anomaly-detector` and `predictive-analytics`. + +.Logical architecture of the OpenShift AIOps Self-Healing Platform +image::openshift-aiops-platform/aiops-logical-architecture.png[Logical architecture] + +The diagram shows one cluster. +A Git sync lands on OpenShift GitOps. +Prometheus sends metrics to KServe. +KServe returns an inference result to the coordination engine, which asks OpenShift GitOps to remediate. +Model files stay in S3-compatible object storage. + +== Self-healing data flow + +. Prometheus reports an anomaly. +. A notebook, or the Model Context Protocol (MCP) server, calls KServe. +. The caller posts the incident to the coordination engine. +. The coordination engine selects an action. +. OpenShift GitOps syncs the application, or the engine recreates the pod. +. The outcome is stored for the next Tekton training run. + +.Self-healing data flow +image::openshift-aiops-platform/aiops-dataflow.png[Self-healing data flow] + +== Coordination engine + +The coordination engine is a Go service. +It exposes `/health` for probes and `/api/v1/health` for a dependency check. +Prometheus metrics are on port 9090. + +.Coordination engine decision flow +image::openshift-aiops-platform/aiops-decision-flow.png[Coordination engine decision flow] + +Deployment detection:: +The engine looks at labels and owner references to see whether OpenShift GitOps manages the workload. + +Argo CD sync:: +For a workload managed by OpenShift GitOps, the engine syncs that application. + +Pod recreate:: +For a workload that was created directly, the engine deletes the pod so the controller creates it again. + +KServe:: +Notebooks call the InferenceServices. +The engine can call the same predict APIs. + +== GitOps + +.GitOps architecture +image::multicloud-gitops/spi-multi-cloud-gitops-sd-security.png[GitOps architecture] + +Application changes go through Git. +You can review the commit, and you can revert it. +The coordination engine uses that same path when it syncs an application. + +== Machine learning pipeline + +.Model training and serving +image::openshift-aiops-platform/aiops-ml-pipeline.png[Model training and serving] + +Notebooks collect Prometheus metrics and train the two models. +A Tekton pipeline runs the notebooks. +The model files are written to object storage. +KServe loads them. +The coordination engine calls the predict API. +A later training run uses the remediation outcomes. + +On a highly available cluster with OpenShift Data Foundation, shared model files use CephFS. +On ROSA and on single-node OpenShift, persistent volumes use `gp3-csi` and object storage is Amazon S3 or NooBaa. + +== How the pattern is deployed + +The Validated Patterns Operator creates the Argo CD applications from your fork. +Helm values come from `values-global.yaml` and `values-hub.yaml`. +Secrets stay outside Git. +Optional credentials are loaded from a file in your home directory. +See the link:https://github.com/KubeHeal/openshift-aiops-platform/blob/main/docs/adrs/030-hybrid-management-model.md[hybrid management architecture decision record (ADR)] for how cluster-scoped and namespaced resources are split. + +Related records: + +* link:https://github.com/KubeHeal/openshift-aiops-platform/blob/main/docs/adrs/002-hybrid-self-healing-approach.md[ADR-002: Hybrid self-healing] +* link:https://github.com/KubeHeal/openshift-aiops-platform/blob/main/docs/adrs/019-validated-patterns-framework-adoption.md[ADR-019: Validated Patterns framework] +* link:https://github.com/KubeHeal/openshift-aiops-platform/tree/main/docs/adrs[All architecture decision records] diff --git a/modules/oaiops-deploying.adoc b/modules/oaiops-deploying.adoc new file mode 100644 index 0000000000..89f91bf75a --- /dev/null +++ b/modules/oaiops-deploying.adoc @@ -0,0 +1,142 @@ +:_content-type: PROCEDURE +:imagesdir: ../../images + +[id="deploying-openshift-aiops-platform"] += Deploying the OpenShift AIOps Self-Healing Platform + +Install the pattern on one OpenShift cluster with the Validated Patterns script. +This procedure uses Red Hat OpenShift Service on AWS (ROSA) Classic, which is the primary target. +Single-node OpenShift and installer-provisioned or bare metal clusters use the same command after you change the values described in link:/patterns/openshift-aiops-platform/ideas-for-customization[Ideas for customization]. + +Cluster size is a requirement, not a prerequisite. +See link:/patterns/openshift-aiops-platform/cluster-sizing[Cluster sizing] before you install. + +.Prerequisites + +* An OpenShift 4.20, 4.21, or 4.22 cluster. +* A user with `cluster-admin` permissions on that cluster. +* A GitHub account that can fork a repository. +* The `oc`, `git`, `make`, and `podman` commands on your workstation. + +`./pattern.sh` runs Ansible inside a container. +You do not need `helm`, `yq`, `jq`, or `ansible-navigator` on the workstation. + +If you do not already have a cluster, `scripts/create-rosa-cluster.sh` in the pattern repository can create a ROSA Classic cluster. + +.Procedure + +. Fork link:https://github.com/KubeHeal/openshift-aiops-platform[the pattern repository]. ++ +Forking is required. +The pattern synchronizes from your repository, not from the upstream repository. + +. Clone your fork: ++ +[source,terminal] +---- +$ git clone https://github.com//openshift-aiops-platform.git +$ cd openshift-aiops-platform +---- + +. Log in to the cluster: ++ +[source,terminal] +---- +$ oc login --token= --server=https://api.cluster.example.com:6443 +---- + +. Create the values files when they are not already in your clone: ++ +[source,terminal] +---- +$ cp values-global.yaml.example values-global.yaml +$ cp values-hub.yaml.example values-hub.yaml +---- + +. Set `git.repoURL` in `values-global.yaml` to your fork: ++ +[source,yaml] +---- +git: + repoURL: "https://github.com//openshift-aiops-platform.git" + revision: "main" +---- + +. Set the application repository URL in `values-hub.yaml` to the same fork: ++ +[source,yaml] +---- +clusterGroup: + applications: + self-healing-platform: + repoURL: "https://github.com//openshift-aiops-platform.git" + targetRevision: main +---- + +. Commit and push only those two files: ++ +[source,terminal] +---- +$ git add values-global.yaml values-hub.yaml +$ git commit -m "Set the pattern repository URL to this fork" +$ git push origin main +---- + +. Make a local copy of the secrets example outside your repository when an optional feature needs credentials. ++ +The default public GitHub install needs no credentials. +Create this file only for an optional feature, such as a self-hosted Gitea mirror, a private notebook repository, an external registry, or an external database. +The example file in the repository lists each case. ++ +[WARNING] +==== +Do not add, commit, or push this file to your repository. +Doing so might expose personal credentials to GitHub. +==== ++ +[source,terminal] +---- +$ cp values-secret.yaml.example ~/values-secret-openshift-aiops-platform.yaml +---- ++ +`./pattern.sh` reads files from your home directory. +Keep the secrets file there. + +. Install the pattern: ++ +[source,terminal] +---- +$ ./pattern.sh make install +---- ++ +The script installs the Validated Patterns Operator, creates the Pattern resource, and starts the Argo CD synchronization. +The command returns when the operator accepts the pattern. +Synchronization continues after that. + +. Wait until the application is synced and healthy: ++ +[source,terminal] +---- +$ oc get applications.argoproj.io -n self-healing-platform-hub +---- ++ +.Example output ++ +[source,terminal] +---- +NAME SYNC STATUS HEALTH STATUS +self-healing-platform Synced Healthy +---- + +. Confirm the pattern pods are running: ++ +[source,terminal] +---- +$ oc get pods -n self-healing-platform +---- + +OpenShift Data Foundation is not part of this procedure. +On ROSA, model artifacts use Amazon S3. +If the cluster has no S3-compatible storage, follow the storage steps in link:/patterns/openshift-aiops-platform/cluster-sizing[Cluster sizing]. + +If the application stays out of sync, or a pod does not become ready, see link:/patterns/openshift-aiops-platform/troubleshooting[Troubleshooting]. diff --git a/modules/oaiops-solution-elements.adoc b/modules/oaiops-solution-elements.adoc new file mode 100644 index 0000000000..1ee829aa1b --- /dev/null +++ b/modules/oaiops-solution-elements.adoc @@ -0,0 +1,55 @@ +:_content-type: CONCEPT +:imagesdir: ../../images + +[id="solution-elements-openshift-aiops"] += Solution elements + +These are the components the pattern deploys on one cluster. +Managed clusters are out of scope for this release. + +== Coordination engine + +The coordination engine is a Go deployment in the `self-healing-platform` namespace. + +* `GET /health` is the readiness probe. +* `GET /api/v1/health` checks the Kubernetes API and the KServe services. +* `POST /api/v1/anomalies` accepts an incident from a notebook. +* Prometheus metrics are served on port 9090. + +For a workload that OpenShift GitOps manages, the engine syncs the application. +For a workload created directly in the cluster, the engine deletes the pod and lets the owning controller recreate it. + +== KServe models + +Two InferenceServices share the namespace: + +* `anomaly-detector` scores current metrics. +* `predictive-analytics` forecasts resource use. + +Notebooks in `notebooks/02-anomaly-detection/` train the models. +Tekton runs those notebooks. +The model files are stored as objects and mounted for the predictor pods. + +== Workbench + +Red Hat OpenShift AI hosts `self-healing-workbench`. +Use it to run the notebooks, inspect `/mnt/models`, and call the coordination engine. +See link:/patterns/openshift-aiops-platform/developing[Developing with notebooks]. + +== MCP server + +A Model Context Protocol (MCP) server in the same namespace answers health, pod, metric, and log questions for OpenShift Lightspeed. +See link:/patterns/openshift-aiops-platform/integrations[Integrations]. + +== Object storage and secrets + +Model objects use Amazon S3 on Red Hat OpenShift Service on AWS. +Other clusters can use NooBaa. +The External Secrets Operator copies credentials into the namespace. +Do not commit those credentials. +The install page explains where to keep the secrets file. + +== OpenShift GitOps + +Every pattern manifest is an Argo CD application rendered from the Helm chart in your fork. +A change reaches the cluster only after you push it. diff --git a/modules/oaiops-troubleshooting.adoc b/modules/oaiops-troubleshooting.adoc new file mode 100644 index 0000000000..65bd8c26c0 --- /dev/null +++ b/modules/oaiops-troubleshooting.adoc @@ -0,0 +1,156 @@ +:_content-type: PROCEDURE +:imagesdir: ../../images + +[id="troubleshooting-openshift-aiops-platform"] += Troubleshooting the OpenShift AIOps Self-Healing Platform + +Use these checks when an install does not become healthy. +Run the commands from the root of your fork. + +[id="oaiops-application-out-of-sync"] +== Application stays out of sync + +Confirm the application repository is your fork: + +[source,terminal] +---- +$ oc get application self-healing-platform -n self-healing-platform-hub -o jsonpath='{.spec.source.repoURL}{"\n"}' +---- + +The URL must be your fork. +If it still points at `KubeHeal/openshift-aiops-platform`, update `git.repoURL` in `values-global.yaml` and `clusterGroup.applications.self-healing-platform.repoURL` in `values-hub.yaml`, commit those two files, and push. + +Refresh the application after the push: + +[source,terminal] +---- +$ oc annotate application.argoproj.io self-healing-platform \ + -n self-healing-platform-hub \ + argocd.argoproj.io/refresh=hard \ + --overwrite +---- + +[id="oaiops-pods-not-ready"] +== Pods are not ready + +List the pods and read the log of any pod that is not `Running` or `Completed`: + +[source,terminal] +---- +$ oc get pods -n self-healing-platform +$ oc logs -n self-healing-platform --tail=100 +---- + +A pod stuck in `Init:Error` often means a ServiceAccount or role is missing. +Run `./pattern.sh make install` again from a clean values commit, then refresh the application with the command in the previous section. + +[id="oaiops-operator-install"] +== Operator install does not finish + +Read the Validated Patterns Operator log: + +[source,terminal] +---- +$ oc logs -n openshift-operators deployment/validated-patterns-operator --tail=100 +---- + +If the install waits for HashiCorp Vault, this pattern does not use Vault. +Set the secret store backend to `none` under `global` in `values-global.yaml`: + +[source,yaml] +---- +global: + secretStore: + backend: none +---- + +Commit and push that file, then refresh the application. + +[id="oaiops-inferenceservice"] +== InferenceService is not ready + +[source,terminal] +---- +$ oc get inferenceservices -n self-healing-platform +$ oc logs -n knative-serving deployment/controller --tail=100 +---- + +Model files are read from S3-compatible storage. +On ROSA that storage is the Amazon S3 bucket in `values-hub.yaml`. +On a cluster that uses OpenShift Data Foundation, confirm the storage pods are ready before you expect the InferenceService to load a model. + +[id="oaiops-storage"] +== Storage + +List storage classes and persistent volume claims: + +[source,terminal] +---- +$ oc get storageclass +$ oc get pvc -n self-healing-platform +---- + +For a single-node cluster, `storage.modelStorage.storageClass` in `values-hub.yaml` must be a ReadWriteOnce class such as `gp3-csi`. +CephFS is not available on a single node. + +If `make configure-cluster` fails while installing OpenShift Data Foundation: + +[source,terminal] +---- +$ oc get csv -n openshift-storage +$ oc get noobaa -n openshift-storage +---- + +A highly available Ceph cluster needs at least three worker nodes. +When the cluster already has S3-compatible storage, skip OpenShift Data Foundation: + +[source,terminal] +---- +$ ./scripts/configure-cluster-infrastructure.sh --skip-odf +---- + +[id="oaiops-alert-rules"] +== Alert rules + +This command lists the Prometheus rules that are configured. +It does not list alerts that are firing: + +[source,terminal] +---- +$ oc get prometheusrule -n openshift-monitoring +---- + +[id="oaiops-optional-validation"] +== Optional validation pipeline + +After the application is healthy, you can run the deployment validation pipeline. +This is not part of the install. + +[source,terminal] +---- +$ tkn pipeline start deployment-validation-pipeline -n self-healing-platform --showlog +---- + +[id="oaiops-reinstall"] +== Install again + +The Validated Patterns admission webhook allows only one Pattern resource. +Annotate the existing resource so the webhook accepts deletion, delete it, and wait until it is gone: + +[source,terminal] +---- +$ oc annotate pattern self-healing-platform -n openshift-operators \ + patterns.gitops.hybrid-cloud-patterns.io/prune="true" --overwrite +$ oc delete pattern self-healing-platform -n openshift-operators --wait=false +$ oc get pattern -A +---- + +Deletion might take a few minutes. +When the Pattern resource is gone, run `./pattern.sh make install` again. + +[WARNING] +==== +Without the prune annotation, the webhook blocks deletion of the Pattern resource. +==== + +Further notes are in the link:https://github.com/KubeHeal/openshift-aiops-platform/blob/main/docs/guides/TROUBLESHOOTING-GUIDE.md[pattern troubleshooting guide] and link:https://github.com/KubeHeal/openshift-aiops-platform/issues[GitHub issues]. diff --git a/modules/openshift-aiops-platform/metadata-openshift-aiops-platform.adoc b/modules/openshift-aiops-platform/metadata-openshift-aiops-platform.adoc new file mode 100644 index 0000000000..5a53b9972b --- /dev/null +++ b/modules/openshift-aiops-platform/metadata-openshift-aiops-platform.adoc @@ -0,0 +1,32 @@ +// Attributes for the OpenShift AIOps Self-Healing Platform pattern. +// Values match pattern-metadata.yaml in the pattern repository. +// Cluster size attributes are consumed by modules/cluster-sizing-template.adoc. +:metadata_version: 1.0 +:name: openshift-aiops-platform +:pattern_version: 1.0.0 +:display_name: OpenShift AIOps Self-Healing Platform +:repo_url: https://github.com/KubeHeal/openshift-aiops-platform +:docs_repo_url: https://github.com/validatedpatterns/docs +:issues_url: https://github.com/KubeHeal/openshift-aiops-platform/issues +:docs_url: https://validatedpatterns.io/patterns/openshift-aiops-platform/ +:ci_url: https://validatedpatterns.io/ci/?pattern=openshift-aiops-platform +:tier: sandbox +:owners: tosin2013 +:requirements_hub_compute_platform_gcp_replicas: 1 +:requirements_hub_compute_platform_gcp_type: n1-standard-8 +:requirements_hub_compute_platform_azure_replicas: 1 +:requirements_hub_compute_platform_azure_type: Standard_D8s_v3 +:requirements_hub_compute_platform_aws_replicas: 1 +:requirements_hub_compute_platform_aws_type: m5.2xlarge +:requirements_hub_controlPlane_platform_gcp_replicas: 1 +:requirements_hub_controlPlane_platform_gcp_type: n1-standard-4 +:requirements_hub_controlPlane_platform_azure_replicas: 1 +:requirements_hub_controlPlane_platform_azure_type: Standard_D4s_v3 +:requirements_hub_controlPlane_platform_aws_replicas: 1 +:requirements_hub_controlPlane_platform_aws_type: m5.xlarge +:extra_features_hypershift_support: true +:extra_features_spoke_support: false +:extra_features_sno_support: true +:extra_features_gpu_support: true +:extra_features_rosa_support: true +:external_requirements: diff --git a/static/images/logos/README-openshift-aiops-platform.md b/static/images/logos/README-openshift-aiops-platform.md new file mode 100644 index 0000000000..bfca1d5385 --- /dev/null +++ b/static/images/logos/README-openshift-aiops-platform.md @@ -0,0 +1,35 @@ +# OpenShift AIOps Platform Logo + +## Logo Source + +The pattern logo (`openshift-aiops-platform.png`) is rendered from the official KubeHeal brand icon: +- **Source SVG**: [`assets/branding/svg/kubeheal-icon.svg`](https://github.com/KubeHeal/openshift-aiops-platform/blob/main/assets/branding/svg/kubeheal-icon.svg) +- **Brand guide**: [`assets/branding/README.md`](https://github.com/KubeHeal/openshift-aiops-platform/blob/main/assets/branding/README.md) + +## Logo Details + +- **Format**: PNG (400×400 px, RGBA) +- **Visual elements**: Cybernetic hexagonal node, ECG pulse wave, healing cross, neural mesh lattice +- **Colors**: Deep Space Navy background, Self-Healing Cyan pulse, OpenShift Crimson peak, Cobalt Intelligence nodes +- **Rendered with**: cairosvg from the master vector icon + +## Regenerating + +To re-render from the latest SVG source: + +```bash +pip install cairosvg +python3 -c " +import cairosvg +cairosvg.svg2png( + url='assets/branding/svg/kubeheal-icon.svg', + write_to='static/images/logos/openshift-aiops-platform.png', + output_width=400, output_height=400 +) +" +``` + +## Contact + +- Pattern maintainers: https://github.com/KubeHeal/openshift-aiops-platform +- Brand assets: https://github.com/KubeHeal/openshift-aiops-platform/tree/main/assets/branding diff --git a/static/images/logos/openshift-aiops-platform.png b/static/images/logos/openshift-aiops-platform.png new file mode 100644 index 0000000000..8668a1fcb5 Binary files /dev/null and b/static/images/logos/openshift-aiops-platform.png differ diff --git a/static/images/openshift-aiops-platform/README.md b/static/images/openshift-aiops-platform/README.md new file mode 100644 index 0000000000..df872fd343 --- /dev/null +++ b/static/images/openshift-aiops-platform/README.md @@ -0,0 +1,27 @@ +# OpenShift AIOps Platform images + +Diagrams for the OpenShift AIOps Self-Healing Platform pattern. +Each diagram shows one OpenShift cluster. + +## aiops-logical-architecture.png + +One cluster with Red Hat OpenShift AI, KServe, the coordination engine, OpenShift GitOps, and Prometheus. +A Git repository syncs into OpenShift GitOps. +Prometheus sends metrics to KServe. +Model files sit in S3-compatible object storage. + +## aiops-dataflow.png + +Six steps: detect, analyze, request remediation, orchestrate, execute, and feed the outcome back into the next training run. + +## aiops-decision-flow.png + +The coordination engine detects how the application was deployed, then either syncs the Argo CD application or recreates the pod. + +## aiops-ml-pipeline.png + +Jupyter notebooks train models. +A Tekton pipeline runs the notebooks. +Model files are stored in S3. +KServe serves them. +The coordination engine calls the predict API. diff --git a/static/images/openshift-aiops-platform/aiops-dataflow.png b/static/images/openshift-aiops-platform/aiops-dataflow.png new file mode 100644 index 0000000000..17cfcd837a Binary files /dev/null and b/static/images/openshift-aiops-platform/aiops-dataflow.png differ diff --git a/static/images/openshift-aiops-platform/aiops-decision-flow.png b/static/images/openshift-aiops-platform/aiops-decision-flow.png new file mode 100644 index 0000000000..0e7b0008d5 Binary files /dev/null and b/static/images/openshift-aiops-platform/aiops-decision-flow.png differ diff --git a/static/images/openshift-aiops-platform/aiops-logical-architecture.png b/static/images/openshift-aiops-platform/aiops-logical-architecture.png new file mode 100644 index 0000000000..28ab382e15 Binary files /dev/null and b/static/images/openshift-aiops-platform/aiops-logical-architecture.png differ diff --git a/static/images/openshift-aiops-platform/aiops-ml-pipeline.png b/static/images/openshift-aiops-platform/aiops-ml-pipeline.png new file mode 100644 index 0000000000..065fd40d36 Binary files /dev/null and b/static/images/openshift-aiops-platform/aiops-ml-pipeline.png differ