|
| 1 | +# Kubernetes Deployment |
| 2 | + |
| 3 | +Deploy STAC Auth Proxy to Kubernetes using the Helm chart. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Kubernetes 1.19+ |
| 8 | +- Helm 3.2.0+ |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +```bash |
| 13 | +helm registry login ghcr.io |
| 14 | + |
| 15 | +helm install stac-auth-proxy oci://ghcr.io/developmentseed/stac-auth-proxy/charts/stac-auth-proxy \ |
| 16 | + --set env.UPSTREAM_URL=https://your-stac-api.com/stac \ |
| 17 | + --set env.OIDC_DISCOVERY_URL=https://your-auth-server/.well-known/openid-configuration \ |
| 18 | + --set ingress.host=stac-proxy.your-domain.com |
| 19 | +``` |
| 20 | + |
| 21 | +## Configuration |
| 22 | + |
| 23 | +| Parameter | Description | Required | |
| 24 | +| ------------------------ | ------------------------------------- | -------- | |
| 25 | +| `env.UPSTREAM_URL` | URL of the STAC API to proxy | Yes | |
| 26 | +| `env.OIDC_DISCOVERY_URL` | OpenID Connect discovery document URL | Yes | |
| 27 | +| `ingress.host` | Hostname for the ingress | No | |
| 28 | + |
| 29 | +See [`values.yaml`](https://github.com/developmentseed/stac-auth-proxy/blob/main/helm/values.yaml) for all available options. |
| 30 | + |
| 31 | +## Authorization |
| 32 | + |
| 33 | +The chart provides two levels of authorization: |
| 34 | + |
| 35 | +1. **[Route-level authorization](route-level-auth.md)**: Controls which API endpoints are accessible and by whom |
| 36 | +2. **[Record-level authorization](record-level-auth.md)**: Filters collections and items based on user permissions |
| 37 | + |
| 38 | +### Route-Level Authorization |
| 39 | + |
| 40 | +Configure via `authorization.route` section in `values.yaml`. |
| 41 | + |
| 42 | +#### Mode: `default` (Recommended) |
| 43 | + |
| 44 | +Public catalog with protected write operations. This is the most common configuration. |
| 45 | + |
| 46 | +```yaml |
| 47 | +authorization: |
| 48 | + route: |
| 49 | + mode: "default" |
| 50 | +``` |
| 51 | +
|
| 52 | +This automatically sets `DEFAULT_PUBLIC=true`, making all read endpoints public while requiring authentication for write operations. |
| 53 | + |
| 54 | +#### Mode: `custom` |
| 55 | + |
| 56 | +Define specific public and private endpoints with custom rules. |
| 57 | + |
| 58 | +```yaml |
| 59 | +authorization: |
| 60 | + route: |
| 61 | + mode: "custom" |
| 62 | + publicEndpoints: |
| 63 | + "^/collections$": ["GET"] |
| 64 | + "^/search$": ["GET", "POST"] |
| 65 | + "^/api.html$": ["GET"] |
| 66 | + "^/healthz": ["GET"] |
| 67 | + privateEndpoints: |
| 68 | + "^/collections$": [["POST", "collection:create"]] |
| 69 | + "^/collections/([^/]+)$": [["PUT", "collection:update"], ["DELETE", "collection:delete"]] |
| 70 | + "^/collections/([^/]+)/items$": [["POST", "item:create"]] |
| 71 | +``` |
| 72 | + |
| 73 | +**Endpoint format:** |
| 74 | +- `publicEndpoints`: Maps regex paths to HTTP methods arrays |
| 75 | +- `privateEndpoints`: Maps regex paths to HTTP methods or `[method, scope]` tuples |
| 76 | + - Scopes define required OAuth2 scopes for the operation |
| 77 | + |
| 78 | +#### Mode: `disabled` |
| 79 | + |
| 80 | +No route-level authorization applied. |
| 81 | + |
| 82 | +```yaml |
| 83 | +authorization: |
| 84 | + route: |
| 85 | + mode: "disabled" |
| 86 | +``` |
| 87 | + |
| 88 | +### Record-Level Authorization |
| 89 | + |
| 90 | +Configure via `authorization.record` section in `values.yaml`. |
| 91 | + |
| 92 | +#### Mode: `disabled` (Default) |
| 93 | + |
| 94 | +No record-level filtering applied. All collections and items are visible to authenticated users. |
| 95 | + |
| 96 | +```yaml |
| 97 | +authorization: |
| 98 | + record: |
| 99 | + mode: "disabled" |
| 100 | +``` |
| 101 | + |
| 102 | +#### Mode: `custom` |
| 103 | + |
| 104 | +Use Python filter classes to control visibility of collections and items. |
| 105 | + |
| 106 | +```yaml |
| 107 | +authorization: |
| 108 | + record: |
| 109 | + mode: "custom" |
| 110 | + custom: |
| 111 | + filtersFile: "data/custom_filters.py" |
| 112 | +``` |
| 113 | + |
| 114 | +This automatically: |
| 115 | +- Creates a ConfigMap from your Python file |
| 116 | +- Mounts it at `/app/src/stac_auth_proxy/custom_filters.py` |
| 117 | +- Sets `COLLECTIONS_FILTER_CLS=stac_auth_proxy.custom_filters:CollectionsFilter` |
| 118 | +- Sets `ITEMS_FILTER_CLS=stac_auth_proxy.custom_filters:ItemsFilter` |
| 119 | + |
| 120 | +Review the stac-auth-proxy [documentation for more information on custom filters](record-level-auth.md#custom-filter-factories). |
| 121 | + |
| 122 | +#### Mode: `opa` |
| 123 | + |
| 124 | +Use Open Policy Agent for policy-based filtering. |
| 125 | + |
| 126 | +```yaml |
| 127 | +authorization: |
| 128 | + record: |
| 129 | + mode: "opa" |
| 130 | + opa: |
| 131 | + url: "http://opa-service:8181" |
| 132 | + policy: "stac/items/allow" |
| 133 | +``` |
| 134 | + |
| 135 | +This sets: |
| 136 | +- `ITEMS_FILTER_CLS=stac_auth_proxy.filters.opa:Opa` |
| 137 | +- `ITEMS_FILTER_ARGS='["http://opa-service:8181", "stac/items/allow"]'` |
| 138 | + |
| 139 | +### Configuration Examples |
| 140 | + |
| 141 | +#### Example 1: Default for public catalog, protected writes |
| 142 | + |
| 143 | +```yaml |
| 144 | +authorization: |
| 145 | + route: |
| 146 | + mode: "default" |
| 147 | + record: |
| 148 | + mode: "disabled" |
| 149 | +``` |
| 150 | + |
| 151 | +#### Example 2: Fully protected catalog |
| 152 | + |
| 153 | +```yaml |
| 154 | +authorization: |
| 155 | + route: |
| 156 | + mode: "custom" |
| 157 | + publicEndpoints: |
| 158 | + "^/healthz": ["GET"] |
| 159 | + privateEndpoints: |
| 160 | + "^/collections$": [["GET", "stac:read"], ["POST", "stac:write"]] |
| 161 | + "^/search$": [["GET", "stac:read"], ["POST", "stac:read"]] |
| 162 | + record: |
| 163 | + mode: "custom" |
| 164 | + custom: |
| 165 | + filtersFile: "data/custom_filters.py" |
| 166 | +``` |
| 167 | + |
| 168 | +### Direct Configuration |
| 169 | + |
| 170 | +Existing charts using `env` variables directly continue to work: |
| 171 | + |
| 172 | +```yaml |
| 173 | +env: |
| 174 | + DEFAULT_PUBLIC: "false" |
| 175 | + PUBLIC_ENDPOINTS: '{"^/search$": ["GET"]}' |
| 176 | + PRIVATE_ENDPOINTS: '{"^/collections$": [["POST", "collection:create"]]}' |
| 177 | + ITEMS_FILTER_CLS: "custom.module:Filter" |
| 178 | +``` |
| 179 | + |
| 180 | +**Environment variables specified in `env` take precedence over `authorization` settings.** |
| 181 | + |
| 182 | +## Management |
| 183 | + |
| 184 | +```bash |
| 185 | +# Upgrade |
| 186 | +helm upgrade stac-auth-proxy oci://ghcr.io/developmentseed/stac-auth-proxy/charts/stac-auth-proxy |
| 187 | +
|
| 188 | +# Uninstall |
| 189 | +helm uninstall stac-auth-proxy |
| 190 | +``` |
| 191 | + |
0 commit comments