|
| 1 | +# Openshift Troubleshooting Panel Console Plugin - AI Agent Guide |
| 2 | + |
| 3 | +## Project Overview |
| 4 | +A frontend plugin to the OpenShit Console of the [Korrel8r](https://github.com/korrel8r/korrel8r) project, which looks to display a connected web of observability nodes/signals and navigate to them on selection. |
| 5 | + |
| 6 | +## External Dependencies & Operators |
| 7 | + |
| 8 | +| System | Repository | Purpose | |
| 9 | +|--------|------------|---------| |
| 10 | +| COO | https://github.com/rhobs/observability-operator | Manages monitoring-console-plugin | |
| 11 | +| Korrel8r | https://github.com/korrel8r/korrel8r | Correlation backend | |
| 12 | +| Console SDK | https://github.com/openshift/console | Plugin framework | |
| 13 | + |
| 14 | +### COO (Cluster Observability Operator) |
| 15 | +COO is the downstream OpenShift build of the observability-operator project, providing optional observability configuration and features to a kubernetes cluster. In order to deploy the troubleshooting-panel and korrel8r, a UIPlugin with the type of `TroubleshootingPanel` can be created. COO can take the state of the cluster (such as the OCP version) and information set in the UIPlugin to pass in a set of features or configuration values to the troubleshooting-panel backend. Currently there aren't any features or configuration values used. |
| 16 | + |
| 17 | + |
| 18 | +- **UIPlugin CR example**: |
| 19 | +```yaml |
| 20 | +apiVersion: observability.openshift.io/v1alpha1 |
| 21 | +kind: UIPlugin |
| 22 | +metadata: |
| 23 | + name: troubleshooting-panel |
| 24 | +spec: |
| 25 | + type: TroubleshootingPanel |
| 26 | +``` |
| 27 | +
|
| 28 | +### Korrel8r |
| 29 | +Korrel8r is a rule based correlation engine, with an extensible rule set, that can navigate: |
| 30 | +- many types of signal and resource data |
| 31 | +- using diverse schema, data models and naming conventions |
| 32 | +- queried using diverse query languages |
| 33 | +- stored in multiple stores with diverse query APIs |
| 34 | +
|
| 35 | +Each type of signal or resource is represented by a "domain". Korrel8r can be extended to handle new signals and resources by adding new domains. |
| 36 | +
|
| 37 | +Relationships within and between domains are expressed as "rules". |
| 38 | +
|
| 39 | +The full documentation for Korrel8r can be found here: |
| 40 | +https://korrel8r.github.io/korrel8r/ |
| 41 | +
|
| 42 | +### Console Plugin Framework |
| 43 | +The OpenShift Console uses a frontend plugin system powered by Webpack's Module Fedaration. Upon reconciling the UIPlugin, COO will create a ConsolePlugin CR which will enable a route for OpenShift console users to make requests to the troubleshooting-panel pod. The OpenShift Console will first load a `plugin-manifest.json` which is rendered from the `./web/console-extensions.json` file durring build time, and then use the information within it to dynamically load needed chunks of the built js to the frontend. |
| 44 | + |
| 45 | +The OpenShift console provides an npm SDK package which is tied to the OCP version it is built for. The package tries to retain compatability as much as possible, so a single build is able to be used across multiple OCP versions, with specific versions (such as 4.19 and the unreleased 4.22) breaking backwards compatability. |
| 46 | + |
| 47 | +## Development Guide |
| 48 | +The troubleshooting-panel repo's code is split up into 2 general areas: |
| 49 | +- golang backend - `./cmd` and `./pkg` folders |
| 50 | +- frontend components - `./web` |
| 51 | + |
| 52 | +All commands should be routed through the `Makefile`. |
| 53 | + |
| 54 | +### Frontend |
| 55 | +The troubelshooting-panel uses the following technologies: |
| 56 | +- typescript |
| 57 | +- react 17 |
| 58 | +- i18next |
| 59 | +- redux |
| 60 | + |
| 61 | +### Console Plugin Framework: |
| 62 | +- Dynamic Plugin: https://github.com/openshift/enhancements/blob/master/enhancements/console/dynamic-plugins.md |
| 63 | +- Plugin SDK README: https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/README.md |
| 64 | +- Plugin SDK API: https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md |
| 65 | +- Extensions docs: https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/console-extensions.md |
| 66 | +- Example plugin: https://github.com/openshift/console/tree/main/dynamic-demo-plugin |
| 67 | + |
| 68 | +In the event that a new console-extension point is needed which is only available when a specific feature is enabled, the `openshift/monitoring-plugin` can be used as an implementation refrence: |
| 69 | + |
| 70 | +For reference for adding console extension points or features: |
| 71 | +https://github.com/openshift/monitoring-plugin/tree/main/pkg |
| 72 | + |
| 73 | +### Korrel8r |
| 74 | + |
| 75 | +The Korrel8r API client is built off of the swagger documentation for the upstream project. Updating the API client can be accomplished by copying the `swagger.json` file from the upstream project, located [here](https://github.com/korrel8r/korrel8r/blob/main/pkg/rest/docs/swagger.json), and then running `make gen-client`. |
| 76 | + |
| 77 | +#### Openshift Domain's Location |
| 78 | +After determing which domains, signals and queries are connected from querying the perses backend, we then need to convert the korrel8r responses into OpenShift URL's so that we can match the current page and locate related pages to navigate to. These conversions are located in `./web/src/korrel8r`. These URL conversions MUST be kept accurate and have extensive unit tests located in `./web/src/__tests__`. |
| 79 | + |
| 80 | +### Development Setup |
| 81 | +- See README.md for full setup |
| 82 | +- Deployment of COO and other resources: https://github.com/observability-ui/development-tools/ |
| 83 | + |
| 84 | +## Release & Testing |
| 85 | + |
| 86 | +### Before submitting a PR run the following and address any errors: |
| 87 | +```bash |
| 88 | +make build-frontend |
| 89 | +make test-frontend |
| 90 | +``` |
| 91 | + |
| 92 | +### PR Requirements: |
| 93 | +- **Title format**: `[JIRA_ISSUE]: Description` |
| 94 | +- **Testing**: All linting and tests must pass |
| 95 | +- **Translations**: Ensure i18next keys are properly added by ensuring any static text in the frontend is wrapped in a useTranslation function call, ie. `t('Korrel8r')` |
| 96 | + |
| 97 | +### Commit Requirements: |
| 98 | +- **Title format**: Conventional Commit format ([link](https://www.conventionalcommits.org/en/v1.0.0/)) |
| 99 | + |
| 100 | +--- |
| 101 | +*This guide is optimized for AI agents and developers. For detailed setup instructions, also refer to README.md and Makefile.* |
0 commit comments