Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,19 @@ jobs:
path: |
htmlcov/
coverage.xml
helm-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Helm install
uses: azure/setup-helm@v4
with:
version: latest
- run: helm lint helm
- name: Helm unit tests
uses: d3adb5/helm-unittest-action@v2
with:
helm-version: latest
charts: helm/
9 changes: 9 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# STAC Auth Proxy Helm Chart

For documentation, see [Kubernetes Deployment](https://developmentseed.org/stac-auth-proxy/user-guide/kubernetes).

## Local Installation

```bash
helm install stac-auth-proxy ./helm
```
51 changes: 51 additions & 0 deletions helm/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
suite: test deployment
templates:
- deployment.yaml
tests:
- it: should create deployment with correct name
set:
env.UPSTREAM_URL: "https://example.com"
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
asserts:
- isKind:
of: Deployment
- matchRegex:
path: metadata.name
pattern: ^RELEASE-NAME-stac-auth-proxy$

- it: should set replica count
set:
replicaCount: 3
env.UPSTREAM_URL: "https://example.com"
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
asserts:
- equal:
path: spec.replicas
value: 3

- it: should set required environment variables
set:
env.UPSTREAM_URL: "https://stac-api.example.com"
env.OIDC_DISCOVERY_URL: "https://auth.example.com/.well-known/openid-configuration"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: UPSTREAM_URL
value: "https://stac-api.example.com"
- contains:
path: spec.template.spec.containers[0].env
content:
name: OIDC_DISCOVERY_URL
value: "https://auth.example.com/.well-known/openid-configuration"

- it: should use correct image
set:
image.repository: "custom/repo"
image.tag: "v1.2.3"
env.UPSTREAM_URL: "https://example.com"
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: "custom/repo:v1.2.3"
36 changes: 36 additions & 0 deletions helm/tests/service_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
suite: test service
templates:
- service.yaml
tests:
- it: should create service with correct name
set:
env.UPSTREAM_URL: "https://example.com"
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
asserts:
- isKind:
of: Service
- matchRegex:
path: metadata.name
pattern: ^RELEASE-NAME-stac-auth-proxy$

- it: should use ClusterIP by default
set:
env.UPSTREAM_URL: "https://example.com"
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
asserts:
- equal:
path: spec.type
value: ClusterIP

- it: should expose correct port
set:
service.port: 8000
env.UPSTREAM_URL: "https://example.com"
env.OIDC_DISCOVERY_URL: "https://example.com/.well-known/openid-configuration"
asserts:
- equal:
path: spec.ports[0].port
value: 8000
- equal:
path: spec.ports[0].targetPort
value: http
Loading