|
| 1 | +# OpenShift Monitoring Plugin - AI Agent Guide |
| 2 | + |
| 3 | +## Quick Start (30-second overview) |
| 4 | +- **What**: Dual frontend plugins for OpenShift observability (monitoring-plugin + monitoring-console-plugin) |
| 5 | +- **Purpose**: Alerts, Metrics, Targets, Dashboards + Perses, Incidents, ACM integration |
| 6 | +- **Tech Stack**: React + TypeScript + Webpack + i18next + Go |
| 7 | +- **Key Files**: `web/console-extensions.json`, `web/src/components/` |
| 8 | + |
| 9 | +## Common Tasks & Workflows |
| 10 | + |
| 11 | +### Adding a New Feature |
| 12 | +1. Check if it belongs in `monitoring-plugin` (core) or `monitoring-console-plugin` (extended) |
| 13 | +2. Update console extensions in `web/console-extensions.json` |
| 14 | +3. Add React components in `web/src/components/` |
| 15 | +4. Add translations in `public/locales/` |
| 16 | +5. Test with `make lint-frontend && make test-backend` |
| 17 | + |
| 18 | +### Debugging Issues |
| 19 | +- **Build failures**: Check `Makefile` targets |
| 20 | +- **Console integration**: Verify `console-extensions.json` |
| 21 | +- **Plugin loading**: Check OpenShift Console logs |
| 22 | +- **Perses dashboards**: Debug at `web/src/components/dashboards/perses/` |
| 23 | + |
| 24 | +### Development Setup |
| 25 | +- See README.md for full setup |
| 26 | +- Deployment: https://github.com/observability-ui/development-tools/ |
| 27 | + |
| 28 | +## Development Context |
| 29 | + |
| 30 | +### When working on Alerts: |
| 31 | +- Files: `web/src/components/alerts/` |
| 32 | +- Integration: Alertmanager API |
| 33 | +- Testing: Cypress tests in `web/cypress/` |
| 34 | + |
| 35 | +### When working on Dashboards: |
| 36 | +- **Legacy**: Standard OpenShift dashboards |
| 37 | +- **Perses**: `web/src/components/dashboards/perses/` (uses ECharts wrapper) |
| 38 | +- **Upstream**: https://github.com/perses/perses |
| 39 | + |
| 40 | +### When working on ACM: |
| 41 | +- Multi-cluster observability |
| 42 | +- Hub cluster aggregation |
| 43 | +- Thanos/Alertmanager integration |
| 44 | + |
| 45 | +## Important Decision Points |
| 46 | + |
| 47 | +### Choosing Between Plugins: |
| 48 | +- **monitoring-plugin**: Core observability (always available) |
| 49 | +- **monitoring-console-plugin**: Optional features (COO required) |
| 50 | + |
| 51 | +### Adding Dependencies: |
| 52 | +- Check compatibility with OpenShift Console versions |
| 53 | +- Verify i18next translation support |
| 54 | +- Consider CMO vs COO deployment differences |
| 55 | + |
| 56 | +## External Dependencies & Operators |
| 57 | + |
| 58 | +| System | Repository | Purpose | |
| 59 | +|--------|------------|---------| |
| 60 | +| CMO | https://github.com/openshift/cluster-monitoring-operator | Manages monitoring-plugin | |
| 61 | +| COO | https://github.com/rhobs/observability-operator | Manages monitoring-console-plugin | |
| 62 | +| Perses | https://github.com/perses/perses | Dashboard engine | |
| 63 | +| Console SDK | https://github.com/openshift/console | Plugin framework | |
| 64 | + |
| 65 | +## Technical Documentation |
| 66 | + |
| 67 | +### Console Plugin Framework |
| 68 | +- Plugin SDK: https://github.com/openshift/console/tree/main/frontend/packages/console-dynamic-plugin-sdk |
| 69 | +- Extensions docs: https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/console-extensions.md |
| 70 | +- Example plugin: https://github.com/openshift/console/tree/main/dynamic-demo-plugin |
| 71 | + |
| 72 | +### Operator Integration |
| 73 | +- **CMO (monitoring-plugin)**: Integrated with cluster monitoring stack |
| 74 | +- **COO (monitoring-console-plugin)**: Optional operator for extended features |
| 75 | +- **UIPlugin CR example**: |
| 76 | +```yaml |
| 77 | +apiVersion: observability.openshift.io/v1alpha1 |
| 78 | +kind: UIPlugin |
| 79 | +metadata: |
| 80 | + name: monitoring |
| 81 | +spec: |
| 82 | + type: Monitoring |
| 83 | + monitoring: |
| 84 | + acm: |
| 85 | + enabled: true |
| 86 | + alertmanager: |
| 87 | + url: 'https://alertmanager.open-cluster-management-observability.svc:9095' |
| 88 | + thanosQuerier: |
| 89 | + url: 'https://rbac-query-proxy.open-cluster-management-observability.svc:8443' |
| 90 | + perses: |
| 91 | + enabled: true |
| 92 | + incidents: |
| 93 | + enabled: true |
| 94 | +``` |
| 95 | +
|
| 96 | +### Perses Integration Details |
| 97 | +- **Core**: https://github.com/perses/perses |
| 98 | +- **Plugins**: https://github.com/perses/plugins (chart specifications and datasources) |
| 99 | +- **Operator**: https://github.com/perses/perses-operator (Red Hat fork: https://github.com/rhobs/perses) |
| 100 | +- **Chart Engine**: ECharts (https://echarts.apache.org/) |
| 101 | +
|
| 102 | +### ACM Observability |
| 103 | +- **Multi-cluster monitoring**: Centralized observability across managed clusters |
| 104 | +- **Components**: Hub cluster Thanos, Grafana, Alertmanager + endpoint operators |
| 105 | +- **Integration**: COO provides unified alerting UI for ACM environments |
| 106 | +- **Features**: Cross-cluster silences, cluster-labeled alerts, centralized metrics |
| 107 | +
|
| 108 | +## Release & Testing |
| 109 | +
|
| 110 | +### Before submitting a PR run the following and address any errors: |
| 111 | +```bash |
| 112 | +make lint-frontend |
| 113 | +make lint-backend |
| 114 | +make test-translations |
| 115 | +make test-backend |
| 116 | +# Run cypress tests (see web/cypress/README.md) |
| 117 | +``` |
| 118 | + |
| 119 | +### PR Requirements: |
| 120 | +- **Title format**: `[JIRA_ISSUE]: Description` |
| 121 | +- **Testing**: All linting and tests must pass |
| 122 | +- **Translations**: Ensure i18next keys are properly added |
| 123 | + |
| 124 | +### Release Pipeline: |
| 125 | +- **Konflux**: Handles CI/CD and release automation |
| 126 | +- **CMO releases**: Follow OpenShift release cycles |
| 127 | +- **COO releases**: Independent release schedule |
| 128 | + |
| 129 | +## Security & RBAC |
| 130 | + |
| 131 | +### Plugin Security Model: |
| 132 | +- Inherits OpenShift Console RBAC |
| 133 | +- Respects cluster monitoring permissions |
| 134 | +- ACM integration requires appropriate hub cluster access |
| 135 | + |
| 136 | +### Development Security: |
| 137 | +- No credentials in code |
| 138 | +- Use cluster service accounts |
| 139 | +- Follow OpenShift security guidelines |
| 140 | + |
| 141 | +## Getting Help |
| 142 | + |
| 143 | +| Topic | Channel/Resource | |
| 144 | +|-------|-----------------| |
| 145 | +| Console Plugins | OpenShift Console SDK documentation | |
| 146 | +| Perses | Slack: Cloud Native Computing Foundation >> #perses-dev | |
| 147 | +| COO | Slack: Internal Red Hat >> #forum-cluster-observability-operator | |
| 148 | + |
| 149 | +## Additional Resources |
| 150 | + |
| 151 | +### Development Tools & Scripts: |
| 152 | +- **Monitoring Plugin**: https://github.com/observability-ui/development-tools/tree/main/monitoring-plugin |
| 153 | +- **Perses**: https://github.com/observability-ui/development-tools/tree/main/perses |
| 154 | +- **Wiki**: https://github.com/observability-ui/development-tools/tree/main/wiki |
| 155 | + |
| 156 | +### Code Style & Standards: |
| 157 | +- **TypeScript**: https://www.typescriptlang.org/ |
| 158 | +- **React**: https://react.dev/ |
| 159 | +- **Webpack**: https://webpack.js.org/ |
| 160 | +- **Go**: https://go.dev/ |
| 161 | +- **i18next**: https://www.i18next.com/ |
| 162 | + |
| 163 | +--- |
| 164 | +*This guide is optimized for AI agents and developers. For detailed setup instructions, also refer to README.md and Makefile.* |
0 commit comments