Skip to content

matteo-grimaldi/mta-kai-demo-setup

Repository files navigation

MTA + KAI on OpenShift: Installation & VS Code Setup

This guide provides a complete walkthrough for installing the Migration Toolkit for Applications (MTA) with Konveyor AI (KAI) on OpenShift and configuring the VS Code extension for AI-powered code analysis and migration assistance.

Table of Contents


Overview

This setup connects three components:

  1. MTA Hub - Runs on OpenShift, provides the migration analysis platform
  2. KAI Solution Server - AI component that processes code analysis requests
  3. LLM Provider - Large Language Model (via OpenShift AI MaaS, OpenAI, Azure, etc.)

The VS Code extension communicates with both the LLM model and the KAI Solution Server, which in turn uses itself the configured LLM (can be a different one with respect to the one used by the VSCode MTA extension) to provide intelligent code migration suggestions for future use. The Solution Server augments previous patterns of how source code changed to resolve issues (also called solved examples) that were similar to those in the current file, and suggests a resolution that has a higher confidence level derived from previous solutions. After accepting a suggested code fix, the Solution Server works with the large language model (LLM) in its configuration to improve the hints about the issue that becomes part of the context.


Architecture

                          ┌─────────────────────┐
                          │   VS Code           │
                          │   MTA Extension     │
                          └──────┬──────────┬───┘
                                 │          │
                       (Path 1)  │          │  (Path 2)
              Solution Server ───┘          └─── Direct LLM Access
                       HTTPS                       HTTPS
                                 │           │
                                 ▼           │
               ┌──────────────────────────┐  │
               │   OpenShift Cluster      │  │
               │                          │  │
               │  ┌──────────────────┐    │  │
               │  │  MTA Hub         │    │  │
               │  │  Route: /hub/    │    │  │
               │  │  services/kai/api│    │  │
               │  └────────┬─────────┘    │  │
               │           │              │  │
               │           ▼              │  │
               │ ┌──────────────────┐     │  │
               │ │ KAI Solution     │     │  │
               │ │ Server           │     │  │
               │ │ - kai-api        │     │  │
               │ │ - kai-db         │     │  │
               │ │ - kai-importer   │     │  │
               │ └────────┬─────────┘     │  │
               │          │               │  │
               └──────────┼─────────────-─┘  │
                          │                  │
                          │ HTTPS            │
                          │ (kai-api-keys)   │
                          ▼                  ▼
              ┌─────────────────────────────────────┐
              │   LLM Provider                      │
              │   - OpenShift AI MaaS               │
              │   - OpenAI                          │
              │   - Azure OpenAI                    │
              │   - AWS Bedrock                     │
              │   - Other OpenAI-compatible APIs    │
              └─────────────────────────────────────┘

Authentication Flow:

  • VSCode - MTA - Solution server - LLM

    1. VS Code extension → KAI Solution Server (via MTA Hub route)
    2. KAI Solution Server → LLM Provider (using credentials from kai-api-keys secret)
  • VSCode - LLM

    1. VS Code extension → LLM (using credentials from provider-settings.yaml)

Prerequisites

OpenShift Requirements

  • OpenShift Cluster: Version 4.12 or higher
  • Cluster Admin Access: Required to install operators
  • Internet Access: For pulling operator images and accessing LLM APIs

VS Code Requirements

  • VS Code: Version 1.85.0 or higher
  • Java Extensions: Version 1.45.0 or below (if analyzing Java applications)
  • MTA Extension: MTA 8.0.x VS Code Extension

LLM Provider

  • Access to one of the following:
    • OpenShift AI MaaS (used for this guide)
    • OpenAI API
    • Azure OpenAI
    • AWS Bedrock
    • Any OpenAI-compatible API endpoint

Installation

Step 1: Create MTA Namespace

Create the dedicated namespace for MTA:

oc apply -f 00-mta-namespace.yaml

Verify:

oc get namespace openshift-mta

Step 2: Install MTA Operator

Install the OperatorGroup and Subscription:

oc apply -f 01-mta-operatorgroup.yaml
oc apply -f 02-mta-operator-subscription.yaml

Verify the operator is running:

oc get csv -n openshift-mta | grep mta-operator

Expected output:

mta-operator.v8.0.1   Migration Toolkit for Applications Operator   8.0.1   Succeeded

Step 3: Configure LLM Integration

3.1 Obtain LLM API Credentials

For OpenShift AI MaaS:

  1. Log into your OpenShift AI cluster
  2. Navigate to Model-as-a-Service (MaaS)
  3. Select and subscribe to a model (e.g., granite-3-2-8b-instruct)
  4. Go to API Keys page and create a new API key
  5. Copy the API URL and API Key

For other providers:

3.2 Create the LLM API Secret

Option B: Using oc command directly

