Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/helm-validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ jobs:

- name: Template with example overrides
run: helm template openops chart -f chart/values.overrides-example.yaml

- name: Template with MCP enabled
run: helm template openops chart -f chart/values.mcp-example.yaml
10 changes: 6 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
- `/chart/values.ci.yaml`: Resource-constrained overlay for CI environments.
- `/chart/values.dev.yaml`: Development overlay for local development environments.
- `/chart/values.production.yaml`: Production overlay with externalized dependencies and cloud settings.
- `/chart/templates/`: Kubernetes manifests rendered by Helm (43 files). Includes deployments/statefulsets, services, configmaps (`configmap-*.yaml`), secrets (`secret-env.yaml`, `external-secret.yaml`), service accounts, PodDisruptionBudgets, HorizontalPodAutoscalers, NetworkPolicy, LimitRange, ServiceMonitor for Prometheus, and Helm tests. Shared template helpers live in `_helpers.tpl` (561 lines with 49+ helper functions). Postgres and Redis use StatefulSets with volumeClaimTemplates for stable storage and safe rollouts.
- `/chart/values.mcp-example.yaml`: Overlay enabling the opt-in MCP server for external agents; rendered by `helm-validate.yaml` so the enabled path stays valid.
- `/chart/templates/`: Kubernetes manifests rendered by Helm (48 files). Includes deployments/statefulsets, services, configmaps (`configmap-*.yaml`), secrets (`secret-env.yaml`, `external-secret.yaml`), service accounts, PodDisruptionBudgets, HorizontalPodAutoscalers, NetworkPolicy, LimitRange, ServiceMonitor for Prometheus, and Helm tests. Shared template helpers live in `_helpers.tpl` (561 lines with 49+ helper functions). Postgres and Redis use StatefulSets with volumeClaimTemplates for stable storage and safe rollouts.
- `/chart/templates/NOTES.txt`: Helm installation notes displayed after deployment with important warnings and next steps.
- `/chart/.helmignore`: Excludes development and repository files from packaged charts to reduce size and prevent leaking unnecessary files.
- `/LICENSE`: Apache 2.0 license for this Helm chart repository.
Expand All @@ -24,14 +25,15 @@

## Production features
- **Security-first design**: Security contexts enabled by default (runAsNonRoot, drop ALL capabilities, seccomp RuntimeDefault profile).
- **Service accounts**: Dedicated service accounts for each component (app, engine, tables, analytics, nginx, postgres, redis) with configurable annotations for AWS IAM roles (IRSA), GCP Workload Identity, or Azure Managed Identity.
- **Service accounts**: Dedicated service accounts for each component (app, worker, mcp, tables, analytics, nginx, postgres, redis) with configurable annotations for AWS IAM roles (IRSA), GCP Workload Identity, or Azure Managed Identity.
- **External Secrets Operator**: Built-in support for AWS Secrets Manager, HashiCorp Vault, GCP Secret Manager, and Azure Key Vault integration.
- **PodDisruptionBudgets (PDBs)**: Configured for `app`, `engine`, `nginx`, `analytics` and `tables` — note that `tables` is stateful (PVC, ReadWriteOnce), while the Postgres and Redis StatefulSets have no PDB. All default to `maxUnavailable: 1` so voluntary disruptions (node drains, upgrades) can always proceed. Each component also accepts `minAvailable` when `maxUnavailable` is unset, but avoid it where a component runs a single replica: `minAvailable: 1` then evaluates to `disruptionsAllowed: 0` and blocks every drain. `analytics` and `tables` default to one replica.
- **HorizontalPodAutoscalers (HPAs)**: Optional autoscaling for app, engine, analytics, and nginx based on CPU/memory metrics.
- **PodDisruptionBudgets (PDBs)**: Configured for `app`, `worker`, `mcp`, `nginx`, `analytics` and `tables` — note that `tables` is stateful (PVC, ReadWriteOnce), while the Postgres and Redis StatefulSets have no PDB. All default to `maxUnavailable: 1` so voluntary disruptions (node drains, upgrades) can always proceed. Each component also accepts `minAvailable` when `maxUnavailable` is unset, but avoid it where a component runs a single replica: `minAvailable: 1` then evaluates to `disruptionsAllowed: 0` and blocks every drain. `analytics` and `tables` default to one replica.
- **HorizontalPodAutoscalers (HPAs)**: Optional autoscaling for app, worker, mcp, analytics, and nginx based on CPU/memory metrics.
- **NetworkPolicy**: Optional network segmentation to restrict pod-to-pod communication and enforce least-privilege networking with explicit allow rules.
- **LimitRange**: Optional namespace-level resource defaults and constraints to prevent resource exhaustion.
- **ServiceMonitor**: Prometheus Operator integration for scraping application metrics from `/metrics` endpoints.
- **Helm tests**: Post-installation connectivity tests to validate deployment health.
- **MCP server (opt-in)**: `mcp.enabled` deploys `openops-mcp` behind nginx at `/mcp` and derives the API's OAuth env from `global.publicUrl`. The MCP pod renders only `mcp.env`. `OPS_OAUTH_RS_CLIENT_SECRET` is deliberately not a default `openopsEnvSecrets` key: External Secrets fails the whole sync on a missing property, so the key, `mcp.env` secret collection, nginx routes and NetworkPolicy are all gated on `mcp.enabled`, and `openops.validateMcp` fails the render if the key is undeclared, too short, or `global.publicUrl` is not https.
- **Validation helpers**: Runtime validation of required secrets (OPS_ENCRYPTION_KEY, OPS_JWT_SECRET, etc.) with helpful error messages at render time.

