A Helm chart for deploying the Climate REF (Rapid Evaluation Framework) on Kubernetes. This chart deploys a distributed task execution system using Celery workers for running climate diagnostics.
The chart deploys:
- Dragonfly (Redis-compatible): Message broker and result backend for Celery
- Flower: Web UI for monitoring Celery tasks
- Provider Workers: Celery workers for each diagnostic provider (orchestrator, esmvaltool, pmp, ilamb, example)
- Kubernetes 1.19+
- Helm 3.0+
- Access to container images:
ghcr.io/climate-ref/climate-refmher/flower
This chart uses coupled versioning: the chart version, appVersion, and default image tag are all kept in sync with the main application version.
# If published to a Helm repository helm repo add climate-ref <repository-url> helm repo update
# Install with default values helm install ref ./helm # Install with custom values helm install ref ./helm -f my-values.yaml # Install in a specific namespace helm install ref ./helm -n climate-ref --create-namespace
cd helm
helm dependency updateflowchart TB
ingress[Ingress<br/><i>optional</i>]
flower[Flower<br/><i>monitoring</i>]
dragonfly[Dragonfly<br/><i>Redis broker</i>]
subgraph workers[Provider Workers]
orchestrator[Orchestrator<br/>Worker]
esmvaltool[ESMValTool<br/>Worker]
pmp[PMP<br/>Worker]
ilamb[ILAMB<br/>Worker]
end
pvcs[(PVCs<br/><i>shared data storage</i>)]
ingress --> flower
flower --> dragonfly
dragonfly --> orchestrator
dragonfly --> esmvaltool
dragonfly --> pmp
dragonfly --> ilamb
orchestrator --> pvcs
esmvaltool --> pvcs
pmp --> pvcs
ilamb --> pvcs
Each provider worker listens to a specific Celery queue:
| Provider | Queue | Description |
|---|---|---|
| orchestrator | celery (default) |
Coordinates diagnostic execution |
| esmvaltool | esmvaltool |
ESMValTool diagnostics |
| pmp | pmp |
PCMDI Metrics Package diagnostics |
| ilamb | ilamb |
ILAMB diagnostics |
| example | example |
Example provider for testing |
| Parameter | Description | Default |
|---|---|---|
imagePullSecrets |
Docker registry secrets | [] |
nameOverride |
Override chart name | "" |
fullnameOverride |
Override full release name | "" |
| Parameter | Description | Default |
|---|---|---|
ingress.enabled |
Enable ingress | false |
ingress.host |
Ingress hostname | "" |
ingress.className |
Ingress class name | "" |
ingress.annotations |
Ingress annotations | {} |
ingress.labels |
Ingress labels | {} |
| Parameter | Description | Default |
|---|---|---|
dragonfly.enabled |
Enable Dragonfly deployment | true |
dragonfly.storage.enabled |
Enable persistent storage | true |
See Dragonfly Helm chart for all available options.
| Parameter | Description | Default |
|---|---|---|
flower.replicaCount |
Number of Flower replicas | 1 |
flower.image.repository |
Flower image repository | mher/flower |
flower.image.tag |
Flower image tag | 2.0.1 |
flower.image.pullPolicy |
Image pull policy | IfNotPresent |
flower.service.type |
Service type | ClusterIP |
flower.service.port |
Service port | 5555 |
flower.serviceMonitor.enabled |
Enable Prometheus ServiceMonitor | false |
flower.resources |
Resource requests/limits | {} |
flower.nodeSelector |
Node selector | {} |
flower.tolerations |
Tolerations | [] |
flower.affinity |
Affinity rules | {} |
These defaults apply to all providers unless overridden per-provider.
| Parameter | Description | Default |
|---|---|---|
defaults.replicaCount |
Number of worker replicas | 1 |
defaults.image.repository |
Worker image repository | ghcr.io/climate-ref/climate-ref |
defaults.image.tag |
Worker image tag | v0.20.5 |
defaults.image.pullPolicy |
Image pull policy | IfNotPresent |
defaults.resources |
Resource requests/limits | {} |
defaults.nodeSelector |
Node selector | {} |
defaults.tolerations |
Tolerations | [] |
defaults.affinity |
Affinity rules | {} |
defaults.volumes |
Additional volumes | [] |
defaults.volumeMounts |
Additional volume mounts | [] |
Each provider under providers.* can override any default setting:
providers: orchestrator: {} # Uses all defaults esmvaltool: replicaCount: 2 # Override replica count resources: requests: memory: "2Gi" cpu: "1" pmp: {} ilamb: {} example: {}
Environment variables can be set via defaults.env or per-provider:
| Variable | Description | Default |
|---|---|---|
CELERY_BROKER_URL |
Redis broker URL | Auto-configured to Dragonfly |
CELERY_RESULT_BACKEND |
Redis result backend URL | Auto-configured to Dragonfly |
REF_EXECUTOR |
Executor class | climate_ref_celery.executor.CeleryExecutor |
HOME |
Home directory (writable) | /tmp |
These settings control worker crash recovery and task time limits to ensure that the celery tasks
are durable and do not result in hanging consumers.
They have sensible defaults in celeryconf/base.py and can be overridden
via environment variables globally (in defaults.env) or per-provider.
If tasks are hanging or not resolving, then the celery configuration could be the issue. We need to be resiliant to workers failing.
| Variable | Description | Default |
|---|---|---|
CELERY_TASK_TIME_LIMIT |
Hard kill timeout in seconds | 21600 (6 hours) |
CELERY_TASK_SOFT_TIME_LIMIT |
Soft timeout (raises exception for cleanup) | 19800 (5.5 hours) |
CELERY_TASK_MAX_RETRIES |
Max retries before permanent failure | 2 |
CELERY_VISIBILITY_TIMEOUT |
Redis redelivery timeout (must be >= time limit) | Matches time limit |
CELERY_WORKER_PREFETCH_MULTIPLIER |
Tasks prefetched per worker process | 1 |
CELERY_WORKER_CONCURRENCY |
Worker processes per pod | CPU count |
CELERY_RESULT_EXPIRES |
Result expiry in seconds | 172800 (48 hours) |
CELERY_WORKER_MAX_TASKS_PER_CHILD |
Recycle worker after N tasks (memory leak guard) | 1 (fresh process per task) |
CELERY_WORKER_MAX_MEMORY_PER_CHILD |
Max resident memory per worker in KB | None (no limit) |
CELERY_SOCKET_TIMEOUT |
Blocking Redis socket timeout in seconds | None (transport default) |
CELERY_TASK_COMPRESSION |
Codec for task message bodies (empty to disable) | gzip |
CELERY_RESULT_COMPRESSION |
Codec for result bodies (empty to disable) | gzip |
CELERY_ACCEPT_CONTENT |
Comma separated content types the worker accepts | json,ref-json |
Tasks and results are encoded as JSON (ref-json).
What this release sends is fixed, so CELERY_ACCEPT_CONTENT only widens what a worker will decode.
Upgrading from a release that still used pickle drops whatever is already queued.
An old message carries a pickled diagnostic and provider that this release no longer defines,
so adding pickle back to CELERY_ACCEPT_CONTENT gets the body decoded and then the task fails anyway.
Purge the queues as part of the upgrade and re-solve, which requeues the outstanding work.
Upgrade the workers before any client that submits tasks,
because an old worker cannot decode ref-json messages.
The following settings are always enabled in base.py and cannot be overridden via
environment variables:
| Setting | Value | Purpose |
|---|---|---|
task_acks_late |
True |
ACK after execution so crashed tasks are redelivered |
task_reject_on_worker_lost |
True |
SIGKILL causes redelivery instead of silent loss |
task_track_started |
True |
Distinguish "not started" from "worker died" in Flower |
worker_cancel_long_running_tasks_on_connection_loss |
True |
Kill tasks on broker disconnect to prevent duplicate execution |
worker_send_task_events |
True |
Emit task events for Flower monitoring |
result_extended |
True |
Store extra metadata (task name, args, worker) with results |
result_backend_always_retry |
True |
Retry result storage on transient Redis errors |
Providers have different runtime characteristics. Override time limits per-provider to avoid unnecessarily long visibility windows on fast providers:
providers: esmvaltool: env: # ESMValTool diagnostics can run for hours CELERY_TASK_TIME_LIMIT: "21600" # 6 hours CELERY_TASK_SOFT_TIME_LIMIT: "19800" # 5.5 hours CELERY_VISIBILITY_TIMEOUT: "21600" ilamb: env: # ILAMB diagnostics are typically fast CELERY_TASK_TIME_LIMIT: "1800" # 30 minutes CELERY_TASK_SOFT_TIME_LIMIT: "1500" # 25 minutes CELERY_VISIBILITY_TIMEOUT: "1800" pmp: env: CELERY_TASK_TIME_LIMIT: "7200" # 2 hours CELERY_TASK_SOFT_TIME_LIMIT: "6600" # 1 hour 50 min CELERY_VISIBILITY_TIMEOUT: "7200"
Important: CELERY_VISIBILITY_TIMEOUT must always be >= CELERY_TASK_TIME_LIMIT.
If a task runs longer than the visibility timeout,
Redis will redeliver it to another worker, causing duplicate execution. See the celeryconf/base.py docstring for details.
Create PVCs using the createPVCs map:
createPVCs: data: 100Gi results: 50Gi
Mount them in providers:
defaults: volumes: - name: data persistentVolumeClaim: claimName: ref-data volumeMounts: - name: data mountPath: /data
Enable horizontal pod autoscaling per provider:
providers: esmvaltool: autoscaling: enabled: true minReplicas: 1 maxReplicas: 10 targetCPUUtilizationPercentage: 80
The HPA uses a custom metric (flower_task_prefetch_time_seconds) to scale based on queue depth.
The chart implements security best practices:
- Read-only root filesystem: All containers use read-only root filesystems
- Non-root user: All containers run as non-root
- Dropped capabilities: All Linux capabilities are dropped
- Service account tokens: Automounting disabled by default
- Pod security context:
fsGroup: 1000for shared file access
Check if workers output startup logs. If no logs appear, the container likely failed to start:
kubectl logs -l app.kubernetes.io/component=orchestrator kubectl describe pod -l app.kubernetes.io/component=orchestrator
Some libraries (intake-esgf, ilamb3) require a writable HOME directory. The chart sets HOME=/tmp by default. Ensure /tmp is writable:
defaults: volumes: - name: tmp emptyDir: {} volumeMounts: - name: tmp mountPath: /tmp
Verify Dragonfly is running:
kubectl get pods -l app.kubernetes.io/name=dragonfly kubectl logs -l app.kubernetes.io/name=dragonfly
Access Flower UI:
kubectl port-forward svc/ref-flower 5555:5555
Open http://localhost:5555 in your browser.
The chart creates the following Kubernetes resources:
| Resource | Count | Description |
|---|---|---|
| Deployment | 1 + N providers | Flower + one per provider |
| Service | 2 | Flower + Dragonfly |
| ServiceAccount | 1 + N providers | Flower + one per provider |
| Secret | 1 + N providers | Environment config per component |
| ServiceMonitor | 0-1 | Optional Prometheus integration |
| HorizontalPodAutoscaler | 0-N | Optional per-provider |
| PersistentVolumeClaim | N | As configured in createPVCs |
| Ingress | 0-1 | Optional |