Skip to content

OLS-3236: Reconcile agentic console plugin in lightspeed-operator#1758

Open
blublinsky wants to merge 1 commit into
openshift:mainfrom
blublinsky:agentic-bundle
Open

OLS-3236: Reconcile agentic console plugin in lightspeed-operator#1758
blublinsky wants to merge 1 commit into
openshift:mainfrom
blublinsky:agentic-bundle

Conversation

@blublinsky

@blublinsky blublinsky commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

Summary
Migrate agentic console plugin reconciliation from lightspeed-agentic-operator into lightspeed-operator (OLS-3236, operator scope).

36 files — 9 added, 27 modified (~3.1k / ~710 lines).

Operator reconciliation
Add internal/controller/agenticconsole/ — Phase 1 (ConfigMap, NetworkPolicy, ServiceAccount) and Phase 2 (Deployment, Service, TLS wait, ConsolePlugin, Console activation), plus RemoveAgenticConsole() finalizer cleanup.
Wire into OLSConfigReconciler: Phase 1/2 steps, AgenticConsolePluginReady, TLS secret watcher, deployment restart mapping.
Add spec.ols.deployment.agenticConsole (Config) to OLSConfig; regenerate config/crd/bases/ols.openshift.io_olsconfigs.yaml.
Add --agentic-console-image in cmd/main.go (default: Konflux lightspeed-agentic-console:main).
Reuse existing resource names for upgrade adoption (lightspeed-agentic-console-plugin, cert lightspeed-agentic-console-plugin-cert, port 9443, container console).
No ConsolePlugin proxy to app-server (unlike chat console).
Shared console plugin refactor
Extract internal/controller/utils/console_plugin_reconciler.go (+ tests).
Refactor internal/controller/console/ to use shared helpers (~400 lines removed).

Local dev fix
Skip reconcileMetricsReaderSecret when LOCAL_DEV_MODE=true (make run) to stop metrics-reader-token reconcile loop. Add agentic console name to make run

Documentation
AGENTS.md, ARCHITECTURE.md
.ai/spec/what/agentic-console-ui.md (new), console-ui.md, README.md, how/project-structure.md, how/reconciliation.md

Intentionally out of scope (follow-up)
OLM bundle/CSV sync (bundle/manifests/, related_images.json, CSV --agentic-console-image)

Type of change

  • Refactor
  • [ x] New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up dependent library

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Summary by CodeRabbit

  • New Features

    • Added support for the agentic console plugin, including deployment, activation, status reporting, and cleanup.
    • Added support for overriding the agentic console image and related configuration settings.
  • Bug Fixes

    • Improved restart handling so agentic console updates can be applied when related TLS assets change.
    • Local development runs now skip some operator-managed resources to reduce reconcile loops.
  • Documentation

    • Updated architecture and operator guides to reflect the new agentic console flow and console-plugin structure.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 25, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 25, 2026

Copy link
Copy Markdown

@blublinsky: This pull request references OLS-3236 which is a valid jira issue.

Details

In response to this:

Description

Summary
Migrate agentic console plugin reconciliation from lightspeed-agentic-operator into lightspeed-operator (OLS-3236, operator scope).

35 files — 9 added, 26 modified (~3.1k / ~710 lines).

Operator reconciliation
Add internal/controller/agenticconsole/ — Phase 1 (ConfigMap, NetworkPolicy, ServiceAccount) and Phase 2 (Deployment, Service, TLS wait, ConsolePlugin, Console activation), plus RemoveAgenticConsole() finalizer cleanup.
Wire into OLSConfigReconciler: Phase 1/2 steps, AgenticConsolePluginReady, TLS secret watcher, deployment restart mapping.
Add spec.ols.deployment.agenticConsole (Config) to OLSConfig; regenerate config/crd/bases/ols.openshift.io_olsconfigs.yaml.
Add --agentic-console-image in cmd/main.go (default: Konflux lightspeed-agentic-console:main).
Reuse existing resource names for upgrade adoption (lightspeed-agentic-console-plugin, cert lightspeed-agentic-console-plugin-cert, port 9443, container console).
No ConsolePlugin proxy to app-server (unlike chat console).
Shared console plugin refactor
Extract internal/controller/utils/console_plugin_reconciler.go (+ tests).
Refactor internal/controller/console/ to use shared helpers (~400 lines removed).

