Skip to content

Commit e30a97b

Browse files
committed
Added helm unit tests.
1 parent 9f537ab commit e30a97b

File tree

4 files changed

+106
-76
lines changed

4 files changed

+106
-76
lines changed

.github/workflows/cicd.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,19 @@ jobs:
5050
path: |
5151
htmlcov/
5252
coverage.xml
53+
54+
helm-test:
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Helm install
60+
uses: azure/setup-helm@v4
61+
with:
62+
version: latest
63+
- run: helm lint helm
64+
- name: Helm unit tests
65+
uses: d3adb5/helm-unittest-action@v2
66+
with:
67+
helm-version: latest
68+
charts: helm/

helm/README.md

Lines changed: 3 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,9 @@
11
# STAC Auth Proxy Helm Chart
22

3-
A Helm chart for deploying [STAC Auth Proxy](https://developmentseed.org/stac-auth-proxy) on Kubernetes.
3+
For documentation, see [Kubernetes Deployment](https://developmentseed.org/stac-auth-proxy/user-guide/kubernetes).
44

5-
## Overview
6-
7-
This chart deploys a reverse proxy that adds authentication and authorization capabilities to your STAC API using OpenID Connect (OIDC).
8-
9-
## Prerequisites
10-
11-
- Kubernetes 1.19+
12-
- Helm 3.0+
13-
- An OIDC provider (e.g., Keycloak, Auth0, Google, etc.)
14-
- A STAC API backend
15-
16-
## Installation
5+
## Local Installation
176

187
```bash
19-
helm install stac-auth-proxy ./stac-auth-proxy \
20-
--set env.UPSTREAM_URL=https://your-stac-api.example.com \
21-
--set env.OIDC_DISCOVERY_URL=https://your-oidc-provider.example.com/.well-known/openid-configuration \
22-
--set ingress.host=stac-proxy.example.com
23-
```
24-
25-
## Configuration
26-
27-
### Required Values
28-
29-
| Parameter | Description |
30-
|-----------|-------------|
31-
| `env.UPSTREAM_URL` | URL of the upstream STAC API |
32-
| `env.OIDC_DISCOVERY_URL` | OpenID Connect discovery URL |
33-
| `ingress.host` | Hostname for the ingress |
34-
35-
### Common Configurations
36-
37-
See [`values.yaml`](./values.yaml) for all available configuration options, including:
38-
39-
- **Authentication**: Configure OIDC settings and endpoint protection
40-
- **Resources**: Set CPU/memory limits and requests
41-
- **Ingress**: Configure TLS, annotations, and hostname
42-
- **Security**: Pod and container security contexts
43-
44-
### Example: Custom Values File
45-
46-
```yaml
47-
# custom-values.yaml
48-
image:
49-
tag: "v1.0.0"
50-
51-
ingress:
52-
host: "my-stac-api.example.com"
53-
54-
env:
55-
UPSTREAM_URL: "https://stac-api.internal:8080"
56-
OIDC_DISCOVERY_URL: "https://my-auth.example.com/.well-known/openid-configuration"
57-
DEFAULT_PUBLIC: false
8+
helm install stac-auth-proxy ./helm
589
```
59-
60-
Install with custom values:
61-
62-
```bash
63-
helm install stac-auth-proxy ./stac-auth-proxy -f custom-values.yaml
64-
```
65-
66-
## Upgrading
67-
68-
```bash
69-
helm upgrade stac-auth-proxy ./stac-auth-proxy -f custom-values.yaml
70-
```
71-
72-
## Uninstalling
73-
74-
```bash
75-
helm uninstall stac-auth-proxy
76-
```
77-
78-
## Documentation
79-
80-
For more information about STAC Auth Proxy features and configuration:
81-
- [Project Documentation](https://developmentseed.org/stac-auth-proxy)
82-
- [GitHub Repository](https://github.com/developmentseed/stac-auth-proxy)

helm/tests/deployment_test.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
suite: test deployment
2+
templates:
3+
- deployment.yaml
4+
tests:
5+
- it: should create deployment with correct name
6+
set:
7+
env.UPSTREAM_URL: "https://example.com"
8+
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
9+
asserts:
10+
- isKind:
11+
of: Deployment
12+
- matchRegex:
13+
path: metadata.name
14+
pattern: ^RELEASE-NAME-stac-auth-proxy$
15+
16+
- it: should set replica count
17+
set:
18+
replicaCount: 3
19+
env.UPSTREAM_URL: "https://example.com"
20+
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
21+
asserts:
22+
- equal:
23+
path: spec.replicas
24+
value: 3
25+
26+
- it: should set required environment variables
27+
set:
28+
env.UPSTREAM_URL: "https://stac-api.example.com"
29+
env.OIDC_DISCOVERY_URL: "https://auth.example.com/.well-known/openid-configuration"
30+
asserts:
31+
- contains:
32+
path: spec.template.spec.containers[0].env
33+
content:
34+
name: UPSTREAM_URL
35+
value: "https://stac-api.example.com"
36+
- contains:
37+
path: spec.template.spec.containers[0].env
38+
content:
39+
name: OIDC_DISCOVERY_URL
40+
value: "https://auth.example.com/.well-known/openid-configuration"
41+
42+
- it: should use correct image
43+
set:
44+
image.repository: "custom/repo"
45+
image.tag: "v1.2.3"
46+
env.UPSTREAM_URL: "https://example.com"
47+
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
48+
asserts:
49+
- equal:
50+
path: spec.template.spec.containers[0].image
51+
value: "custom/repo:v1.2.3"

helm/tests/service_test.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
suite: test service
2+
templates:
3+
- service.yaml
4+
tests:
5+
- it: should create service with correct name
6+
set:
7+
env.UPSTREAM_URL: "https://example.com"
8+
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
9+
asserts:
10+
- isKind:
11+
of: Service
12+
- matchRegex:
13+
path: metadata.name
14+
pattern: ^RELEASE-NAME-stac-auth-proxy$
15+
16+
- it: should use ClusterIP by default
17+
set:
18+
env.UPSTREAM_URL: "https://example.com"
19+
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
20+
asserts:
21+
- equal:
22+
path: spec.type
23+
value: ClusterIP
24+
25+
- it: should expose correct port
26+
set:
27+
service.port: 8000
28+
env.UPSTREAM_URL: "https://example.com"
29+
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
30+
asserts:
31+
- equal:
32+
path: spec.ports[0].port
33+
value: 8000
34+
- equal:
35+
path: spec.ports[0].targetPort
36+
value: http

0 commit comments

Comments
 (0)