Skip to content

dipereirs/knative_gitops_poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites

Before running this POC, you need the following installed locally:

Quick Start

1. Start Minikube

minikube start

2. Deploy Knative and Functions

# Deploy everything via Kustomize
kubectl apply -k gitops/

# Wait for services to be ready
kubectl get ksvc -w

3. Test HTTP Functions

# In one terminal, start port-forwarding:
kubectl port-forward -n knative-serving svc/kourier 8080:80

# In another terminal, test the function:
curl -H "Host: hello.default.example.com" http://localhost:8080

Note: The Knative service is named hello (see gitops/apps/hello-py/service.yaml). Functions scale to zero after ~60 seconds of inactivity and automatically scale up when receiving requests.

Testing SQS Event Processing

1. Start LocalStack

./scripts/start-localstack.sh

2. Initialize AWS Resources

./scripts/init-aws-resources.sh

3. Send Test Messages

./scripts/test-sqs.sh

4. Check Function Logs

# View logs from the SQS processor
kubectl logs -l serving.knative.dev/service=process-sqs-event -f

Architecture

This POC demonstrates:

  • Knative Serving - Serverless HTTP functions that scale to zero
  • Knative Eventing - Event-driven architecture with brokers and triggers
  • SQS Integration - AWS SQS as an event source (using LocalStack)
  • GitOps Pattern - All resources defined as Kubernetes manifests

Event Flow

SQS Queue → IntegrationSource → Broker → Trigger → Function

Development

Building Functions

cd functions/hello-py
docker build -t hello-py:latest .

# Load into minikube
minikube image load hello-py:latest

Updating Deployments

# After making changes to manifests
kubectl apply -k gitops/

# Or for a specific app
kubectl apply -k gitops/apps/hello-py/

Cleanup

# Delete all resources
kubectl delete -k gitops/

# Stop LocalStack
./scripts/stop-localstack.sh

# Stop minikube
minikube stop

Notes

  • This is a POC for learning purposes, not production-ready
  • In production, you'd separate infrastructure (brokers, sources) from application deployments
  • Secrets should be managed with proper secret management tools (not checked into git)
  • The aws-credentials secret uses LocalStack test credentials

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages