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
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# Script to create ConfigMap from source files

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PRODUCER_DIR="$(cd "${SCRIPT_DIR}" && pwd)"
CONFIGMAP_NAME="github-event-producer-code"
NAMESPACE="default"

echo "Creating ConfigMap ${CONFIGMAP_NAME} from source files..."
echo "Source directory: ${PRODUCER_DIR}"
echo ""

# Create ConfigMap from source files
kubectl create configmap ${CONFIGMAP_NAME} \
--from-file="${PRODUCER_DIR}/event_producer.py" \
--from-file="${PRODUCER_DIR}/requirements.txt" \
--from-file="${PRODUCER_DIR}/github_event.avsc" \
--namespace=${NAMESPACE} \
--dry-run=client -o yaml | kubectl apply -f -

echo "✅ ConfigMap ${CONFIGMAP_NAME} created/updated successfully!"
echo ""
echo "To view the ConfigMap:"
echo " kubectl get configmap ${CONFIGMAP_NAME} -n ${NAMESPACE}"
echo ""
echo "To delete the ConfigMap:"
echo " kubectl delete configmap ${CONFIGMAP_NAME} -n ${NAMESPACE}"

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: github-event-producer
namespace: default
labels:
app: github-event-producer
component: producer
spec:
replicas: 1
selector:
matchLabels:
app: github-event-producer
template:
metadata:
labels:
app: github-event-producer
component: producer
spec:
# Use producer node group if available
nodeSelector:
node-type: producer
containers:
- name: event-producer
image: python:3.9
command:
- sh
- -c
- |
echo "Installing Python dependencies..."
pip install --no-cache-dir -r /app/requirements.txt
echo "Starting event producer..."
python /app/event_producer.py
env:
- name: KAFKA_BOOTSTRAP_SERVERS
value: "kf-pfiq444nipaz43tk.automqlab-k3f3.automq.private:9092"
- name: SCHEMA_REGISTRY_URL
value: "http://kf-pfiq444nipaz43tk.automqlab-k3f3.automq.private:8081"
Comment on lines +36 to +38
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

Hardcoded Kafka bootstrap servers and schema registry URL. These should be parameterized using Terraform outputs or ConfigMap/environment variables that can be dynamically configured per environment.

Suggested change
value: "kf-pfiq444nipaz43tk.automqlab-k3f3.automq.private:9092"
- name: SCHEMA_REGISTRY_URL
value: "http://kf-pfiq444nipaz43tk.automqlab-k3f3.automq.private:8081"
valueFrom:
configMapKeyRef:
name: github-event-producer-config
key: KAFKA_BOOTSTRAP_SERVERS
- name: SCHEMA_REGISTRY_URL
valueFrom:
configMapKeyRef:
name: github-event-producer-config
key: SCHEMA_REGISTRY_URL

Copilot uses AI. Check for mistakes.
- name: TOPIC_NAME
value: "github_events_iceberg"
- name: LOG_LEVEL
value: "INFO" # Options: DEBUG, INFO, WARNING, ERROR
- name: KAFKA_DEBUG
value: "" # Set to 'all' or 'broker,topic,msg' for debug logs
- name: PYTHONUNBUFFERED
value: "1"
resources:
requests:
memory: "512Mi"
cpu: "500m"
limits:
memory: "2Gi"
cpu: "2000m"
volumeMounts:
- name: app-code
mountPath: /app
readOnly: true
livenessProbe:
exec:
command:
- /bin/sh
- -c
- "ps aux | grep -v grep | grep event_producer.py || exit 1"
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "ps aux | grep -v grep | grep event_producer.py || exit 1"
Comment on lines +59 to +73
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

Inefficient liveness/readiness probe. Using ps aux | grep is resource-intensive and unreliable for checking if a Python script is healthy. Consider implementing a simple HTTP health endpoint in the producer script or using a file-based health check that the script touches periodically.

Suggested change
exec:
command:
- /bin/sh
- -c
- "ps aux | grep -v grep | grep event_producer.py || exit 1"
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "ps aux | grep -v grep | grep event_producer.py || exit 1"
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz
port: 8080

Copilot uses AI. Check for mistakes.
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
volumes:
- name: app-code
configMap:
name: github-event-producer-code
restartPolicy: Always
Loading
Loading