|
| 1 | +# STAC Auth Proxy Integration with EOAPI-K8S |
| 2 | + |
| 3 | +## Solution Overview |
| 4 | + |
| 5 | +We have implemented support for STAC Auth Proxy integration with EOAPI-K8S through service-specific ingress control. This feature allows the STAC service to be accessible only internally while other services remain externally available. |
| 6 | + |
| 7 | +## Implementation Details |
| 8 | + |
| 9 | +### 1. Service-Specific Ingress Control |
| 10 | + |
| 11 | +Each service can now independently control its ingress settings via the values.yaml configuration: |
| 12 | + |
| 13 | +```yaml |
| 14 | +stac: |
| 15 | + enabled: true |
| 16 | + ingress: |
| 17 | + enabled: false # Disable external ingress for STAC only |
| 18 | + |
| 19 | +# Other services remain externally accessible |
| 20 | +raster: |
| 21 | + enabled: true |
| 22 | + ingress: |
| 23 | + enabled: true |
| 24 | +``` |
| 25 | +
|
| 26 | +### 2. Template Changes |
| 27 | +
|
| 28 | +The ingress template now checks service-specific settings: |
| 29 | +
|
| 30 | +```yaml |
| 31 | +{{- if and .Values.stac.enabled (or (not (hasKey .Values.stac "ingress")) .Values.stac.ingress.enabled) }} |
| 32 | +- pathType: {{ .Values.ingress.pathType }} |
| 33 | + path: /stac{{ .Values.ingress.pathSuffix }} |
| 34 | + backend: |
| 35 | + service: |
| 36 | + name: stac |
| 37 | + port: |
| 38 | + number: {{ .Values.service.port }} |
| 39 | +{{- end }} |
| 40 | +``` |
| 41 | + |
| 42 | +This ensures: |
| 43 | +- Service paths are only included if the service and its ingress are enabled |
| 44 | +- Backward compatibility is maintained (ingress enabled by default) |
| 45 | +- Clean separation of service configurations |
| 46 | + |
| 47 | +## Deployment Guide |
| 48 | + |
| 49 | +### 1. Configure EOAPI-K8S |
| 50 | + |
| 51 | +```yaml |
| 52 | +# values.yaml for eoapi-k8s |
| 53 | +stac: |
| 54 | + enabled: true |
| 55 | + ingress: |
| 56 | + enabled: false # No external ingress for STAC |
| 57 | + |
| 58 | +# Other services remain externally accessible |
| 59 | +raster: |
| 60 | + enabled: true |
| 61 | +vector: |
| 62 | + enabled: true |
| 63 | +multidim: |
| 64 | + enabled: true |
| 65 | +``` |
| 66 | +
|
| 67 | +### 2. Deploy STAC Auth Proxy |
| 68 | +
|
| 69 | +Deploy the stac-auth-proxy Helm chart in the same namespace: |
| 70 | +
|
| 71 | +```yaml |
| 72 | +# values.yaml for stac-auth-proxy |
| 73 | +backend: |
| 74 | + service: stac # Internal K8s service name |
| 75 | + port: 8080 # Service port |
| 76 | + |
| 77 | +auth: |
| 78 | + # Configure authentication settings |
| 79 | + provider: oauth2 |
| 80 | + # ... other auth settings |
| 81 | +``` |
| 82 | + |
| 83 | +### 3. Network Flow |
| 84 | + |
| 85 | +```mermaid |
| 86 | +graph LR |
| 87 | + A[External Request] --> B[STAC Auth Proxy] |
| 88 | + B -->|Authentication| C[Internal STAC Service] |
| 89 | + D[External Request] -->|Direct Access| E[Raster/Vector/Other Services] |
| 90 | +``` |
| 91 | + |
| 92 | +## Testing |
| 93 | + |
| 94 | +Verify the configuration: |
| 95 | + |
| 96 | +```bash |
| 97 | +# Check that STAC paths are excluded |
| 98 | +helm template eoapi --set stac.ingress.enabled=false,stac.enabled=true -f values.yaml |
| 99 | + |
| 100 | +# Verify other services remain accessible |
| 101 | +kubectl get ingress |
| 102 | +kubectl get services |
| 103 | +``` |
| 104 | + |
| 105 | +Expected behavior: |
| 106 | +- STAC service accessible only within the cluster |
| 107 | +- Other services (raster, vector, etc.) accessible via their ingress paths |
| 108 | +- Auth proxy successfully routing authenticated requests to STAC |
| 109 | + |
| 110 | +## Troubleshooting |
| 111 | + |
| 112 | +1. **STAC Service Not Accessible Internally** |
| 113 | + - Verify service is running: `kubectl get services` |
| 114 | + - Check service port matches auth proxy configuration |
| 115 | + - Verify network policies allow proxy-to-STAC communication |
| 116 | + |
| 117 | +2. **Other Services Affected** |
| 118 | + - Confirm ingress configuration for other services |
| 119 | + - Check ingress controller logs |
| 120 | + - Verify service-specific settings in values.yaml |
| 121 | + |
| 122 | +## Additional Notes |
| 123 | + |
| 124 | +- The solution leverages Kubernetes service discovery for internal communication |
| 125 | +- No changes required to the STAC service itself |
| 126 | +- Zero downtime deployment possible |
| 127 | +- Existing deployments without auth proxy remain compatible |
0 commit comments