|  | 
| 1 | 1 | # Workflows | 
| 2 | 2 | 
 | 
| 3 |  | -Argo Workflows configuration using Kustomize for environment management. | 
|  | 3 | +Event-driven Argo Workflows for Sentinel-2 GeoZarr conversion and STAC registration. | 
| 4 | 4 | 
 | 
| 5 |  | -## Purpose | 
|  | 5 | +**Architecture**: RabbitMQ messages → Sensor → WorkflowTemplate (convert → register) → S3 + STAC API | 
| 6 | 6 | 
 | 
| 7 |  | -Event-driven pipeline orchestration for Sentinel-2 GeoZarr conversion and STAC registration. RabbitMQ messages trigger workflows that run a 2-step DAG: **convert → register**. | 
|  | 7 | +--- | 
| 8 | 8 | 
 | 
| 9 |  | -## Structure | 
|  | 9 | +## Quick Setup | 
|  | 10 | + | 
|  | 11 | +### 1. Configure kubectl | 
|  | 12 | + | 
|  | 13 | +Download kubeconfig from [OVH Manager → Kubernetes](https://www.ovh.com/manager/#/public-cloud/pci/projects/bcc5927763514f499be7dff5af781d57/kubernetes/f5f25708-bd15-45b9-864e-602a769a5fcf/service) (**Access and Security** tab). | 
| 10 | 14 | 
 | 
|  | 15 | +```bash | 
|  | 16 | +mv ~/Downloads/kubeconfig-*.yml .work/kubeconfig | 
|  | 17 | +export KUBECONFIG=$(pwd)/.work/kubeconfig | 
|  | 18 | +kubectl get nodes  # Verify: should list 3-5 nodes | 
| 11 | 19 | ``` | 
| 12 |  | -workflows/ | 
| 13 |  | -├── base/                           # Core resources (namespace-agnostic) | 
| 14 |  | -│   ├── kustomization.yaml          # References all resources | 
| 15 |  | -│   ├── workflowtemplate.yaml       # 2-step pipeline DAG | 
| 16 |  | -│   ├── sensor.yaml                 # RabbitMQ → Workflow trigger | 
| 17 |  | -│   ├── eventsource.yaml            # RabbitMQ connection config | 
| 18 |  | -│   └── rbac.yaml                   # ServiceAccount + permissions | 
| 19 |  | -└── overlays/ | 
| 20 |  | -    ├── staging/ | 
| 21 |  | -    │   └── kustomization.yaml      # devseed-staging namespace patches | 
| 22 |  | -    └── production/ | 
| 23 |  | -        └── kustomization.yaml      # devseed namespace patches | 
|  | 20 | + | 
|  | 21 | +### 2. Create Required Secrets | 
|  | 22 | + | 
|  | 23 | +The pipeline needs 3 secrets for: **event ingestion** (RabbitMQ), **output storage** (S3), and **STAC registration** (API auth). | 
|  | 24 | + | 
|  | 25 | +**RabbitMQ credentials** (receives workflow trigger events): | 
|  | 26 | +```bash | 
|  | 27 | +# Get password from cluster-managed secret | 
|  | 28 | +RABBITMQ_PASS=$(kubectl get secret rabbitmq-password -n core -o jsonpath='{.data.rabbitmq-password}' | base64 -d) | 
|  | 29 | + | 
|  | 30 | +kubectl create secret generic rabbitmq-credentials -n devseed-staging \ | 
|  | 31 | +  --from-literal=username=user \ | 
|  | 32 | +  --from-literal=password="$RABBITMQ_PASS" | 
| 24 | 33 | ``` | 
| 25 | 34 | 
 | 
| 26 |  | -## Apply to Cluster | 
|  | 35 | +**S3 credentials** (writes converted GeoZarr files): | 
|  | 36 | +```bash | 
|  | 37 | +# Get from OVH Manager → Users & Roles → OpenStack credentials | 
|  | 38 | +# https://www.ovh.com/manager/\#/public-cloud/pci/projects/bcc5927763514f499be7dff5af781d57/users | 
|  | 39 | + | 
|  | 40 | +kubectl create secret generic geozarr-s3-credentials -n devseed-staging \ | 
|  | 41 | +  --from-literal=AWS_ACCESS_KEY_ID=<your-ovh-access-key> \ | 
|  | 42 | +  --from-literal=AWS_SECRET_ACCESS_KEY=<your-ovh-secret-key> | 
|  | 43 | +``` | 
| 27 | 44 | 
 | 
| 28 |  | -**Staging (devseed-staging):** | 
|  | 45 | +**STAC API token** (registers items, optional if API is public): | 
| 29 | 46 | ```bash | 
| 30 |  | -kubectl apply -k workflows/overlays/staging | 
|  | 47 | +kubectl create secret generic stac-api-token -n devseed-staging \ | 
|  | 48 | +  --from-literal=token=<bearer-token> | 
| 31 | 49 | ``` | 
| 32 | 50 | 
 | 
| 33 |  | -**Production (devseed):** | 
|  | 51 | +### 3. Deploy Workflows | 
|  | 52 | + | 
| 34 | 53 | ```bash | 
| 35 |  | -kubectl apply -k workflows/overlays/production | 
|  | 54 | +kubectl apply -k workflows/overlays/staging     # Staging (devseed-staging) | 
|  | 55 | +kubectl apply -k workflows/overlays/production  # Production (devseed) | 
| 36 | 56 | ``` | 
| 37 | 57 | 
 | 
| 38 | 58 | **Verify deployment:** | 
| 39 | 59 | ```bash | 
| 40 |  | -# Check resources (expected output shows 1 of each) | 
| 41 | 60 | kubectl get workflowtemplate,sensor,eventsource,sa -n devseed-staging | 
|  | 61 | +# Expected: 1 WorkflowTemplate, 1 Sensor, 1 EventSource, 1 ServiceAccount | 
|  | 62 | +``` | 
|  | 63 | + | 
|  | 64 | +--- | 
|  | 65 | + | 
|  | 66 | +## Structure | 
|  | 67 | + | 
|  | 68 | +``` | 
|  | 69 | +workflows/ | 
|  | 70 | +├── base/                      # Core resources (namespace-agnostic) | 
|  | 71 | +│   ├── workflowtemplate.yaml  # 2-step DAG: convert → register | 
|  | 72 | +│   ├── sensor.yaml            # RabbitMQ trigger | 
|  | 73 | +│   ├── eventsource.yaml       # RabbitMQ connection | 
|  | 74 | +│   ├── rbac.yaml              # Permissions | 
|  | 75 | +│   └── kustomization.yaml | 
|  | 76 | +└── overlays/ | 
|  | 77 | +    ├── staging/               # devseed-staging namespace | 
|  | 78 | +    └── production/            # devseed namespace | 
|  | 79 | +``` | 
| 42 | 80 | 
 | 
| 43 |  | -# Example output: | 
| 44 |  | -# NAME                                                AGE | 
| 45 |  | -# workflowtemplate.argoproj.io/geozarr-pipeline      5m | 
| 46 |  | -# | 
| 47 |  | -# NAME                                    AGE | 
| 48 |  | -# sensor.argoproj.io/geozarr-sensor      5m | 
| 49 |  | -# | 
| 50 |  | -# NAME                                          AGE | 
| 51 |  | -# eventsource.argoproj.io/rabbitmq-geozarr     5m | 
| 52 |  | -# | 
| 53 |  | -# NAME                                SECRETS   AGE | 
| 54 |  | -# serviceaccount/operate-workflow-sa   0         5m | 
| 55 |  | - | 
| 56 |  | -# Watch for workflows (should show Running/Succeeded/Failed) | 
|  | 81 | +--- | 
|  | 82 | + | 
|  | 83 | +## Monitoring | 
|  | 84 | + | 
|  | 85 | +**Watch workflows:** | 
|  | 86 | +```bash | 
| 57 | 87 | kubectl get wf -n devseed-staging --watch | 
| 58 | 88 | ``` | 
| 59 |  | -Example outputs: | 
|  | 89 | + | 
|  | 90 | +**Example output:** | 
| 60 | 91 | ``` | 
| 61 | 92 | NAME            STATUS      AGE | 
| 62 | 93 | geozarr-79jmg   Running     5m | 
| 63 | 94 | geozarr-95rgx   Succeeded   9h | 
| 64 |  | -geozarr-hpcvf   Succeeded   10h | 
| 65 | 95 | geozarr-jflnj   Failed      10h | 
| 66 | 96 | ``` | 
| 67 | 97 | 
 | 
| 68 |  | -## Required Secrets | 
| 69 |  | - | 
| 70 |  | -The pipeline requires these Kubernetes secrets in the target namespace: | 
| 71 |  | - | 
| 72 |  | -### 1. `rabbitmq-credentials` | 
| 73 |  | -RabbitMQ authentication for EventSource: | 
|  | 98 | +--- | 
| 74 | 99 | 
 | 
| 75 |  | -```bash | 
| 76 |  | -kubectl create secret generic rabbitmq-credentials \ | 
| 77 |  | -  --from-literal=username=<rabbitmq-user> \ | 
| 78 |  | -  --from-literal=password=<rabbitmq-password> \ | 
| 79 |  | -  -n devseed-staging | 
| 80 |  | -``` | 
|  | 100 | +## Configuration | 
| 81 | 101 | 
 | 
| 82 |  | -### 2. `geozarr-s3-credentials` | 
| 83 |  | -S3 credentials for GeoZarr output: | 
|  | 102 | +### S3 Storage | 
| 84 | 103 | 
 | 
| 85 |  | -```bash | 
| 86 |  | -kubectl create secret generic geozarr-s3-credentials \ | 
| 87 |  | -  --from-literal=AWS_ACCESS_KEY_ID=<access-key> \ | 
| 88 |  | -  --from-literal=AWS_SECRET_ACCESS_KEY=<secret-key> \ | 
| 89 |  | -  -n devseed-staging | 
| 90 |  | -``` | 
|  | 104 | +- **Endpoint**: `https://s3.de.io.cloud.ovh.net` (OVH Frankfurt) | 
|  | 105 | +- **Bucket**: `esa-zarr-sentinel-explorer-fra` | 
|  | 106 | +- **Paths**: `tests-output/` (staging), `geozarr/` (production) | 
| 91 | 107 | 
 | 
| 92 |  | -### 3. `stac-api-token` (optional) | 
| 93 |  | -Bearer token for STAC API authentication (if required): | 
|  | 108 | +### Workflow Parameters | 
| 94 | 109 | 
 | 
| 95 |  | -```bash | 
| 96 |  | -kubectl create secret generic stac-api-token \ | 
| 97 |  | -  --from-literal=token=<bearer-token> \ | 
| 98 |  | -  -n devseed-staging | 
| 99 |  | -``` | 
|  | 110 | +Key parameters (see [../README.md](../README.md) for full reference): | 
| 100 | 111 | 
 | 
| 101 |  | -## WorkflowTemplate Parameters | 
|  | 112 | +- `source_url`: STAC item URL or Zarr URL | 
|  | 113 | +- `register_collection`: Target STAC collection (default: `sentinel-2-l2a-dp-test`) | 
|  | 114 | +- `s3_output_bucket`: Output bucket | 
|  | 115 | +- `pipeline_image_version`: Docker image tag | 
| 102 | 116 | 
 | 
| 103 |  | -See main [README.md](../README.md) for complete parameter reference. | 
|  | 117 | +### Resource Tuning | 
| 104 | 118 | 
 | 
| 105 |  | -| Parameter | Default | Description | | 
| 106 |  | -|-----------|---------|-------------| | 
| 107 |  | -| `source_url` | - | STAC item URL or direct Zarr URL | | 
| 108 |  | -| `register_collection` | sentinel-2-l2a-dp-test | STAC collection ID | | 
| 109 |  | -| `stac_api_url` | https://api... | STAC API endpoint | | 
| 110 |  | -| `raster_api_url` | https://api... | TiTiler endpoint | | 
| 111 |  | -| `s3_output_bucket` | esa-zarr... | S3 output bucket | | 
| 112 |  | -| `pipeline_image_version` | fix-unit-tests | Docker image tag | | 
| 113 |  | - | 
| 114 |  | -## Resource Configuration | 
| 115 |  | - | 
| 116 |  | -To adjust CPU/memory limits, edit `workflows/base/workflowtemplate.yaml`: | 
|  | 119 | +Edit `workflows/base/workflowtemplate.yaml`: | 
| 117 | 120 | 
 | 
| 118 | 121 | ```yaml | 
| 119 |  | -- name: convert-geozarr | 
| 120 |  | -  resources: | 
| 121 |  | -    requests: | 
| 122 |  | -      memory: 4Gi    # Increase for larger datasets | 
| 123 |  | -      cpu: '1' | 
| 124 |  | -    limits: | 
| 125 |  | -      memory: 8Gi | 
| 126 |  | -      cpu: '2' | 
|  | 122 | +resources: | 
|  | 123 | +  requests: { memory: 4Gi, cpu: '1' } | 
|  | 124 | +  limits:   { memory: 8Gi, cpu: '2' }  # Increase for larger datasets | 
| 127 | 125 | ``` | 
| 128 | 126 | 
 | 
|  | 127 | +--- | 
|  | 128 | +
 | 
| 129 | 129 | ## Troubleshooting | 
| 130 | 130 | 
 | 
| 131 |  | -**Kustomize build fails:** | 
|  | 131 | +**Workflow not triggered:** | 
| 132 | 132 | ```bash | 
| 133 |  | -# Validate structure | 
| 134 |  | -kubectl kustomize workflows/overlays/staging | 
|  | 133 | +kubectl logs -n devseed-staging -l eventsource-name=rabbitmq  # Check RabbitMQ connection | 
|  | 134 | +kubectl get sensor -n devseed-staging geozarr-trigger -o yaml  # Check sensor status | 
|  | 135 | +``` | 
| 135 | 136 | 
 | 
| 136 |  | -# Check for duplicate resources | 
| 137 |  | -find workflows -name "*.yaml" -not -path "*/base/*" -not -path "*/overlays/*" | 
|  | 137 | +**Workflow fails:** | 
|  | 138 | +```bash | 
|  | 139 | +kubectl logs -n devseed-staging <workflow-pod-name>  # View logs | 
|  | 140 | +kubectl get secret -n devseed-staging                 # Verify secrets exist | 
| 138 | 141 | ``` | 
| 139 | 142 | 
 | 
| 140 |  | -**Workflow not triggered:** | 
| 141 |  | -- Check EventSource connection: `kubectl logs -n devseed-staging -l eventsource-name=rabbitmq` | 
| 142 |  | -- Check Sensor status: `kubectl get sensor -n devseed-staging geozarr-trigger -o yaml` | 
| 143 |  | -- Verify RabbitMQ port-forward or service access | 
|  | 143 | +**Kustomize validation:** | 
|  | 144 | +```bash | 
|  | 145 | +kubectl kustomize workflows/overlays/staging  # Validate YAML | 
|  | 146 | +``` | 
| 144 | 147 | 
 | 
| 145 |  | -**Workflow fails:** | 
| 146 |  | -- Check pod logs: `kubectl logs -n devseed-staging <workflow-pod-name>` | 
| 147 |  | -- Verify secrets exist: `kubectl get secret -n devseed-staging geozarr-s3-credentials stac-api-token` | 
| 148 |  | -- Check RBAC: `kubectl auth can-i create workflows --as=system:serviceaccount:devseed-staging:operate-workflow-sa` | 
|  | 148 | +--- | 
| 149 | 149 | 
 | 
| 150 |  | -For full pipeline documentation, see [../README.md](../README.md). | 
|  | 150 | +For complete documentation, see [../README.md](../README.md). | 
0 commit comments