Skip to content

Commit a7cb36c

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 a7cb36c

File tree

16 files changed

+1355
-970
lines changed

16 files changed

+1355
-970
lines changed

.github/workflows/ci.yml

Lines changed: 113 additions & 5 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:
@@ -21,9 +21,6 @@ jobs:
2121
with:
2222
node-version: '24'
2323

24-
- name: Install ajv-cli
25-
run: npm install -g ajv-cli ajv-formats
26-
2724
- name: Install Helm
2825
uses: azure/setup-helm@v4
2926
with:
@@ -32,8 +29,119 @@ jobs:
3229
- name: Setup Helm dependencies
3330
run: ./scripts/deploy.sh setup
3431

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