Local dev fix
Skip reconcileMetricsReaderSecret when LOCAL_DEV_MODE=true (make run) to stop metrics-reader-token reconcile loop.

Documentation
AGENTS.md, ARCHITECTURE.md
.ai/spec/what/agentic-console-ui.md (new), console-ui.md, README.md, how/project-structure.md, how/reconciliation.md

Intentionally out of scope (follow-up)
OLM bundle/CSV sync (bundle/manifests/, related_images.json, CSV --agentic-console-image)

Type of change

  • Refactor
  • [ x] New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up dependent library

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR adds shared console-plugin resource helpers, introduces agentic console resource generation and reconciliation wiring, extends image and CRD plumbing, and updates docs and local-development behavior for the new flow.

Changes

Console plugin and agentic console rollout

Layer / File(s) Summary
Shared console-plugin helpers
internal/controller/utils/utils.go, internal/controller/utils/console_plugin_reconciler.go, internal/controller/utils/console_plugin_test.go, internal/controller/utils/suite_test.go
Shared utilities add console-plugin resource generators, task runners, restart/deletion helpers, and tests for ConfigMap, Service, Deployment, ConsolePlugin, NetworkPolicy, ServiceAccount, TLS-secret, and restart behavior.
Console controller migration
internal/controller/console/*
Console asset generation, deployment assembly, reconciliation orchestration, and tests now delegate to the shared console-plugin helpers.
Agentic console contract and generators
api/v1alpha1/olsconfig_types.go, cmd/main.go, internal/controller/utils/constants.go, internal/controller/utils/types.go, internal/controller/utils/testing.go, internal/controller/utils/resource_defaults_test.go, internal/controller/reconciler/interface.go, internal/controller/olsconfig_helpers.go, internal/controller/agenticconsole/*
Agentic-console CRD, CLI, controller contract, constants, and resource generators add the new image override and agentic-specific objects.
Agentic console reconciliation and wiring
internal/controller/agenticconsole/reconciler.go, internal/controller/agenticconsole/reconciler_test.go, internal/controller/agenticconsole/suite_test.go, internal/controller/olsconfig_controller.go, internal/controller/watchers/watchers.go, internal/controller/appserver/reconciler.go, cmd/main.go
Agentic console reconciliation is wired into OLSConfig phase handling, restart watches, finalizer cleanup, and local-dev secret skipping, with envtest coverage for creation, deletion, and deployment override paths.
AI spec updates
.ai/spec/README.md, .ai/spec/how/*, .ai/spec/what/*
The AI spec set adds the agentic-console spec and updates the project structure, reconciliation, and local-development references for the new console-plugin flow.
Operator guide and architecture updates
AGENTS.md, ARCHITECTURE.md
AGENTS.md and ARCHITECTURE.md update the controller layout, reconciliation phases, restart flow, local-dev notes, and finalizer cleanup sequence to include the agentic console plugin.

Sequence Diagram(s)

sequenceDiagram
  participant OLSConfigReconciler
  participant agenticconsole
  participant utils
  OLSConfigReconciler->>agenticconsole: ReconcileAgenticConsoleUIResources()
  agenticconsole->>utils: RunReconcileTasks(...)
  OLSConfigReconciler->>agenticconsole: ReconcileAgenticConsoleUIDeploymentAndPlugin()
  agenticconsole->>utils: ReconcileConsolePluginDeployment(...)
  agenticconsole->>utils: WaitForConsolePluginTLSSecret(...)
  agenticconsole->>utils: ActivateConsolePlugin(...)
  OLSConfigReconciler->>agenticconsole: RemoveAgenticConsole()
  agenticconsole->>utils: RunDeleteTasks(...)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • bparees
  • joshuawilson
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.31% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: reconciling the agentic console plugin in lightspeed-operator.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot requested review from joshuawilson and xrajesh June 25, 2026 12:21
@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign blublinsky for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.ai/spec/README.md:
- Line 52: The cross-reference entry for console-ui.md and agentic-console-ui.md
is too narrow because those docs now cover ConsolePlugin lifecycle and cleanup,
not only deployment generation. Update the README cross-reference table near the
existing deployment-generation mapping by splitting the console docs into a
separate entry or adding the reconciliation guide alongside
how/deployment-generation.md, and verify the referenced architecture and command
descriptions against AGENTS.md, ARCHITECTURE.md, and CONTRIBUTING.md.

In `@cmd/main.go`:
- Line 188: The `--agentic-console-image` flag is defined in `main` but not
wired into the operator deployment args, so add it to the container argument
lists used by the OLM bundle and the canonical manager manifest. Update the args
block that currently includes `--console-image`, `--service-image`, and
`--postgres-image` so it also passes `--agentic-console-image`, keeping the
ordering and style consistent with the existing image override flags.

In `@internal/controller/utils/console_plugin_reconciler.go`:
- Around line 35-53: The continueOnError path in RunReconcileTasks is
double-logging task failures and returning only a stringified task list, which
drops the original error chain. Keep a single log per failed task, collect the
task errors in a slice, and return one aggregated error using errors.Join while
preserving each task name via wrapping; also alias the standard errors import
(for example, stderrors) so it does not conflict with
k8s.io/apimachinery/pkg/api/errors.

In `@internal/controller/utils/utils.go`:
- Around line 1000-1002: The GenerateConsolePluginDeployment helper currently
dereferences opts.Resources without a defensive check, which can lead to a nil
pointer panic if the utility is called with missing resource settings. Add a nil
guard in GenerateConsolePluginDeployment before using opts.Resources, and fall
back to DefaultConsolePluginResourceRequirements() when it is nil so the
deployment setup remains safe even for direct callers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d9b9e113-e1d2-4736-9ab9-24ace63131c5

📥 Commits

Reviewing files that changed from the base of the PR and between fb5c715 and 1d9cced.

⛔ Files ignored due to path filters (2)
  • api/v1alpha1/zz_generated.deepcopy.go is excluded by !**/zz_generated.deepcopy.go
  • config/crd/bases/ols.openshift.io_olsconfigs.yaml is excluded by !config/crd/bases/**
📒 Files selected for processing (33)
  • .ai/spec/README.md
  • .ai/spec/how/project-structure.md
  • .ai/spec/how/reconciliation.md
  • .ai/spec/what/agentic-console-ui.md
  • .ai/spec/what/console-ui.md
  • AGENTS.md
  • ARCHITECTURE.md
  • api/v1alpha1/olsconfig_types.go
  • cmd/main.go
  • internal/controller/agenticconsole/assets.go
  • internal/controller/agenticconsole/assets_test.go
  • internal/controller/agenticconsole/deployment.go
  • internal/controller/agenticconsole/reconciler.go
  • internal/controller/agenticconsole/reconciler_test.go
  • internal/controller/agenticconsole/suite_test.go
  • internal/controller/appserver/reconciler.go
  • internal/controller/console/assets.go
  • internal/controller/console/assets_test.go
  • internal/controller/console/deployment.go
  • internal/controller/console/reconciler.go
  • internal/controller/console/reconciler_test.go
  • internal/controller/olsconfig_controller.go
  • internal/controller/olsconfig_helpers.go
  • internal/controller/reconciler/interface.go
  • internal/controller/utils/console_plugin_reconciler.go
  • internal/controller/utils/console_plugin_test.go
  • internal/controller/utils/constants.go
  • internal/controller/utils/resource_defaults_test.go
  • internal/controller/utils/suite_test.go
  • internal/controller/utils/testing.go
  • internal/controller/utils/types.go
  • internal/controller/utils/utils.go
  • internal/controller/watchers/watchers.go
💤 Files with no reviewable changes (1)
  • internal/controller/console/assets_test.go

Comment thread .ai/spec/README.md Outdated
Comment thread cmd/main.go
Comment thread internal/controller/utils/console_plugin_reconciler.go
Comment thread internal/controller/utils/utils.go Outdated
@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

@blublinsky: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants