Skip to content

✨ Integrate new kagenti operator and new installer changes - #425

Merged
cwiklik merged 25 commits into
mainfrom
new-operator-and-installer-changes
Dec 10, 2025
Merged

cwiklik merged 25 commits into
mainfrom
new-operator-and-installer-changes

Conversation

@cwiklik

@cwiklik cwiklik commented Nov 24, 2025 •

Copy link
Copy Markdown
Contributor

Summary

This PR implements changes to support the new Kagenti operator and Toolhive integration in the UI and installer.

Changes

UI Enhancements

  • Add support for Agent, AgentBuild, and MCPServer Custom Resources (CRs)
  • Updates agent import form for deploying agents
  • Updates tool import form for deploying MCP tools
  • Update UI components to work with new operator CRDs

New Kagent Installer Updates

  • Add installation of Toolhive CRDs
  • Add installation of Toolhive operator
  • Add installation of new Kagenti operator
  • Add installation of Kagenti webhooks
  • Update Ansible playbooks and default values
  • Update Chart configurations and dependencies

Related issue(s)

Fixes #401

@cwiklik cwiklik added the enhancement New feature or request label Nov 24, 2025
@cwiklik
cwiklik marked this pull request as draft November 24, 2025 21:31
@pdettori

pdettori commented Dec 3, 2025

Copy link
Copy Markdown
Member

@cwiklik can you pls. rebase?

@cwiklik
cwiklik force-pushed the new-operator-and-installer-changes branch 3 times, most recently from 942b8c7 to ad17b6d Compare December 3, 2025 18:43
@cwiklik

cwiklik commented Dec 3, 2025 •

Copy link
Copy Markdown
Contributor Author

Testing Instructions for PR 425

These instructions are for testing PR 425 locally on your machine.

Pull PR from GitHub

  1. Clone the repository (if you haven't already):
   git clone https://github.com/kagenti/kagenti.git
   cd kagenti
  1. Fetch and check out the PR branch:
   git fetch origin new-operator-and-installer-changes
   git checkout new-operator-and-installer-changes

Pre-Installation Setup

  1. Follow the installer instructions:
    Read and follow the setup instructions from the Ansible README

  2. Create the secret values file:
    Create a file named .secret_values.yaml in kagenti/deployments/envs/ with the following content:

   # Example secret values file. This file should be kept out of source control (add to
   # .gitignore) and provided at runtime via -e "secret_values_file=secret_values.yaml".

   # Top-level keys will be merged into each component's values unless you
   # structure them under component-specific keys.

   # Example for global secrets:
   global: {}
   #  jwt_key: "REPLACE_WITH_JWT_KEY"
   #  db_password: "REPLACE_WITH_DB_PASSWORD"

   charts:
     kagenti:
       values:
         secrets:
           githubUser: ""
           githubToken: ""
           openaiApiKey: ""
           
   # Example component-specific secrets
   #kagenti:
   #  postgres:
   #    password: "REPLACE_WITH_PG_PASSWORD"

Important: Replace <user>, <github token>, and <open-ai token> with your actual credentials.

Installation Steps

  1. Navigate to the ansible directory:
   cd deployments/ansible
  1. Monitor the installation (optional):
    Open a new terminal and watch the Kagenti pods come up during installation:
   watch kubectl get pods -A
  1. Run the installation script:
   ./run-install.sh --env dev --preload --extra-vars '{"kind_images_preload": true}'
  1. Wait for the installation to complete and continue to the final step below (UI Pod Replacement)

UI Pod Replacement

Once the installation is complete, replace the UI pod:

Note: The installer installs a release-level version of the UI which does not include the changes from this PR. You need to replace it with the version from the PR branch.

  1. Navigate to the UI directory:
   cd kaegenti/kagenti/ui
  1. Run the UI development build script:
   ./scripts/ui-dev-build.sh

That's it! The environment should now be ready for testing.

Comment thread charts/kagenti/values.yaml Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR integrates the new Kagenti operator architecture and Toolhive operator for MCP tool management, representing a significant architectural evolution of the platform.

Key Changes:

  • Replaces single Component CRD with separate Agent, AgentBuild, and MCPServer CRDs for better separation of concerns
  • Integrates Toolhive operator (v0.5.3) and CRDs (v0.0.60) for managing MCP tools
  • Updates UI to work with new CRD structure and API groups (agent.kagenti.dev and toolhive.stacklok.dev)
  • Adds new AgentBuild workflow that separates image building from agent deployment
  • Updates installer with new Helm chart dependencies for kagenti-webhook and removes deprecated platform-operator

Reviewed changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
uv.lock Updates Python dependencies including test dependencies (pytest, httpx, a2a-sdk, etc.) and adjusts resolution markers for Python 3.13
kagenti/ui/scripts/ui-dev-build.sh Updates kind cluster name from agent-platform to kagenti
kagenti/ui/pages/02_Tool_Catalog.py Updates tool catalog to use Toolhive CRD group/version and MCPServer plural
kagenti/ui/pages/01_Agent_Catalog.py Updates agent deletion to handle both Agent and AgentBuild CRs
kagenti/ui/lib/kube.py Updates API calls to use new CRD groups and plurals for agents and tools
kagenti/ui/lib/constants.py Defines new CRD groups, versions, and plurals for the new operator architecture
kagenti/ui/lib/build_utils.py Major refactoring: adds AgentBuild CR construction, updates Agent/MCPServer resource bodies, adds strip_protocol utility
kagenti/installer/app/components/operator.py Updates log message to reflect "Kagenti Operator" naming
docs/ocp/openshift-install.md Adds troubleshooting section for SPIRE daemonsets (contains duplicate content)
deployments/envs/*.yaml Adds toolhive operator and CRDs configuration flags
deployments/ansible/roles/kagenti_installer/tasks/main.yml Updates Toolhive CRD installation configuration
deployments/ansible/default_values.yaml Adds toolhive configuration (contains duplicate keys)
charts/kagenti/values.yaml Renames operator components and updates default agent namespace
charts/kagenti/templates/ui.yaml Updates UI RBAC to grant permissions for new CRDs
charts/kagenti/Chart.yaml Replaces platform-operator with agent-operator and adds webhook chart dependency
charts/kagenti/Chart.lock Updates chart lock with new dependencies
charts/kagenti-deps/values.yaml Adds toolhive components configuration
charts/kagenti-deps/templates/spire-operand.yaml Contains unresolved merge conflict

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread charts/kagenti/Chart.yaml Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread docs/ocp/openshift-install.md Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread docs/ocp/openshift-install.md Resolved
@cwiklik
cwiklik force-pushed the new-operator-and-installer-changes branch 2 times, most recently from 24c6528 to 8401988 Compare December 4, 2025 14:20
@cwiklik
cwiklik force-pushed the new-operator-and-installer-changes branch from 8401988 to aaaf035 Compare December 4, 2025 14:56
Comment thread deployments/ansible/default_values.yaml Outdated
version: 0.5.3
release_name: "toolhive-operator"
namespace: "toolhive-system"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

duplication of the keys in line 37-39 and 41-46 with those in lines 16-17 and 19-20.

  1. Please consolidate them
  2. since they are helm charts, please put them under the "charts:" key
  3. Adjust the templates depending on this refactoring (e.g. .Values.toolhiveOperator -> Values.charts.toolhiveOperator)

@cwiklik cwiklik Dec 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. is probably a merge bug.
  2. These already are under charts:
charts:
  kagenti-deps:
    enabled: true
    chart: "../../charts/kagenti-deps"
    release_name: "kagenti-deps"
    namespace: "kagenti-system"
    dependency_update: true
    # values for the helm chart overriding the chart's values.yaml file
    values:
      openshift: false
      components:
...
        toolhiveOperator:
          enabled: false
        toolhiveCRDs:
          enabled: false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But ToolHive charts are installed as separate charts ... so those values should not be under charts.kagenti-deps.values - they should be a main key under charts:

@cwiklik cwiklik Dec 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is this right:

charts:
  
  kagenti-deps:
    enabled: true
...
  toolhiveCRDs:
    namespace: "kagenti-system"
    enabled: true
    version: 0.0.60
        
  toolhiveOperator:
    namespace: "kagenti-system"
    enabled: true
    version: 0.5.3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

right .. then make sure that the references to these are correct in the templates

@cwiklik cwiklik Dec 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I must admit that the changes I've made to the installer are just best guesses. When you say 'templates' do you mean yaml files in charts/kagenti-deps/templates folder? Should there be a dedicated yaml for toolhiveOperator and another for toolhiveCRDs? With the changes above, the installer installs both charts for toolhive.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh that's right... those variables would be used by Ansible, not by a helm chart, sorry I was unclear. So they would rather show up on the ansible installer main file https://github.com/kagenti/kagenti/blob/main/deployments/ansible/roles/kagenti_installer/tasks/main.yml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

will need also another rebase (should be simple this time)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The main has already been updated with toolhive charts. Rebase done as well.

Signed-off-by: cwiklik <[email protected]>
Signed-off-by: cwiklik <[email protected]>
@pdettori

pdettori commented Dec 8, 2025

Copy link
Copy Markdown
Member

testing with the new UI uncovered a new issue - the agent operator deploys a service with name <agent-name>-svc but the UI expects to connect to a service with name <agent-name>:

for example:

the UI detail page shows:

An unexpected error occurred fetching agent card: HTTP Error 503: Network communication error fetching agent card from http://a2a-contact-extractor.team1.svc.cluster.local:8000/.well-known/agent.json: [Errno -2] Name or service not known

but the service is:

 $ k get svc -n team1
NAME                        TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
a2a-contact-extractor-svc   ClusterIP   10.96.70.153   <none>        8000/TCP   20m

@pdettori

pdettori commented Dec 9, 2025

Copy link
Copy Markdown
Member

Tested the installer from the latest PR 425, replace the UI image with the above script and deploy both weather agent and tool, and get them to work!

couple of issues:

  1. for some reason all env variables that are defined in agent CR are duplicated in the deployment - it gives a lot of warnings if you try to scale it for example or edit it

  2. The MCP_URL that we use as default in the pre-defined env variables set needs to be adjusted to the new URL for toolhive

  3. Seems like the new deployments are allocating more CPU (?) (either toolhive or agent deployment ?) - after deploying 2 agents and a tool I got:

Warning  FailedScheduling  4m14s  default-scheduler  0/1 nodes are available: 1 Insufficient cpu. no new claims to deallocate, preemption: 0/1 nodes are available: 1 No preemption victims found for incoming pod.

I had to delete one deployment to have enough CPUs (I have now 4 in my podman machine)

@cwiklik
cwiklik marked this pull request as ready for review December 10, 2025 16:59
@cwiklik
cwiklik merged commit 8d8751b into main Dec 10, 2025
@github-project-automation github-project-automation Bot moved this from In review / Needs Testing to Done in Rossoctl Issue Prioritization Dec 10, 2025
Comment thread docs/demos.md

To override existing environments, you may create a [customized override file](../deployments/ansible/README.md#using-override-files).

<<<<<<< HEAD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems like some leftover merge conflicts remained here?

@pdettori

Copy link
Copy Markdown
Member

@Ladas right, it seems so

@cwiklik - could you pls. create a PR to address this?

@cwiklik

cwiklik commented Dec 11, 2025

Copy link
Copy Markdown
Contributor Author

OK, will fix this soon. Thanks for catching this.

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

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feature: Integrate New Kagenti Operator, MCPServer CR Support, and Identity Webhooks Into Installer and UI

4 participants