## Release workflow
Expand Down
66 changes: 51 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenOps Helm Chart

This repository contains the Helm chart that deploys the OpenOps application stack (nginx, app server, engine, tables, analytics, Postgres, Redis) onto a Kubernetes cluster.
This repository contains the Helm chart that deploys the OpenOps application stack (nginx, app server, worker, tables, analytics, Postgres, Redis) onto a Kubernetes cluster.

## Repository layout
- `chart/Chart.yaml`: Chart metadata for the `openops` release.
Expand All @@ -9,15 +9,17 @@ This repository contains the Helm chart that deploys the OpenOps application sta
- `chart/values.ci.yaml`: Resource-constrained overlay for CI environments.
- `chart/values.dev.yaml`: Development overlay for local development environments.
- `chart/values.production.yaml`: Production overlay with externalized dependencies and cloud settings.
- `chart/templates/`: Kubernetes manifests templated by Helm (43 files including deployments, statefulsets, services, configmaps, secrets, external secrets, PVCs, ingress, service accounts, PodDisruptionBudgets, HorizontalPodAutoscalers, NetworkPolicy, LimitRange, ServiceMonitor, Helm tests, and helpers).
- `chart/values.mcp-example.yaml`: Overlay enabling the MCP server for external agents; rendered in CI.
- `chart/templates/`: Kubernetes manifests templated by Helm (48 files including deployments, statefulsets, services, configmaps, secrets, external secrets, PVCs, ingress, service accounts, PodDisruptionBudgets, HorizontalPodAutoscalers, NetworkPolicy, LimitRange, ServiceMonitor, Helm tests, and helpers).
Comment thread
ravikiranvm marked this conversation as resolved.
Resolved
- `chart/.helmignore`: Excludes development and repository files from packaged charts.
- `LICENSE`: Apache 2.0 license for this Helm chart.
- `docs/`: Deployment guides for AWS EKS, EKS Fargate, and other platforms.

## Components
- **nginx**: Reverse proxy and load balancer exposed via `LoadBalancer`.
- **openops-app**: Main application server.
- **openops-engine**: Task execution engine.
- **openops-worker**: Workflow execution worker.
- **openops-mcp** (opt-in): MCP server that lets external agents such as Claude Code or Codex operate OpenOps over OAuth.
- **openops-tables**: Data tables service (Baserow).
- **openops-analytics**: Analytics dashboard (Superset).
- **postgres**: PostgreSQL database.
Expand Down Expand Up @@ -111,12 +113,16 @@ The chart includes several example overlay files to help you get started:

