-
Notifications
You must be signed in to change notification settings - Fork 5
feat: github event byoc demo #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
12a1607
0deb3fe
0fc93ae
df42da2
47b68fd
6c12aae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 |
There was a problem hiding this comment.
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.