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
210 changes: 137 additions & 73 deletions .github/workflows/helm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
- name: Run Helm unit tests
run: make tests

integration:
name: Integration Tests (K3s)
k3s-integration-tests:
name: K3s Integration Tests
if: github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: 'read'
Expand All @@ -47,106 +47,170 @@ jobs:
- name: Set release name
run: echo "RELEASE_NAME=eoapi-$(echo "${{ github.sha }}" | cut -c1-8)" >> "$GITHUB_ENV"

- name: Deploy eoAPI
id: deploy
continue-on-error: true
- name: Wait for K3s to be fully ready
run: |
echo "=== Starting eoAPI deployment ==="
export RELEASE_NAME="$RELEASE_NAME"
export PGO_VERSION="${{ env.PGO_VERSION }}"
export GITHUB_SHA="${{ github.sha }}"
./scripts/deploy.sh --ci
echo "=== Waiting for K3s to be fully ready ==="

- name: Check deployment status
id: check
if: steps.deploy.outcome == 'success'
run: |
echo "=== Checking deployment status ==="
export RELEASE_NAME="$RELEASE_NAME"
./scripts/test.sh check-deployment --debug
# Wait for core K3s components to be ready
echo "Waiting for kube-system pods to be ready..."
kubectl wait --for=condition=Ready pod -l k8s-app=kube-dns -n kube-system --timeout=300s
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=traefik -n kube-system --timeout=300s

- name: Debug pgstac jobs if deployment failed
if: steps.deploy.outcome == 'failure'
continue-on-error: true
run: |
echo "=== Debugging pgstac job failures ==="

# Check pgstac-migrate job
echo "===== pgstac-migrate Job Status ====="
kubectl get jobs -l app.kubernetes.io/name=pgstac-migrate -o wide || echo "No pgstac-migrate jobs found"

MIGRATE_PODS=$(kubectl get pods -l app.kubernetes.io/name=pgstac-migrate -o jsonpath='{.items[*].metadata.name}' 2>/dev/null)
if [ -n "$MIGRATE_PODS" ]; then
for POD in $MIGRATE_PODS; do
echo "--- Logs from migrate pod $POD ---"
kubectl logs "$POD" --tail=100 || true
echo "--- Description of migrate pod $POD ---"
kubectl describe pod "$POD"
done
fi

# Check pgstac-load-samples job
echo "===== pgstac-load-samples Job Status ====="
kubectl get jobs -l app.kubernetes.io/name=pgstac-load-samples -o wide || echo "No pgstac-load-samples jobs found"

SAMPLES_PODS=$(kubectl get pods -l app.kubernetes.io/name=pgstac-load-samples -o jsonpath='{.items[*].metadata.name}' 2>/dev/null)
if [ -n "$SAMPLES_PODS" ]; then
for POD in $SAMPLES_PODS; do
echo "--- Logs from samples pod $POD ---"
kubectl logs "$POD" --tail=100 || true
echo "--- Description of samples pod $POD ---"
kubectl describe pod "$POD"
done
fi
# Wait for API server to be fully responsive
echo "Checking API server responsiveness..."
kubectl get nodes
kubectl get pods --all-namespaces

# Check database status
echo "===== Database Pod Status ====="
kubectl get pods -l postgres-operator.crunchydata.com/cluster -o wide
kubectl get postgrescluster -o wide
# Give K3s a moment to initialize all CRDs
echo "Waiting for K3s initialization to complete..."
sleep 10

# Check ConfigMaps
echo "===== Relevant ConfigMaps ====="
kubectl get configmaps | grep -E "initdb|pgstac" || echo "No relevant configmaps found"
echo "✅ K3s is ready"

# Check for any related events
echo "===== Related Kubernetes Events ====="
kubectl get events | grep -E "pgstac|initdb" || echo "No relevant events found"
- name: Install Knative Serving
run: |
echo "=== Installing Knative Serving ==="
# Install Knative Serving CRDs
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.17.0/serving-crds.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we maybe want to parameterise the knative version?

# Install Knative Serving core components
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.17.0/serving-core.yaml
# Install Kourier networking layer for Knative
kubectl apply -f https://github.com/knative/net-kourier/releases/download/knative-v1.17.0/kourier.yaml
# Configure Knative to use Kourier
kubectl patch configmap/config-network \
--namespace knative-serving \
--type merge \
--patch '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}'
# Wait for Knative Serving to be ready
echo "Waiting for Knative Serving to be ready..."
kubectl wait --for=condition=Ready pod -l app=controller -n knative-serving --timeout=300s
kubectl wait --for=condition=Ready pod -l app=webhook -n knative-serving --timeout=300s
kubectl wait --for=condition=Ready pod -l app=3scale-kourier-gateway -n kourier-system --timeout=300s

