# Helm chart for Digital.ai Release MCP

## Prerequisites

- Kubernetes 1.20+
- Helm 3.2.0+

## Minimal configuration for the K3D cluster

To install the chart with the release name `dai-mcp`:

```shell
helm dependency update .
helm install dai-mcp . -n digitalai --create-namespace
```

On finish of the last command you will see information about helm release.

### Minimal configuration for the AWS cluster

Run helm release `dai-mcp` installation with creation of the namespace:
```shell
helm dependency update .
helm install dai-mcp . -n digitalai --create-namespace
```

On finish of the last command you will see information about helm release.

### Minimal configuration for the OpenShift cluster (AWS)

Run helm release `dai-mcp` installation with creation of the namespace:
```shell
helm dependency update .
helm install dai-mcp . -n digitalai --create-namespace
```

On finish of the last command you will see information about helm release.

## Uninstalling the Chart

To uninstall/delete the `dai-mcp` release:

```shell
helm delete dai-mcp -n digitalai
```
The command removes all the Kubernetes components associated with the chart and deletes the release.

To delete all resources with one command (if in the namespace is only release-mcp installed) you can delete namespace with:
```shell
kubectl delete namespace digitalai
```

### Basic Configuration Example

```yaml
config:
  appName: "application_name"
  release:
    baseUrl: "url_to_release_server"
    authType: "bearer_token"
  mcp:
    environment: "staging"
  oauth:
    enabled: true
    issuer: "Issuer URL for the OAuth provider, e.g. https://identity.staging.digital.ai/auth/realms/company"
    jwksUrl: "JWKS URL for the OAuth provider, e.g. https://identity.staging.digital.ai/auth/realms/company/protocol/openid-connect/certs"
    audience: "OAuth audience for token validation, e.g. dai-release-mcp"
    usernameClaim: "OAuth claim to use for username, e.g. preferred_username"
```

## Parameters

### Global parameters

| Name                      | Description                                   | Value |
| ------------------------- | --------------------------------------------- | ----- |
| `global.imageRegistry`    | Global Docker image registry override         | `""`  |
| `global.imagePullSecrets` | Global Docker image pull secrets              | `[]`  |
| `global.storageClass`     | Global Storage Class for dynamic provisioning | `""`  |

### MCP configuration parameters

| Name                                  | Description                                                   | Value                                                                                   |
| ------------------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `config.logLevel`                     | Log level for the application (DEBUG, INFO, WARN, ERROR)      | `INFO`                                                                                  |
| `config.release.baseUrl`              | Digital.ai Release server base URL                            | `http://localhost:5516`                                                                 |
| `config.release.authType`             | Authentication type for Release (bearer_token, api_key, etc.) | `bearer_token`                                                                          |
| `config.mcp.transport`                | MCP transport protocol (http, sse, websocket)                 | `http`                                                                                  |
| `config.mcp.host`                     | MCP server host address                                       | `0.0.0.0`                                                                               |
| `config.mcp.readonlyMode`             | Enable readonly mode for MCP                                  | `true`                                                                                  |
| `config.mcp.environment`              | MCP environment name                                          | `staging`                                                                               |
| `config.feature.plaintextLogging`     | Enable plaintext logging                                      | `false`                                                                                 |
| `config.feature.openTelemetryEnabled` | Enable OpenTelemetry tracing/metrics                          | `false`                                                                                 |
| `config.feature.otelLogExport`        | Enable OpenTelemetry log export                               | `false`                                                                                 |
| `config.oauth.enabled`                | Enable OAuth authentication                                   | `true`                                                                                  |
| `config.oauth.issuer`                 | OAuth issuer URL                                              | `https://identity.staging.digital.ai/auth/realms/company`                               |
| `config.oauth.jwksUrl`                | OAuth JWKS URL for token verification                         | `https://identity.staging.digital.ai/auth/realms/company/protocol/openid-connect/certs` |
| `config.oauth.audience`               | OAuth audience for token validation                           | `dai-release-mcp`                                                                       |
| `config.oauth.usernameClaim`          | OAuth claim to use for username                               | `preferred_username`                                                                    |
| `config.otel.exporterEndpoint`        | OpenTelemetry exporter endpoint                               | `http://otel-collector.cluster.local:4318`                                              |
| `config.otel.exporterProtocol`        | OpenTelemetry exporter protocol (http/protobuf, grpc)         | `http/protobuf`                                                                         |
| `config.otel.serviceName`             | OpenTelemetry service name                                    | `dai-release-mcp-integration`                                                           |
| `config.otel.serviceNamespace`        | OpenTelemetry service namespace                               | `default`                                                                               |
| `config.otel.tracesSamplerArg`        | OpenTelemetry traces sampler argument (0.0-1.0)               | `1.0`                                                                                   |
| `config.otel.tracesExporter`          | OpenTelemetry traces exporter type                            | `otlp`                                                                                  |
| `config.otel.logsExporter`            | OpenTelemetry logs exporter type                              | `otlp`                                                                                  |
| `config.otel.metricsExporter`         | OpenTelemetry metrics exporter type                           | `otlp`                                                                                  |

