|
| 1 | +# ☸️ Poly Cloud API Helm Chart |
| 2 | + |
| 3 | +Production-ready Kubernetes Helm Chart for **Poly Cloud API** — high-throughput, pluggable remote cache server and ROI analytics engine for Poly and Turborepo. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## ⚡ Features |
| 8 | + |
| 9 | +- **Horizontal Pod Autoscaling (HPA)**: Auto-scales across CPU and Memory utilization targets. |
| 10 | +- **Ingress & TLS**: Seamless Ingress configuration with automatic cert-manager Let's Encrypt certificates and large-body streaming support (`2048m`). |
| 11 | +- **Prometheus ServiceMonitor**: Turnkey integration with Prometheus Operator for `/api/v1/metrics`. |
| 12 | +- **Pluggable Object Storage**: Complete ConfigMaps & Secrets for **AWS S3**, **Cloudflare R2**, and **MinIO**. |
| 13 | +- **Non-Root Security Hardened**: Runs unprivileged with `runAsNonRoot: true`, read-only root filesystems, and dropped Linux capabilities. |
| 14 | +- **High-Availability Resilience**: PodAntiAffinity and RollingUpdate zero-downtime deployment strategy. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## 🚀 Quickstart |
| 19 | + |
| 20 | +### 1. Add Repository & Install Chart |
| 21 | + |
| 22 | +```bash |
| 23 | +# Add repo or clone |
| 24 | +git clone https://github.com/RitualDev-Lab/poly-cloud-api.git |
| 25 | +cd poly-cloud-api |
| 26 | + |
| 27 | +# Install chart into 'poly-cache' namespace |
| 28 | +helm install poly-cache ./charts/poly-cloud-api \ |
| 29 | + --namespace poly-cache \ |
| 30 | + --create-namespace \ |
| 31 | + --values ./charts/poly-cloud-api/values.yaml |
| 32 | +``` |
| 33 | + |
| 34 | +### 2. Retrieve Admin Token |
| 35 | + |
| 36 | +```bash |
| 37 | +kubectl get secret --namespace poly-cache poly-cache-poly-cloud-api-secrets \ |
| 38 | + -o jsonpath="{.data.DEFAULT_ADMIN_TOKEN}" | base64 --decode |
| 39 | +``` |
| 40 | + |
| 41 | +### 3. Connect Poly CLI |
| 42 | + |
| 43 | +```bash |
| 44 | +poly login --url https://cache.example.com --token <ADMIN_TOKEN> --workspace default |
| 45 | +poly cache status |
| 46 | +``` |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## 🛠️ Storage Backend Configurations |
| 51 | + |
| 52 | +### Option A: AWS S3 with EKS IAM Roles for Service Accounts (IRSA) |
| 53 | + |
| 54 | +```yaml |
| 55 | +# values-aws.yaml |
| 56 | +serviceAccount: |
| 57 | + create: true |
| 58 | + annotations: |
| 59 | + eks.amazonaws.com/role-arn: "arn:aws:iam::123456789012:role/PolyCloudCacheRole" |
| 60 | + |
| 61 | +config: |
| 62 | + storageBackend: "s3" |
| 63 | + s3: |
| 64 | + bucket: "my-company-poly-cache" |
| 65 | + region: "us-east-1" |
| 66 | +``` |
| 67 | +
|
| 68 | +### Option B: Cloudflare R2 |
| 69 | +
|
| 70 | +```yaml |
| 71 | +# values-r2.yaml |
| 72 | +config: |
| 73 | + storageBackend: "s3" |
| 74 | + s3: |
| 75 | + bucket: "poly-cache-bucket" |
| 76 | + region: "auto" |
| 77 | + endpoint: "https://<account_id>.r2.cloudflarestorage.com" |
| 78 | + accessKeyId: "CLOUDFLARE_R2_ACCESS_KEY_ID" |
| 79 | + secretAccessKey: "CLOUDFLARE_R2_SECRET_ACCESS_KEY" |
| 80 | +``` |
| 81 | +
|
| 82 | +### Option C: MinIO (On-Premises or Kubernetes-Native) |
| 83 | +
|
| 84 | +```yaml |
| 85 | +# values-minio.yaml |
| 86 | +config: |
| 87 | + storageBackend: "s3" |
| 88 | + s3: |
| 89 | + bucket: "poly-artifacts" |
| 90 | + region: "us-east-1" |
| 91 | + endpoint: "http://minio.minio.svc.cluster.local:9000" |
| 92 | + forcePathStyle: true |
| 93 | + accessKeyId: "minioadmin" |
| 94 | + secretAccessKey: "minioadmin" |
| 95 | +``` |
| 96 | +
|
| 97 | +### Option D: Local Disk Storage with PersistentVolumeClaim (PVC) |
| 98 | +
|
| 99 | +```yaml |
| 100 | +# values-local.yaml |
| 101 | +config: |
| 102 | + storageBackend: "local" |
| 103 | + |
| 104 | +persistence: |
| 105 | + enabled: true |
| 106 | + storageClass: "gp3" # or local-path, ebs-sc |
| 107 | + size: 100Gi |
| 108 | + mountPath: /app/data |
| 109 | +``` |
| 110 | +
|
| 111 | +--- |
| 112 | +
|
| 113 | +## ⚙️ Parameters Reference |
| 114 | +
|
| 115 | +| Parameter | Default | Description | |
| 116 | +|:---|:---|:---| |
| 117 | +| `replicaCount` | `2` | Number of pod replicas for High Availability | |
| 118 | +| `image.repository` | `ghcr.io/ritualdev-lab/poly-cloud-api` | Container image repository | |
| 119 | +| `image.tag` | `""` (Chart appVersion) | Container image tag | |
| 120 | +| `service.type` | `ClusterIP` | Kubernetes Service type | |
| 121 | +| `service.port` | `8080` | Internal HTTP service port | |
| 122 | +| `ingress.enabled` | `true` | Enable Kubernetes Ingress controller | |
| 123 | +| `ingress.className` | `"nginx"` | Ingress class name | |
| 124 | +| `ingress.hosts` | `[cache.example.com]` | Ingress routing hostnames | |
| 125 | +| `ingress.tls` | `[poly-cloud-tls]` | TLS certificate secrets | |
| 126 | +| `autoscaling.enabled` | `true` | Enable Horizontal Pod Autoscaler (HPA v2) | |
| 127 | +| `autoscaling.minReplicas` | `2` | Minimum pod replicas | |
| 128 | +| `autoscaling.maxReplicas` | `10` | Maximum pod replicas | |
| 129 | +| `autoscaling.targetCPUUtilizationPercentage` | `75` | Target CPU utilization percentage | |
| 130 | +| `serviceMonitor.enabled` | `true` | Enable Prometheus Operator ServiceMonitor | |
| 131 | +| `serviceMonitor.interval` | `15s` | Prometheus scrape interval | |
| 132 | +| `config.storageBackend` | `"s3"` | Storage backend (`s3`, `local`, `memory`) | |
| 133 | +| `config.s3.bucket` | `"poly-remote-cache"` | S3 / R2 Bucket name | |
| 134 | +| `config.s3.region` | `"us-east-1"` | S3 region | |
| 135 | +| `config.s3.endpoint` | `""` | S3 endpoint URL (for R2 / MinIO) | |
| 136 | +| `config.presignedUrls.enabled` | `true` | Enable direct-to-storage presigned S3/R2 URLs | |
| 137 | +| `config.oidc.enabled` | `true` | Enable GitHub Actions OIDC zero-secret auth | |
| 138 | +| `config.optimizer.autoEvictionEnabled` | `true` | Enable LRU auto-eviction daemon | |
| 139 | +| `config.optimizer.deduplicationEnabled` | `true` | Enable cross-branch CAS layer deduplication | |
| 140 | +| `persistence.enabled` | `false` | Enable PersistentVolumeClaim (for local disk backend) | |
| 141 | +| `persistence.size` | `50Gi` | Size of persistent volume | |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## 📜 License |
| 146 | + |
| 147 | +Licensed under the [Apache License, Version 2.0](https://github.com/RitualDev-Lab/poly-cloud-api/blob/main/LICENSE). |
0 commit comments