- name: Install Knative Eventing
run: |
echo "=== Installing Knative Eventing ==="
# Install Knative Eventing CRDs (includes SinkBinding)
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.17.0/eventing-crds.yaml
# Install Knative Eventing core components
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.17.0/eventing-core.yaml
# Wait for Knative Eventing to be ready
echo "Waiting for Knative Eventing to be ready..."
kubectl wait --for=condition=Ready pod -l app=eventing-controller -n knative-eventing --timeout=300s
kubectl wait --for=condition=Ready pod -l app=eventing-webhook -n knative-eventing --timeout=300s

- name: Deploy CloudEvents sink for eoapi-notifier
run: |
echo "=== Deploying CloudEvents sink ==="
# Create the namespace first
kubectl create namespace eoapi || true
# Deploy the CloudEvents sink service
kubectl apply -f charts/eoapi/samples/cloudevents-sink.yaml
# Wait for the Knative service to be ready
echo "Waiting for CloudEvents sink to be ready..."
kubectl wait --for=condition=Ready ksvc/eoapi-cloudevents-sink -n eoapi --timeout=300s

- name: Wait for Traefik to be ready
run: |
echo "=== Waiting for Traefik to be ready ==="

# Wait for Traefik pods to be ready first
echo "Waiting for Traefik controller to be ready..."
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=traefik -n kube-system --timeout=300s

# Wait for essential Traefik CRDs to be available
echo "Checking for Traefik CRDs..."
timeout=300
counter=0
required_crds=("middlewares.traefik.io" "ingressroutes.traefik.io")

for crd in "${required_crds[@]}"; do
echo "Checking for CRD: $crd"
counter=0
while [ $counter -lt $timeout ]; do
if kubectl get crd "$crd" &>/dev/null; then
echo "✅ $crd is available"
break
fi
echo "⏳ Waiting for $crd... ($counter/$timeout)"
sleep 3
counter=$((counter + 3))
done

# Check notification system status
echo "===== Notification System Status ====="
kubectl get deployments -l app.kubernetes.io/name=eoapi-notifier -o wide || echo "No eoapi-notifier deployment found"
kubectl get ksvc -l app.kubernetes.io/component=cloudevents-sink -o wide || echo "No Knative CloudEvents sink found"
if [ $counter -ge $timeout ]; then
echo "❌ Timeout waiting for $crd"
echo "Available Traefik CRDs:"
kubectl get crd | grep traefik || echo "No Traefik CRDs found"
echo "All CRDs:"
kubectl get crd
exit 1
fi
done

exit 1
echo "✅ All required Traefik CRDs are ready"

- name: Deploy eoAPI
id: deploy
run: |
echo "=== Starting eoAPI deployment ==="
export RELEASE_NAME="$RELEASE_NAME"
export PGO_VERSION="${{ env.PGO_VERSION }}"
export GITHUB_SHA="${{ github.sha }}"
./scripts/deploy.sh --ci

- name: Run integration tests
if: steps.deploy.outcome == 'success'
run: |
echo "=== Running integration tests ==="
export RELEASE_NAME="$RELEASE_NAME"
./scripts/test.sh integration --debug

- name: Debug deployment status
if: always()
- name: Debug failed deployment
if: failure()
run: |
echo "=== Final Deployment Status ==="
echo "=== Deployment failed - collecting debug information ==="
kubectl get pods -o wide
kubectl get jobs -o wide
kubectl get services -o wide
kubectl get ingress
kubectl get events --sort-by='.lastTimestamp' | tail -20 || true

# Check Knative installation status
echo "=== Knative Installation Status ==="
kubectl get pods -n knative-serving -o wide || echo "Knative Serving not installed"
kubectl get pods -n knative-eventing -o wide || echo "Knative Eventing not installed"
kubectl get pods -n kourier-system -o wide || echo "Kourier not installed"
# Check Knative CRDs
echo "=== Knative CRDs Status ==="
kubectl get crd | grep knative || echo "No Knative CRDs found"
kubectl get crd sinkbindings.sources.knative.dev || echo "SinkBinding CRD not found"

# Check Traefik status
echo "=== Traefik Status ==="
kubectl get pods -n kube-system -l app.kubernetes.io/name=traefik -o wide || echo "No Traefik pods found"
kubectl get crd | grep traefik || echo "No Traefik CRDs found"
kubectl get crd middlewares.traefik.io || echo "Middleware CRD not found"
kubectl get crd ingressroutes.traefik.io || echo "IngressRoute CRD not found"