### Deployment parameters

| Name                                                | Description                                                                                                              | Value                                  |
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- |
| `replicaCount`                                      | Number of deployment replicas                                                                                            | `1`                                    |
| `image.registry`                                    | Docker image registry                                                                                                    | `docker.io`                            |
| `image.repository`                                  | Docker image repository                                                                                                  | `xebialabsunsupported/dai-release-mcp` |
| `image.tag`                                         | Docker image tag                                                                                                         | `{{ .Chart.AppVersion }}`              |
| `image.pullPolicy`                                  | Docker image pull policy                                                                                                 | `IfNotPresent`                         |
| `commonLabels`                                      | Labels to add to all deployed resources                                                                                  | `{}`                                   |
| `commonAnnotations`                                 | Annotations to add to all deployed resources                                                                             | `{}`                                   |
| `deploymentLabels`                                  | Labels to add to the deployment                                                                                          | `{}`                                   |
| `deploymentAnnotations`                             | Annotations to add to the deployment                                                                                     | `{}`                                   |
| `podLabels`                                         | Labels to add to the pod                                                                                                 | `{}`                                   |
| `podAnnotations`                                    | Annotations to add to the pod                                                                                            | `{}`                                   |
| `priorityClassName`                                 | Name of the priority class to be used by the deployment                                                                  | `""`                                   |
| `schedulerName`                                     | Use an alternate scheduler, e.g. "stork".                                                                                | `""`                                   |
| `podAffinityPreset`                                 | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard`                                      | `""`                                   |
| `podAntiAffinityPreset`                             | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard`                                 | `soft`                                 |
| `nodeAffinityPreset.type`                           | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard`                                | `""`                                   |
| `nodeAffinityPreset.key`                            | Node label key to match Ignored if `affinity` is set.                                                                    | `""`                                   |
| `nodeAffinityPreset.values`                         | Node label values to match. Ignored if `affinity` is set.                                                                | `[]`                                   |
| `affinity`                                          | Affinity for pod assignment. Evaluated as a template                                                                     | `{}`                                   |
| `nodeSelector`                                      | Node labels for pod assignment. Evaluated as a template                                                                  | `{}`                                   |
| `tolerations`                                       | Tolerations for pod assignment. Evaluated as a template                                                                  | `[]`                                   |
| `topologySpreadConstraints`                         | Topology Spread Constraints for pod assignment spread across your cluster among failure-domains. Evaluated as a template | `[]`                                   |
| `podSecurityContext.enabled`                        | Enable Release pod's Security Context                                                                                    | `false`                                |
| `podSecurityContext.runAsUser`                      | Set Release pod's Security Context runAsUser                                                                             | `10001`                                |
| `podSecurityContext.fsGroup`                        | Set Release pod's Security Context fsGroup                                                                               | `10001`                                |
| `containerSecurityContext.enabled`                  | Enabled Release containers' Security Context                                                                             | `true`                                 |
| `containerSecurityContext.runAsNonRoot`             | Set Release container's Security Context runAsNonRoot                                                                    | `false`                                |
| `containerSecurityContext.allowPrivilegeEscalation` | Set Release container's Security Context allowPrivilegeEscalation                                                        | `false`                                |
| `containerSecurityContext.readOnlyRootFilesystem`   | Mounts the container's root filesystem as read-only                                                                      | `true`                                 |
| `containerSecurityContext.capabilities`             | Set Release container's Security Context capabilities                                                                    |                                        |
| `containerSecurityContext.seccompProfile`           | Set Release container's Security Context seccompProfile                                                                  |                                        |
| `resources.enabled`                                 | Enable resource requests/limits                                                                                          | `true`                                 |
| `resources.limits.memory`                           | Memory limit                                                                                                             | `2Gi`                                  |
| `resources.requests.memory`                         | Memory request                                                                                                           | `512Mi`                                |
| `resources.requests.cpu`                            | CPU request                                                                                                              | `250m`                                 |
| `livenessProbe.enabled`                             | Enable livenessProbe                                                                                                     | `true`                                 |
| `livenessProbe.initialDelaySeconds`                 | Initial delay seconds for livenessProbe                                                                                  | `10`                                   |
| `livenessProbe.periodSeconds`                       | Period seconds for livenessProbe                                                                                         | `10`                                   |
| `livenessProbe.timeoutSeconds`                      | Timeout seconds for livenessProbe                                                                                        | `20`                                   |
| `livenessProbe.failureThreshold`                    | Failure threshold for livenessProbe                                                                                      | `3`                                    |
| `livenessProbe.successThreshold`                    | Success threshold for livenessProbe                                                                                      | `1`                                    |
| `readinessProbe.enabled`                            | Enable readinessProbe                                                                                                    | `true`                                 |
| `readinessProbe.initialDelaySeconds`                | Initial delay seconds for readinessProbe                                                                                 | `10`                                   |
| `readinessProbe.periodSeconds`                      | Period seconds for readinessProbe                                                                                        | `10`                                   |
| `readinessProbe.timeoutSeconds`                     | Timeout seconds for readinessProbe                                                                                       | `20`                                   |
| `readinessProbe.failureThreshold`                   | Failure threshold for readinessProbe                                                                                     | `3`                                    |
| `readinessProbe.successThreshold`                   | Success threshold for readinessProbe                                                                                     | `1`                                    |

### ServiceAccount parameters

| Name                    | Description                        | Value   |
| ----------------------- | ---------------------------------- | ------- |
| `serviceAccount.create` | Whether to create a ServiceAccount | `false` |
| `serviceAccount.name`   | Name of the ServiceAccount         | `""`    |

### Release debug parameters

| Name                     | Description                                                                             | Value                       |
| ------------------------ | --------------------------------------------------------------------------------------- | --------------------------- |
| `diagnosticMode.enabled` | Enable diagnostic mode (all probes will be disabled and the command will be overridden) | `false`                     |
| `diagnosticMode.command` | Command to override all containers in the deployment                                    | `["/opt/xebialabs/tini"]`   |
| `diagnosticMode.args`    | Args to override all containers in the deployment                                       | `["--","sleep","infinity"]` |

### Service configuration

| Name                  | Description                                                 | Value       |
| --------------------- | ----------------------------------------------------------- | ----------- |
| `service.type`        | Kubernetes service type (ClusterIP, NodePort, LoadBalancer) | `ClusterIP` |
| `service.port`        | Service port                                                | `8000`      |
| `service.annotations` | Service annotations                                         | `{}`        |
| `service.labels`      | Service labels                                              | `{}`        |
| `containerPorts.http` | Release HTTP port value exposed on the container            | `8000`      |

### MCP runtime parameters

| Name                            | Description                                                                                        | Value                           |
| ------------------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------- |
| `command`                       | Override default container command (useful when using custom images)                               | `["python"]`                    |
| `args`                          | Override default container args (useful when using custom images)                                  | `["-m","dai_release_mcp.main"]` |
| `lifecycleHooks`                | Overwrite livecycle for the Release container(s) to automate configuration before or after startup | `{}`                            |
| `terminationGracePeriodSeconds` | Default duration in seconds k8s waits for container to exit before sending kill signal.            | `450`                           |
| `extraEnvVars`                  | Extra environment variables to add to Release pods                                                 | `[]`                            |
| `extraEnvVarsCM`                | Name of existing ConfigMap containing extra environment variables                                  | `""`                            |
| `extraEnvVarsSecret`            | Name of existing Secret containing extra environment variables (in case of sensitive data)         | `""`                            |

### Release DNS parameters

| Name          | Description                     | Value   |
| ------------- | ------------------------------- | ------- |
| `hostAliases` | Deployment pod host aliases     | `[]`    |
| `dnsPolicy`   | DNS Policy for pod              | `""`    |
| `dnsConfig`   | DNS Configuration pod           | `{}`    |
| `hostNetwork` | Set to true to use host network | `false` |