**`values.production.yaml`** - Production-ready overlay
- Demonstrates externalized PostgreSQL and Redis (AWS RDS, ElastiCache, etc.)
- Increased replica counts for high availability (app: 3, engine: 3, nginx: 2)
- Increased replica counts for high availability (app: 3, worker: 3, nginx: 2)
- Production-grade resource allocations (2-4Gi memory per service)
- Cloud-specific storage classes (gp3, premium-rwo, managed-csi)
- LoadBalancer annotations for AWS/GCP/Azure
- Security hardening examples

**`values.mcp-example.yaml`** - MCP server enabled
- Shows the minimum to turn on the MCP server: `mcp.enabled`, an https `global.publicUrl`, and `OPS_OAUTH_RS_CLIENT_SECRET`
- Rendered by the validation workflow so the opt-in path stays green

### Creating custom overlays

**Staging environment example:**
Expand Down Expand Up @@ -312,6 +318,36 @@ kubectl create secret tls openops-tls \
-n openops
```

## MCP server for external agents

External agents such as Claude Code or Codex connect to OpenOps through the `openops-mcp` service, which is disabled by default. When enabled it sits behind nginx at `<publicUrl>/mcp` and authenticates agents with OAuth issued by the OpenOps API. The chart derives the API-side settings (`OPS_OAUTH_ENABLED`, `OPS_OAUTH_ISSUER_URL`, `OPS_MCP_RESOURCE_URL`) from `mcp.enabled` and `global.publicUrl`, so the two sides cannot drift.

Prerequisites:
- `global.publicUrl` must be `https://...` (plain `http` is only accepted for `localhost`), so enable TLS first.
- `OPS_OAUTH_RS_CLIENT_SECRET` must be declared under `openopsEnvSecrets` with a random value of at least 32 characters (`openssl rand -hex 32`). It is shared between the API and the MCP pod. When an external secret manager supplies the value, declare the key as `""`; with `externalSecrets.infraSecretName` set, the chart reads it from the infra secret (the Terraform-generated one on Azure), otherwise from the single remote secret. External Secrets fails the whole sync when a requested property is missing, which is why the chart does not declare this key by default.
- Pull access to the MCP image. Until the first public release the default `mcp.repository` is the private registry `openopsprivate.azurecr.io`; point `mcp.repository`/`mcp.tag` at an image your cluster can pull, or grant the cluster's node identity pull rights on that registry.

Minimal override:
```yaml
global:
publicUrl: "https://example.openops.com"

openopsEnvSecrets:
OPS_OAUTH_RS_CLIENT_SECRET: "<openssl rand -hex 32>"

mcp:
enabled: true
tag: "<release version or commit sha>"
```

The MCP pod is stateless and receives only its own environment (`mcp.env`), never the shared `openopsEnv`/`openopsEnvSecrets` layers. It has no health endpoint, so probes use the unauthenticated OAuth metadata route `/.well-known/oauth-protected-resource/mcp`. With `networkPolicy.enabled`, only nginx may reach it and it may only reach the app, DNS, and port 443.

Connect an agent:
```bash
claude mcp add --transport http openops https://example.openops.com/mcp
```
The first tool call opens a browser to approve the connection under Settings -> Connected apps.

## Dependencies
The deployments include health checks and readiness probes so dependent services wait until their prerequisites are available.

Expand Down Expand Up @@ -446,7 +482,7 @@ app:
memory: "4Gi"
cpu: "2000m"

engine:
worker:
replicas: 3

tables:
Expand All @@ -460,7 +496,7 @@ nginx:
```

**Important scaling considerations:**
- **app** and **engine** are stateless and can be scaled horizontally without restrictions.
- **app** and **worker** are stateless and can be scaled horizontally without restrictions.
- **tables** uses file-based storage (SQLite for media) and requires `ReadWriteOnce` PVC; limit to 2-3 replicas or migrate to object storage.
- **analytics** can be scaled but shares session state; consider sticky sessions or external session storage for >2 replicas.
- **postgres** and **redis** bundled deployments are single-replica; use external managed services for HA.
Expand All @@ -481,14 +517,14 @@ app:

**Resource tuning guidelines:**
- **app**: Memory-intensive for large workflows; start with 1-2Gi, scale to 4Gi+ under load.
- **engine**: CPU-intensive for code execution; allocate 500m-1000m CPU per replica.
- **worker**: CPU-intensive for code execution; allocate 500m-1000m CPU per replica.
- **tables**: Initial migrations require 1-2Gi memory; steady-state can run on 512Mi-1Gi.
- **analytics**: Dashboard rendering is memory-heavy; allocate 2Gi+ for production.
- **postgres**: Size based on dataset; 512Mi-1Gi for dev, 2Gi+ for production.
- **redis**: Typically light; 256Mi-512Mi sufficient for most workloads.

### Autoscaling
The chart includes optional HorizontalPodAutoscaler (HPA) resources for app, engine, analytics, and nginx. Enable them in your values:
The chart includes optional HorizontalPodAutoscaler (HPA) resources for app, worker, analytics, and nginx. Enable them in your values:

```yaml
hpa:
Expand All @@ -499,7 +535,7 @@ hpa:
maxReplicas: 10
targetCPUUtilizationPercentage: 70
targetMemoryUtilizationPercentage: 80
engine:
worker:
enabled: true
minReplicas: 2
maxReplicas: 8
Expand Down Expand Up @@ -649,7 +685,7 @@ networkPolicy:

The default policy enforces:
- Nginx accepts traffic from LoadBalancer/Ingress and routes to app/analytics/tables
- App, engine, and analytics can access Postgres and Redis
- App, worker, and analytics can access Postgres and Redis
- All components can query DNS and access external HTTPS endpoints
- Postgres and Redis only accept connections from authorized components
- All other traffic is denied by default (zero-trust networking)
Expand Down Expand Up @@ -723,10 +759,10 @@ serviceAccount:
create: true
annotations:
eks.amazonaws.com/role-arn: "arn:aws:iam::ACCOUNT:role/openops-app"
engine:
worker:
create: true
annotations:
eks.amazonaws.com/role-arn: "arn:aws:iam::ACCOUNT:role/openops-engine"
eks.amazonaws.com/role-arn: "arn:aws:iam::ACCOUNT:role/openops-worker"
# For GCP Workload Identity
analytics:
create: true
Expand Down Expand Up @@ -792,7 +828,7 @@ app:
memory: "2Gi"
cpu: "1000m"

engine:
worker:
replicas: 3

tables:
Expand All @@ -819,7 +855,7 @@ app:
podDisruptionBudget:
enabled: true
maxUnavailable: 1
engine:
worker:
podDisruptionBudget:
enabled: true
maxUnavailable: 1
Expand Down Expand Up @@ -877,7 +913,7 @@ serviceMonitor:

The ServiceMonitor automatically discovers and scrapes metrics from:
- `openops-app` on `/metrics`
- `openops-engine` on `/metrics`
- `openops-worker` on `/metrics`
- `openops-analytics` on `/metrics`
- `postgres` on `:9187/metrics` (if postgres-exporter sidecar is enabled)
- `redis` on `:9121/metrics` (if redis-exporter sidecar is enabled)
Expand Down
1 change: 1 addition & 0 deletions chart/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ values.*.yaml
!values.overrides-example.yaml
!values.ci.yaml
!values.production.yaml
!values.mcp-example.yaml
8 changes: 8 additions & 0 deletions chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ To get started:

Email: {{ .Values.openopsEnv.OPS_OPENOPS_ADMIN_EMAIL }}
Password: (from your secure values file)
{{- if .Values.mcp.enabled }}

4. Connect an external agent to the MCP server:

claude mcp add --transport http openops {{ include "openops.publicUrl" . }}/mcp

The first tool call opens a browser to approve the connection under Settings -> Connected apps.
{{- end }}

================================================================================
DOCUMENTATION & SUPPORT
Expand Down
30 changes: 29 additions & 1 deletion chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ Service URLs
{{- printf "http://%s:8088" .Values.analytics.name -}}
{{- end }}

{{- define "openops.mcpServiceUrl" -}}
{{- printf "http://%s:%v" .Values.mcp.name .Values.mcp.port -}}
{{- end }}

{{/*
Check if nginx ingress controller is being used
*/}}
Expand Down Expand Up @@ -265,7 +269,9 @@ Expected dict: { "root": $, "env": dict, "secretName": "my-secret" }
{{- $infraSecretName = $root.Values.externalSecrets.infraSecretName -}}
{{- $appSecretName = $root.Values.externalSecrets.appSecretName -}}
{{- end -}}
{{- $infraKeys := list "OPS_POSTGRES_PASSWORD" "OPS_REDIS_URL" "OPS_REDIS_HOST" "OPS_REDIS_PASSWORD" -}}
{{- /* Keys Terraform writes into the infra secret; everything else comes from the app secret.
OPS_OAUTH_RS_CLIENT_SECRET is generated per environment by infra (devops) for the MCP server. */ -}}
{{- $infraKeys := list "OPS_POSTGRES_PASSWORD" "OPS_REDIS_URL" "OPS_REDIS_HOST" "OPS_REDIS_PASSWORD" "OPS_OAUTH_RS_CLIENT_SECRET" -}}
{{- range $k := keys $env | sortAlpha -}}
{{- $v := index $env $k -}}
{{- if eq (include "openops.isSecretKey" (dict "root" $root "key" $k "value" ($v | toString))) "true" }}
Expand Down Expand Up @@ -413,6 +419,28 @@ Validate that required secrets are configured - ALWAYS ENFORCED
{{- fail "ERROR: ANALYTICS_POWERUSER_PASSWORD is required. Use a strong password" -}}
{{- end -}}
{{- end -}}
{{- include "openops.validateMcp" . -}}
{{- end }}

{{/*
Validate the MCP / OAuth configuration when the MCP server is enabled.
The key must be declared even when an external secret manager supplies the value, because the
ExternalSecret and the pods' secretKeyRefs are generated from the declared keys.
*/}}
{{- define "openops.validateMcp" -}}
{{- if .Values.mcp.enabled -}}
{{- if not (hasKey .Values.openopsEnvSecrets "OPS_OAUTH_RS_CLIENT_SECRET") -}}
{{- fail "ERROR: mcp.enabled requires openopsEnvSecrets.OPS_OAUTH_RS_CLIENT_SECRET to be declared (openssl rand -hex 32). Declare it as \"\" when the value comes from an external secret manager." -}}
{{- end -}}
{{- $usingExistingSecret := and .Values.secretEnv .Values.secretEnv.existingSecret (not .Values.secretEnv.create) -}}
{{- if and (not $usingExistingSecret) (lt (len .Values.openopsEnvSecrets.OPS_OAUTH_RS_CLIENT_SECRET) 32) -}}
{{- fail "ERROR: OPS_OAUTH_RS_CLIENT_SECRET must be at least 32 characters when mcp.enabled is true. Generate with: openssl rand -hex 32" -}}
{{- end -}}
{{- $url := include "openops.publicUrl" . -}}
{{- if and (not (hasPrefix "https://" $url)) (not (hasPrefix "http://localhost" $url)) -}}
{{- fail (printf "ERROR: mcp.enabled requires an https global.publicUrl (got %s). The MCP server refuses a plain-http OAuth issuer except on localhost." $url) -}}
{{- end -}}
{{- end -}}
{{- end }}

{{/*
Expand Down
Loading
Loading