# Check notification system final status
echo "=== Notification System Final Status ==="
kubectl get deployments -l app.kubernetes.io/name=eoapi-notifier -o wide || echo "No eoapi-notifier deployment"
kubectl get pods -l app.kubernetes.io/name=eoapi-notifier -o wide || echo "No eoapi-notifier pods"
kubectl get ksvc -l app.kubernetes.io/component=cloudevents-sink -o wide || echo "No Knative CloudEvents sink"
kubectl get pods -l serving.knative.dev/service -o wide || echo "No Knative CloudEvents sink pods"
kubectl get ksvc -n eoapi -o wide || echo "No Knative services in eoapi namespace"
kubectl get ksvc eoapi-cloudevents-sink -n eoapi -o wide || echo "No eoapi-cloudevents-sink Knative service"
kubectl get pods -l serving.knative.dev/service=eoapi-cloudevents-sink -n eoapi -o wide || echo "No CloudEvents sink pods"
# Check SinkBinding resources
echo "=== SinkBinding Resources ==="
kubectl get sinkbindings -A -o wide || echo "No SinkBinding resources found"

# Show notification logs if they exist
echo "=== eoapi-notifier Logs ==="
kubectl logs -l app.kubernetes.io/name=eoapi-notifier --tail=20 || echo "No eoapi-notifier logs"
echo "=== Knative CloudEvents Sink Logs ==="
kubectl logs -l serving.knative.dev/service --tail=20 || echo "No Knative CloudEvents sink logs"
kubectl logs -l serving.knative.dev/service=eoapi-cloudevents-sink -n eoapi --tail=20 || echo "No CloudEvents sink logs"
# Show Knative system logs if there are issues
echo "=== Knative Serving Controller Logs ==="
kubectl logs -n knative-serving -l app=controller --tail=20 || echo "No Knative Serving controller logs"
echo "=== Knative Eventing Controller Logs ==="
kubectl logs -n knative-eventing -l app=eventing-controller --tail=20 || echo "No Knative Eventing controller logs"


- name: Cleanup
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ charts/config.yaml
charts/eoapi/charts/*.tgz
config_ingress.yaml
__pycache__

CLAUDE.md
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Added knative in CI to test eoapi-notifier.

## [0.7.12] - 2025-10-17

- Bumped eoapi-notifier dependency version to 0.0.7
Expand Down
2 changes: 1 addition & 1 deletion charts/eoapi/test-k3s-unittest-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ eoapi-notifier:
channel: pgstac_items_change
connection:
existingSecret:
name: "eoapi-test-pguser-eoapi"
name: ""
keys:
username: "user"
password: "password"
Expand Down
109 changes: 109 additions & 0 deletions charts/eoapi/test-local-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Local test configuration for minikube/local development
# Based on test-k3s-unittest-values.yaml with minimal changes for local environment

testing: true
ingress:
enabled: true
className: "nginx" # Changed from "traefik" for minikube
pathType: "Prefix"
host: "eoapi.local"

pgstacBootstrap:
enabled: true
settings:
resources:
requests:
cpu: "256m"
memory: "1024Mi"
limits:
cpu: "512m"
memory: "1024Mi"

raster:
enabled: true
settings:
resources:
limits:
cpu: "768m"
memory: "2048Mi" # Reduced from 4096Mi for local
requests:
cpu: "256m"
memory: "1024Mi"

stac:
enabled: true
settings:
resources:
limits:
cpu: "1280m"
memory: "1536Mi"
requests:
cpu: "512m"
memory: "1024Mi"

vector:
enabled: true
settings:
resources:
limits:
cpu: "768m"
memory: "1536Mi"
requests:
cpu: "256m"
memory: "1024Mi"
envVars:
TIPG_DEBUG: "True"

eoapi-notifier:
enabled: true
config:
logLevel: DEBUG
sources:
- type: pgstac
config:
channel: pgstac_items_change
connection:
existingSecret:
name: "" # Set dynamically by deploy script
keys:
username: "user"
password: "password"
host: "host"
port: "port"
database: "dbname"
outputs:
- type: cloudevents
config:
source: /eoapi/pgstac
event_type: org.eoapi.stac.item
destination:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: eoapi-cloudevents-sink
resources:
requests:
cpu: "50m"
memory: "64Mi"
limits:
cpu: "200m"
memory: "128Mi"

# Reduce PostgreSQL resources for local development
postgrescluster:
instances:
- name: "postgres"
replicas: 1
dataVolumeClaimSpec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: "1Gi" # Reduced for local
resources:
requests:
cpu: "100m" # Reduced for local
memory: "512Mi" # Reduced for local
limits:
cpu: "500m" # Reduced for local
memory: "1Gi" # Reduced for local
Loading