Skip to content

Commit 6dd304f

Browse files
committed
feat: add Tekton EventListener for MLOps benchmark testing workflows
Implement complete EventListener infrastructure to trigger MLOps batch analysis via webhook, including pipeline tasks for API calls and status polling, comprehensive documentation, and Makefile integration for automated deployment.
1 parent 9bd1ac4 commit 6dd304f

File tree

10 files changed

+1316
-1
lines changed

10 files changed

+1316
-1
lines changed

β€Ždeploy/Makefileβ€Ž

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ S3_INPUT_BUCKET_NAME ?= test
5656
GITHUB_REPO_URL ?= https://github.com/RHEcosystemAppEng/sast-ai-workflow.git
5757
ARGOCD_NAMESPACE ?= sast-ai
5858

59+
# EventListener Configuration
60+
ORCHESTRATOR_API_URL ?=
61+
5962
# Secret configuration (loaded from .env file)
6063
GITLAB_TOKEN ?= ""
6164
LLM_API_KEY ?= ""
@@ -294,7 +297,7 @@ run:
294297
@echo " Container Image: $(CONTAINER_IMAGE)"
295298
@echo " πŸ”„ Removing old pipeline runs..."
296299
@$(CO) delete pipelinerun sast-ai-workflow-pipelinerun \
297-
-n $(NAMESPACE) --ignore-not-found > /dev/null 2>&1
300+
-n $(NAMESPACE) --ignore-not-found
298301
# Create PipelineRun with current parameters
299302
@sed \
300303
-e 's|PROJECT_NAME_PLACEHOLDER|$(PROJECT_NAME)|g' \
@@ -362,6 +365,73 @@ argocd-clean:
362365
$(CO) patch application sast-ai-tekton-pipeline-syncer-prod -n $(NAMESPACE) -p '{"metadata":{"finalizers":null}}' --type=merge > /dev/null 2>&1 || true
363366
@echo " βœ“ ArgoCD Applications removed"
364367

368+
eventlistener:
369+
@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
370+
@echo "🎯 SAST AI Workflow - EventListener for MLOps Benchmarking"
371+
@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
372+
@echo " Context: $(CONTEXT)"
373+
@echo " Namespace: $(NAMESPACE)"
374+
@echo ""
375+
@echo "πŸ“‹ Validating EventListener configuration..."
376+
@if [ -z "$(ORCHESTRATOR_API_URL)" ]; then \
377+
echo " ❌ ORCHESTRATOR_API_URL is required"; \
378+
echo ""; \
379+
echo "Usage:"; \
380+
echo " make eventlistener ORCHESTRATOR_API_URL=<url> NAMESPACE=<namespace>"; \
381+
echo ""; \
382+
echo "Example:"; \
383+
echo " make eventlistener \\"; \
384+
echo " ORCHESTRATOR_API_URL=http://sast-ai-orchestrator.sast-ai.svc.cluster.local:8080 \\"; \
385+
echo " NAMESPACE=sast-ai"; \
386+
echo ""; \
387+
echo "Tip: Find your orchestrator URL with:"; \
388+
echo " oc get svc -l app=sast-ai-orchestrator"; \
389+
echo ""; \
390+
exit 1; \
391+
fi
392+
@echo " βœ“ Configuration validated"
393+
@echo " β€’ Orchestrator URL: $(ORCHESTRATOR_API_URL)"
394+
@echo ""
395+
@echo "πŸ”§ Generating benchmark-config.yaml..."
396+
@cat > tekton/eventlistener/benchmark-config.yaml <<EOF
397+
# EventListener Configuration for MLOps Benchmarking
398+
# Generated by: make eventlistener
399+
# Timestamp: $$(date -u +"%Y-%m-%d %H:%M:%S UTC")
400+
apiVersion: v1
401+
kind: ConfigMap
402+
metadata:
403+
name: benchmark-config
404+
labels:
405+
app.kubernetes.io/name: sast-ai-workflow
406+
app.kubernetes.io/component: benchmark-mlop
407+
data:
408+
# Orchestrator API base URL (cluster-internal service)
409+
orchestrator-api-url: "$(ORCHESTRATOR_API_URL)"
410+
411+
# API endpoint path for MLOps batches
412+
api-batch-endpoint: "/api/v1/mlops-batches"
413+
EOF
414+
@echo " βœ“ Configuration file generated"
415+
@echo ""
416+
@echo "πŸš€ Deploying EventListener resources..."
417+
@$(CO) apply -k tekton/eventlistener/ -n $(NAMESPACE) || \
418+
{ echo " ❌ Failed to deploy EventListener resources"; exit 1; }
419+
@echo " βœ“ EventListener deployed"
420+
@echo ""
421+
@echo "βœ… EventListener deployment completed!"
422+
@echo ""
423+
@echo "πŸ“Š Verify deployment:"
424+
@echo " oc get eventlistener,task,pipeline,cm -l app.kubernetes.io/component=benchmark-mlop -n $(NAMESPACE)"
425+
@echo ""
426+
@echo "πŸ§ͺ Test EventListener:"
427+
@echo " cd tekton/eventlistener && ./test-eventlistener.sh"
428+
@echo ""
429+
430+
eventlistener-clean:
431+
@echo "🧹 Removing EventListener resources..."
432+
@$(CO) delete -k tekton/eventlistener/ -n $(NAMESPACE) --ignore-not-found > /dev/null 2>&1 || true
433+
@echo " βœ“ EventListener resources removed"
434+
365435
clean:
366436
@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
367437
@echo "🧹 SAST AI Workflow - Cleanup"
@@ -384,6 +454,9 @@ clean:
384454
@if [ "$(ENV)" = "prod" ]; then \
385455
$(CO) delete -k tekton/overlays/prod -n $(NAMESPACE) --ignore-not-found > /dev/null 2>&1 || true; \
386456
echo " βœ“ Production Tekton resources removed (kustomize overlay)"; \
457+
elif [ "$(ENV)" = "mlop" ]; then \
458+
$(CO) delete -k tekton/overlays/mlop -n $(NAMESPACE) --ignore-not-found > /dev/null 2>&1 || true; \
459+
echo " βœ“ MLOp Tekton resources removed (kustomize overlay)"; \
387460
else \
388461
$(CO) delete -k tekton/base -n $(NAMESPACE) --ignore-not-found > /dev/null 2>&1 || true; \
389462
echo " βœ“ Base Tekton resources removed (kustomize base)"; \

0 commit comments

Comments
Β (0)