oc create secret generic kai-api-keys -n openshift-mta \
  --from-literal=OPENAI_API_BASE='<YOUR_LLM_API_URL>' \
  --from-literal=OPENAI_API_KEY='<YOUR_API_KEY>'

Verify the secret:

oc get secret kai-api-keys -n openshift-mta

Step 4: Deploy MTA with KAI

Deploy the Tackle custom resource to create the MTA Hub and KAI Solution Server:

oc apply -f 03-tackle.yaml

This will deploy:

  • MTA Hub UI and API
  • KAI Solution Server components (kai-api, kai-db, kai-importer)
  • Keycloak for authentication
  • PostgreSQL databases

Monitor the deployment:

# Watch all deployments
oc get pods -n openshift-mta -w

# Check KAI components specifically
oc get deploy,svc -n openshift-mta | grep -E 'kai-(api|db|importer)'

Wait for all pods to be Running/Ready:

oc get pods -n openshift-mta

Get the MTA Hub URL:

oc get route mta -n openshift-mta -o jsonpath='{.spec.host}'

Save this route URL - you'll need it for VS Code configuration.


VS Code Configuration

Configure Solution Server

  1. Get your MTA Hub route:

    MTA_ROUTE=$(oc get route mta -n openshift-mta -o jsonpath='{.spec.host}')
    echo "https://${MTA_ROUTE}/hub/services/kai/api"
  2. Edit .vscode/settings.json and replace <YOUR_MTA_ROUTE> with your actual route, for example:

    {
        "mta-vscode-extension.genai.agentMode": false,
        "mta-vscode-extension.solutionServer": {
            "enabled": true,
            "url": "https://mta-openshift-mta.apps.cluster-xyz.opentlc.com/hub/services/kai/api",
            "auth": {
                "enabled": false
            }
        }
    }

Configure Provider Settings

  1. Copy the provider settings template:

    cp provider-settings.yaml.template provider-settings.yaml
  2. Edit provider-settings.yaml and update:

    • Replace <YOUR_MAAS_MODEL_API_URL> with your model API url
    • Replace <YOUR_API_KEY> with your LLM API key
    • Verify the model name matches your deployment
    openshift-ai-granite-model: &active
      environment:
        OPENAI_API_KEY: "<YOUR_API_KEY>"
      provider: "ChatOpenAI"
      args:
        model: "granite-3-2-8b-instruct"
        configuration:
          baseURL: "<YOUR_MAAS_MODEL_API_URL>"
    
    active: *active
  3. Configure the extension:

    • Open VS Code
    • Go to SettingsExtensionsMTA
    • Under Provider Settings File, browse and select your provider-settings.yaml
    • Restart the MTA extension or reload VS Code

Verification

Verify OpenShift Deployment

  1. Check all MTA pods are running:

    oc get pods -n openshift-mta
  2. Verify KAI components:

    oc get deploy -n openshift-mta | grep kai

    Expected output:

    tackle-kai-api          1/1     1            1
    tackle-kai-importer     1/1     1            1
    
  3. Check KAI API logs:

    oc logs -n openshift-mta deployment/tackle-kai-api --tail=50
  4. Test the route:

    MTA_ROUTE=$(oc get route mta -n openshift-mta -o jsonpath='{.spec.host}')
    curl -k https://${MTA_ROUTE}/hub/services/kai/api/health || echo "Health check endpoint may not be available - this is normal"

Verify VS Code Extension

  1. Open a Java/Spring project in VS Code
  2. Open the MTA view (left sidebar)
  3. Run an analysis:
    • Right-click on your project
    • Select MTA: Analyze
    • Choose a transformation target (e.g., "Quarkus")
  4. Check for AI suggestions:
    • After analysis completes, you should see AI-powered suggestions
    • Look for code snippets and migration recommendations

Troubleshooting

KAI Pods Not Starting

Check pod status:

oc get pods -n openshift-mta | grep kai

Check pod logs:

# Check API logs
oc logs -n openshift-mta deployment/tackle-kai-api

# Check importer logs
oc logs -n openshift-mta deployment/tackle-kai-importer

Common issues:

  1. Missing secret: Ensure kai-api-keys secret exists
  2. Wrong model name: Verify kai_llm_model in 05-tackle.yaml matches your LLM
  3. LLM provider unreachable: Check network connectivity from OpenShift to your LLM provider

Extension Not Loading Provider Settings

  1. Verify file path: Check that provider-settings.yaml is in the correct location
  2. Check YAML syntax: Validate the YAML is properly formatted
  3. Restart VS Code: Reload the window or restart VS Code
  4. Check extension logs:
    • View → Output → Select "MTA" from dropdown
    • Look for errors related to provider configuration

Model Name Mismatch

Ensure consistency across all configurations:

Location Field Example Value
05-tackle.yaml kai_llm_model granite-3-2-8b-instruct
provider-settings.yaml args.model granite-3-2-8b-instruct
LLM Provider Model subscription granite-3-2-8b-instruct

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


Additional Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors