Skip to content

Commit 33887cc

Browse files
committed
Extended kubernetes auth documentation.
1 parent d37cee3 commit 33887cc

File tree

3 files changed

+193
-44
lines changed

3 files changed

+193
-44
lines changed

docs/user-guide/deployment.md

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -61,47 +61,4 @@ docker pull ghcr.io/developmentseed/stac-auth-proxy:v0.7.1
6161
6262
## Kubernetes
6363
64-
The STAC Auth Proxy can be deployed to Kubernetes via the [Helm Chart available on the GitHub Container Registry (GHCR)](https://github.com/developmentseed/stac-auth-proxy/pkgs/container/stac-auth-proxy%2Fcharts%2Fstac-auth-proxy).
65-
66-
### Prerequisites
67-
68-
- Kubernetes 1.19+
69-
- Helm 3.2.0+
70-
71-
### Installation
72-
73-
```bash
74-
# Add the Helm repository
75-
helm registry login ghcr.io
76-
77-
# Install with minimal configuration
78-
helm install stac-auth-proxy oci://ghcr.io/developmentseed/stac-auth-proxy/charts/stac-auth-proxy \
79-
--set env.UPSTREAM_URL=https://your-stac-api.com/stac \
80-
--set env.OIDC_DISCOVERY_URL=https://your-auth-server/.well-known/openid-configuration \
81-
--set ingress.host=stac-proxy.your-domain.com
82-
```
83-
84-
### Configuration
85-
86-
| Parameter | Description | Required | Default |
87-
| ------------------------ | --------------------------------------------- | -------- | ------- |
88-
| `env.UPSTREAM_URL` | URL of the STAC API to proxy | Yes | - |
89-
| `env.OIDC_DISCOVERY_URL` | OpenID Connect discovery document URL | Yes | - |
90-
| `env` | Environment variables passed to the container | No | `{}` |
91-
| `ingress.enabled` | Enable ingress | No | `true` |
92-
| `ingress.className` | Ingress class name | No | `nginx` |
93-
| `ingress.host` | Hostname for the ingress | No | `""` |
94-
| `ingress.tls.enabled` | Enable TLS for ingress | No | `true` |
95-
| `replicaCount` | Number of replicas | No | `1` |
96-
97-
For a complete list of values, see the [values.yaml](https://github.com/developmentseed/stac-auth-proxy/blob/main/helm/values.yaml) file.
98-
99-
### Management
100-
101-
```bash
102-
# Upgrade
103-
helm upgrade stac-auth-proxy oci://ghcr.io/developmentseed/stac-auth-proxy/charts/stac-auth-proxy
104-
105-
# Uninstall
106-
helm uninstall stac-auth-proxy
107-
```
64+
See [Kubernetes deployment](kubernetes.md) for detailed instructions on deploying to Kubernetes using Helm.

docs/user-guide/kubernetes.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
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+

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ nav:
3535
- Route-Level Auth: user-guide/route-level-auth.md
3636
- Record-Level Auth: user-guide/record-level-auth.md
3737
- Deployment: user-guide/deployment.md
38+
- Kubernetes: user-guide/kubernetes.md
3839
- Tips: user-guide/tips.md
3940
- Architecture:
4041
- Middleware Stack: architecture/middleware-stack.md

0 commit comments

Comments
 (0)