Skip to content

Commit 15837c0

Browse files
committed
feat: add Knative integration for notifications
- Add CloudEvents sink deployment for eoapi-notifier integration - Configure dynamic secret name for PostgreSQL connection - Add local development configuration with reduced resources - Support both CI and local test environments
1 parent 6e471e4 commit 15837c0

File tree

16 files changed

+1349
-967
lines changed

16 files changed

+1349
-967
lines changed

.github/workflows/ci.yml

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: CI tests
22

33
on:
44
push:
@@ -11,7 +11,7 @@ env:
1111
PGO_VERSION: 5.7.4
1212

1313
jobs:
14-
validate:
14+
lint:
1515
name: Lint checks
1616
runs-on: ubuntu-latest
1717
steps:
@@ -37,3 +37,108 @@ jobs:
3737

3838
- name: Validate Helm values schema
3939
run: make validate-schema
40+
41+
helm-unit-tests:
42+
name: Helm Unit Tests
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v5
46+
47+
- name: Install Helm
48+
uses: azure/setup-helm@v4
49+
with:
50+
version: ${{ env.HELM_VERSION }}
51+
52+
- name: Run Helm unit tests
53+
run: make tests
54+
55+
- name: Run lint checks
56+
run: make lint
57+
58+
- name: Validate Helm schemas
59+
run: make validate-schema
60+
61+
integration-tests:
62+
name: Integration Tests (K3s)
63+
if: github.event.pull_request.head.repo.full_name == github.repository
64+
permissions:
65+
contents: 'read'
66+
id-token: 'write'
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v5
70+
71+
- name: Wait for Helm tests to pass
72+
uses: lewagon/[email protected]
73+
if: github.event_name == 'pull_request'
74+
with:
75+
ref: ${{ github.event.pull_request.head.sha }}
76+
check-name: 'Helm Unit Tests'
77+
repo-token: ${{ secrets.GITHUB_TOKEN }}
78+
wait-interval: 30
79+
80+
- name: Start K3s cluster
81+
uses: jupyterhub/action-k3s-helm@v4
82+
with:
83+
k3s-channel: latest
84+
helm-version: ${{ env.HELM_VERSION }}
85+
metrics-enabled: false
86+
docker-enabled: true
87+
88+
- name: Set release name
89+
run: echo "RELEASE_NAME=eoapi-$(echo "${{ github.sha }}" | cut -c1-8)" >> "$GITHUB_ENV"
90+
91+
- name: Wait for K3s readiness
92+
run: |
93+
echo "=== Waiting for K3s cluster to be ready ==="
94+
95+
# The action already sets up kubectl context, just verify it works
96+
kubectl cluster-info
97+
kubectl get nodes
98+
99+
# Wait for core components
100+
kubectl wait --for=condition=Ready pod -l k8s-app=kube-dns -n kube-system --timeout=300s
101+
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=traefik -n kube-system --timeout=300s
102+
103+
# Verify Traefik CRDs
104+
timeout=300; counter=0
105+
for crd in "middlewares.traefik.io" "ingressroutes.traefik.io"; do
106+
while [ $counter -lt $timeout ] && ! kubectl get crd "$crd" &>/dev/null; do
107+
sleep 3; counter=$((counter + 3))
108+
done
109+
[ $counter -ge $timeout ] && { echo "❌ Timeout waiting for $crd"; exit 1; }
110+
done
111+
112+
echo "✅ K3s cluster ready"
113+
114+
- name: Deploy eoAPI
115+
id: deploy
116+
run: |
117+
echo "=== eoAPI Deployment ==="
118+
export RELEASE_NAME="${RELEASE_NAME}"
119+
export PGO_VERSION="${{ env.PGO_VERSION }}"
120+
export CI_MODE=true
121+
122+
# Deploy using consolidated script with CI mode
123+
./scripts/deploy.sh --ci
124+
125+
- name: Validate deployment
126+
run: |
127+
echo "=== Post-deployment validation ==="
128+
./scripts/test.sh check-deployment
129+
130+
- name: Run integration tests
131+
run: |
132+
export RELEASE_NAME="$RELEASE_NAME"
133+
./scripts/test.sh integration --debug
134+
135+
- name: Debug failed deployment
136+
if: failure()
137+
run: |
138+
./scripts/debug-deployment.sh
139+
140+
- name: Cleanup
141+
if: always()
142+
run: |
143+
helm uninstall "$RELEASE_NAME" -n eoapi || true
144+
kubectl delete namespace eoapi || true

.github/workflows/helm-tests.yml

Lines changed: 0 additions & 155 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Added local testing with k3s and minikube
1212
- Base local development values file (`local-base-values.yaml`)
1313
- Unified local cluster management with `CLUSTER_TYPE` variable
14+
- Added knative in CI to test eoapi-notifier.
1415

1516
## [0.7.12] - 2025-10-17
1617

charts/eoapi/Chart.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@ dependencies:
5757
version: 0.0.8
5858
repository: "oci://ghcr.io/developmentseed/charts"
5959
condition: eoapi-notifier.enabled
60+
- name: knative-operator
61+
version: 1.17.8
62+
repository: https://knative.github.io/operator
63+
condition: knative.enabled

charts/eoapi/local-k3s-values.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,65 @@ ingress:
77
className: "traefik"
88
annotations:
99
traefik.ingress.kubernetes.io/router.entrypoints: web
10+
11+
# Knative components for CloudEvents
12+
knative:
13+
enabled: true
14+
cloudEventsSink:
15+
enabled: true
16+
17+
# eoapi-notifier configuration with CloudEvents output
18+
eoapi-notifier:
19+
enabled: true
20+
waitForKnativeCRDs: true
21+
config:
22+
logLevel: DEBUG
23+
sources:
24+
- type: pgstac
25+
config:
26+
channel: pgstac_items_change
27+
connection:
28+
existingSecret:
29+
name: "" # Set dynamically by deploy script
30+
keys:
31+
username: "user"
32+
password: "password"
33+
host: "host"
34+
port: "port"
35+
database: "dbname"
36+
outputs:
37+
- type: cloudevents
38+
config:
39+
source: /eoapi/pgstac
40+
event_type: org.eoapi.stac.item
41+
destination:
42+
ref:
43+
apiVersion: serving.knative.dev/v1
44+
kind: Service
45+
name: eoapi-cloudevents-sink
46+
resources:
47+
requests:
48+
cpu: "50m"
49+
memory: "64Mi"
50+
limits:
51+
cpu: "200m"
52+
memory: "128Mi"
53+
54+
# Reduce PostgreSQL resources for local development
55+
postgrescluster:
56+
instances:
57+
- name: "postgres"
58+
replicas: 1
59+
dataVolumeClaimSpec:
60+
accessModes:
61+
- "ReadWriteOnce"
62+
resources:
63+
requests:
64+
storage: "1Gi"
65+
resources:
66+
requests:
67+
cpu: "100m"
68+
memory: "512Mi"
69+
limits:
70+
cpu: "500m"
71+
memory: "1Gi"

0 commit comments

Comments
 (0)