Commit 6a4c2e93 authored by Kostas Chartsias's avatar Kostas Chartsias
Browse files

Merge branch 'feat/add-helm-charts' into 'main'

feat: add helm charts and cleanup

See merge request !1
parents e2f9a5de 265c5f50
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ Run the container:

The Dockerfile sets these defaults:
```
ENV APP_HOST=0.0.0.0
ENV APP_PORT=9013
ENV MCP_SERVER_URL=http://127.0.0.1:8004/mcp
...
+9 −4
Original line number Diff line number Diff line
@@ -8,13 +8,13 @@

This deployment relies on a `.env` file that is loaded at runtime by Docker Compose.
```
GROQ_API_KEY=your-secret-key
OpenOP_BACKEND_OAI=http://example-backend
GROQ_API_KEY=your-groq-api-key
OEG_SERVICE_URL=http://your-oeg-api-url/oeg/1.0.0
GROQ_MODEL_NAME=qwen/qwen3-32b   
```

## Run
Start services

```
docker compose --env-file .env up -d
```
@@ -25,6 +25,11 @@ docker compose down

## Additional Info
All service ports are explicitly forwarded to the host to simplify local development, testing and debugging.
This allows you to interact with APIs and MCP Servers individually, without attaching to containers or using internal Docker networking tools.
This allows you to interact with APIs and MCP servers individually, without attaching to containers or using internal Docker networking tools.

| Service   | Host Port |
|-----------|-----------|
| mcp       | 8004      |
| ai-agent  | 9013      |

---
 No newline at end of file
+10 −18
Original line number Diff line number Diff line
version: "3.9"

services:
  api:
    image: labs.etsi.org:5050/oop/code/ai2/dummy_backend
    container_name: api
    environment:
      API_HOST: 0.0.0.0
      API_PORT: 8081
    ports:
      - "8081:8081"
    networks:
      - ai_net

  mcp:
    image: labs.etsi.org:5050/oop/code/ai2/mcp_module
    container_name: mcp
    environment:
      MCP_HOST: 0.0.0.0
      MCP_PORT: 8004
      OpenOP_BACKEND_OAI: ${OpenOP_BACKEND_OAI}
      OEG_SERVICE_URL: ${OEG_SERVICE_URL}
    ports:
      - "8004:8004"
    networks:
      - ai_net
    healthcheck:
      test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8004/health')"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 10s

  ai-agent:
    image: labs.etsi.org:5050/oop/code/ai2/ai_agent
    container_name: ai-agent
    depends_on:
      - mcp
      mcp:
        condition: service_healthy
    environment:
      APP_HOST: 0.0.0.0
      APP_PORT: 9013
      MCP_SERVER_URL: http://mcp:8004/mcp
      GROQ_API_KEY: ${GROQ_API_KEY}
      GROQ_MODEL_NAME: openai/gpt-oss-20b
      GROQ_MODEL_NAME: ${GROQ_MODEL_NAME:-qwen/qwen3-32b}
    ports:
      - "9013:9013"
    networks:
+94 −0
Original line number Diff line number Diff line
# AI2 Helm Chart

Deploys the AI2 stack — MCP server and AI Agent — into a Kubernetes cluster.

## Components

| Component  | Description                                              | Default Port |
|------------|----------------------------------------------------------|-------------|
| mcp        | MCP server exposing CAMARA-compliant tools via FastMCP   | 8004        |
| ai-agent   | Quart backend accepting natural language prompts via Groq | 9013        |

The ai-agent waits for the MCP server to be healthy before starting (via initContainer).

## Prerequisites

- Kubernetes cluster
- Helm 3+
- Groq API key
- OEG service reachable from within the cluster

## Install

```bash
helm install ai2 ./helm/ai2 \
  --namespace oop \
  --create-namespace \
  --set secrets.groqApiKey=<your-groq-api-key> \
  --set config.mcp.oegServiceUrl=http://<oeg-host>/oeg/1.0.0
```

## Upgrade

```bash
helm upgrade ai2 ./helm/ai2 \
  --namespace oop \
  --set secrets.groqApiKey=<your-groq-api-key> \
  --set config.mcp.oegServiceUrl=http://<new-oeg-host>/oeg/1.0.0
```

## Uninstall

```bash
helm uninstall ai2 --namespace oop
```

## Key Values

| Value                           | Description                      | Default                  |
|---------------------------------|----------------------------------|--------------------------|
| `secrets.groqApiKey`            | Groq API key (required)          | `""`                     |
| `config.mcp.oegServiceUrl`      | Base URL of the OEG service      | `http://oeg/oeg/1.0.0`   |
| `config.aiAgent.groqModelName`  | Groq model identifier            | `qwen/qwen3-32b`         |
| `service.mcp.type`              | Kubernetes service type for MCP  | `NodePort`               |
| `service.mcp.nodePort`          | NodePort for MCP                 | `32004`                  |
| `service.aiAgent.nodePort`      | NodePort for ai-agent            | `32013`                  |
| `images.mcp.tag`                | MCP image tag                    | `latest`                 |
| `images.aiAgent.tag`            | AI Agent image tag               | `latest`                 |

## Local Development (kind)

Build and load images locally instead of pulling from the registry:

```bash
docker build -t <your_mcp_dev_image>:latest ../../mcp_module
docker build -t <your_ai_agent_dev_image>:latest ../../ai_agent

kind load docker-image <your_mcp_dev_image>:latest --name <your-cluster>
kind load docker-image <your_ai_agent_dev_image>:latest --name <your-cluster>
```

Then install with `pullPolicy: IfNotPresent` to use the local images:

```bash
helm install ai2 ./helm/ai2 \
  --namespace oop \
  --create-namespace \
  --set secrets.groqApiKey=<your-groq-api-key> \
  --set config.mcp.oegServiceUrl=http://<oeg-host>/oeg/1.0.0 \
  --set images.mcp.pullPolicy=IfNotPresent \
  --set images.aiAgent.pullPolicy=IfNotPresent
```

## Test the Deployment

```bash
# Health checks
curl http://<node-ip>:32004/health   # MCP
curl http://<node-ip>:32013/health   # AI Agent

# Send a natural language prompt
curl -X POST http://<node-ip>:32013/groq-mcp \
  -H "Content-Type: application/json" \
  -d '{"query": "Create a QoD session for device with public IP 12.1.0.20, application server IP 198.51.100.10, QoS profile qos-e, duration 3600 seconds"}'
```
+14 −0
Original line number Diff line number Diff line
apiVersion: v2
name: ai2
type: application
version: 1.0.0
appVersion: "1.0.0"
keywords:
  - ai2
  - oop
  - etsi
  - mcp
  - ai-agent
home: https://labs.etsi.org/rep/oop/code/ai2
maintainers:
  - name: OOP Team
Loading