Skip to content

Commit e787c37

Browse files
committed
feat: adjust EventListener to integrate with new MLOps pipeline
Update EventListener configuration and parameters to align with the refactored MLOps pipeline that uses DVC version parameters
1 parent 6dd304f commit e787c37

File tree

9 files changed

+706
-264
lines changed

9 files changed

+706
-264
lines changed

deploy/Makefile

Lines changed: 185 additions & 92 deletions
Large diffs are not rendered by default.

deploy/tekton/eventlistener/README.md

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Tekton EventListener for MLOps Benchmarking
22

3-
This directory contains a Tekton EventListener implementation that triggers the sast-ai-orchestrator MLOps batch API via webhook. This enables automated MLOps performance testing and benchmarking with DVC data versioning and S3 integration.
3+
This directory contains a Tekton EventListener implementation that triggers the sast-ai-orchestrator MLOps batch API via webhook. This enables automated MLOps performance testing and benchmarking with DVC data versioning.
44

55
## 🎯 Purpose
66

77
Enable MLOps benchmark testing for batch SAST analysis jobs:
88
- ✅ Webhook-based triggering (curl/HTTP POST)
99
- ✅ Integration with sast-ai-orchestrator MLOps API (`/api/v1/mlops-batches`)
1010
- ✅ DVC data versioning support
11-
- ✅ S3 object storage integration
1211
- ✅ Container image version testing
1312
- ✅ Separation from production workflows
1413
- ✅ Fork-friendly configuration
@@ -90,8 +89,6 @@ make eventlistener \
9089
- ✅ Deploys all EventListener resources via Kustomize
9190
- ✅ Shows verification and testing commands
9291

93-
**Note:** The Google Sheet URL is provided via the webhook payload when triggering the EventListener, not during deployment.
94-
9592
**Note:** The EventListener always calls `/api/v1/mlops-batches` endpoint (hardcoded for MLOps benchmarking).
9693

9794
Verify deployment:
@@ -118,12 +115,11 @@ http://el-benchmark-mlop-listener.<namespace>.svc.cluster.local:8080
118115
curl -X POST http://localhost:8080 \
119116
-H 'Content-Type: application/json' \
120117
-d '{
121-
"batch_sheet_url": "https://docs.google.com/spreadsheets/d/YOUR_TEST_SHEET/edit",
122118
"submitted_by": "manual-test",
123-
"dvc_repo_url": "https://gitlab.com/your-org/dvc-repo.git",
124-
"dvc_data_version": "v1.0.0",
125-
"s3_endpoint_url": "https://s3.amazonaws.com",
126-
"s3_input_bucket_name": "mlops-test-data"
119+
"image_version": "v2.1.0",
120+
"dvc_nvr_version": "v1.0.0",
121+
"dvc_known_false_positives_version": "v1.0.0",
122+
"dvc_prompts_version": "v1.0.0"
127123
}'
128124
```
129125

@@ -132,13 +128,11 @@ curl -X POST http://localhost:8080 \
132128
curl -X POST http://localhost:8080 \
133129
-H 'Content-Type: application/json' \
134130
-d '{
135-
"batch_sheet_url": "https://docs.google.com/spreadsheets/d/YOUR_TEST_SHEET/edit",
136131
"submitted_by": "version-test",
137-
"dvc_repo_url": "https://gitlab.com/your-org/dvc-repo.git",
138-
"dvc_data_version": "v1.0.0",
139-
"s3_endpoint_url": "https://s3.amazonaws.com",
140-
"s3_input_bucket_name": "mlops-test-data",
141-
"image_version": "v2.1.0"
132+
"image_version": "v2.1.0",
133+
"dvc_nvr_version": "v1.0.0",
134+
"dvc_known_false_positives_version": "v1.0.0",
135+
"dvc_prompts_version": "v1.0.0"
142136
}'
143137
```
144138

@@ -182,9 +176,10 @@ Calling Orchestrator MLOps Batch API
182176
Configuration:
183177
Orchestrator URL: http://sast-ai-orchestrator...
184178
API Endpoint: /api/v1/mlops-batches (MLOps benchmarking)
185-
Batch Sheet URL: https://docs.google.com/...
186-
DVC Repo: https://gitlab.com/...
187-
S3 Bucket: mlops-test-data
179+
Image Version: v2.1.0
180+
DVC NVR Version: v1.0.0
181+
DVC Prompts Version: v1.0.0
182+
DVC Known False Positives Version: v1.0.0
188183
...
189184
✓ API call successful!
190185
Batch ID: batch-12345
@@ -220,7 +215,7 @@ oc logs -l tekton.dev/pipelineTask=call-orchestrator-api --tail=100
220215
- Orchestrator URL incorrect in ConfigMap
221216
- Orchestrator service not running: `oc get pods -l app=sast-ai-orchestrator`
222217
- Network policy blocking connections
223-
- Google Sheet URL not accessible by orchestrator
218+
- DVC version parameters not provided in webhook payload
224219

225220
#### Verify ConfigMap
226221

@@ -243,26 +238,22 @@ Send JSON payload with these fields:
243238

244239
```json
245240
{
246-
"batch_sheet_url": "https://docs.google.com/spreadsheets/d/SHEET_ID/edit",
247241
"submitted_by": "trigger-source",
248-
"dvc_repo_url": "https://gitlab.com/org/dvc-repo.git",
249-
"dvc_data_version": "v1.2.3",
250-
"s3_endpoint_url": "https://s3.amazonaws.com",
251-
"s3_input_bucket_name": "mlops-data",
242+
"dvc_nvr_version": "v1.2.3",
243+
"dvc_known_false_positives_version": "v1.2.3",
244+
"dvc_prompts_version": "v1.2.3",
252245
"image_version": "v2.0.0"
253246
}
254247
```
255248

256249
**Required Fields:**
257-
- `batch_sheet_url` - Google Sheet with package list
258-
- `dvc_repo_url` - DVC repository URL
259-
- `dvc_data_version` - DVC data version tag
260-
- `s3_endpoint_url` - S3 endpoint URL
261-
- `s3_input_bucket_name` - S3 bucket name
250+
- `dvc_nvr_version` - DVC NVR resource version
251+
- `dvc_prompts_version` - DVC prompts resource version
252+
- `dvc_known_false_positives_version` - DVC known false positives resource version
262253

263254
**Optional Fields:**
264255
- `submitted_by` - Defaults to "eventlistener-webhook"
265-
- `image_version` - Override workflow version for testing (e.g., "v2.1.0", "sha-abc123")
256+
- `image_version` - Defaults to "latest" (e.g., "v2.1.0", "sha-abc123")
266257

267258
### ConfigMap Keys
268259

@@ -281,13 +272,11 @@ The `benchmark-config` ConfigMap is automatically generated by `make eventlisten
281272

282273
| Parameter | Type | Required | Default | Description |
283274
|-----------|------|----------|---------|-------------|
284-
| `batch-sheet-url` | string | Yes | - | Google Sheet with package list |
275+
| `dvc-nvr-version` | string | **Yes** | - | DVC NVR resource version |
276+
| `dvc-prompts-version` | string | **Yes** | - | DVC prompts resource version |
277+
| `dvc-known-false-positives-version` | string | **Yes** | - | DVC known false positives resource version |
285278
| `submitted-by` | string | No | `eventlistener-webhook` | Trigger source identifier |
286-
| `dvc-repo-url` | string | Yes | - | DVC repository URL for data versioning |
287-
| `dvc-data-version` | string | Yes | - | DVC data version tag |
288-
| `s3-endpoint-url` | string | Yes | - | S3 endpoint URL |
289-
| `s3-input-bucket-name` | string | Yes | - | S3 bucket name for input data |
290-
| `image-version` | string | No | (default from pipeline) | Workflow image version for testing (tag only, e.g., "v2.1.0") |
279+
| `image-version` | string | No | `latest` | Workflow image version for testing (tag only, e.g., "v2.1.0") |
291280

292281
## 🎓 Understanding the Architecture
293282

@@ -339,6 +328,7 @@ The `benchmark-config` ConfigMap is automatically generated by `make eventlisten
339328
│ Orchestrator API │
340329
│ POST /api/v1/ │
341330
│ mlops-batches │
331+
│ (with DVC versions) │
342332
└──────────────────────┘
343333
```
344334

@@ -351,10 +341,21 @@ The `benchmark-config` ConfigMap is automatically generated by `make eventlisten
351341
2. **TriggerBinding**: Extracts parameters from webhook JSON payload (including MLOps params)
352342
3. **TriggerTemplate**: Generates PipelineRun with extracted parameters
353343
4. **Pipeline**: Orchestrates task execution, monitors completion, handles results
354-
5. **Task 1 (call-orchestrator-api)**: Calls orchestrator MLOps API with DVC/S3 params
344+
5. **Task 1 (call-orchestrator-api)**: Calls orchestrator MLOps API with DVC version params
355345
6. **Task 2 (poll-batch-status)**: Monitors batch completion until done or timeout
356346
7. **ConfigMap**: Stores environment-specific configuration (orchestrator URL, API endpoint)
357347

348+
## 🔄 Production Enhancements
349+
350+
For production use, consider:
351+
352+
### Automation
353+
354+
1. **Create CronJob** for scheduled benchmarking
355+
2. **Set up monitoring** (Prometheus metrics)
356+
3. **Configure notifications** (Slack/email on completion/failure)
357+
4. **Add retry logic** for transient failures
358+
358359
### Production Deployment
359360

360361
Deploy to dedicated namespace:
@@ -381,8 +382,6 @@ This creates both:
381382
- The `mlop-sast-ai-workflow-pipeline` that the orchestrator will trigger
382383
- The EventListener webhook endpoint for triggering benchmarks
383384

384-
**Note:** The Google Sheet URL is provided when triggering the EventListener via webhook, not during deployment.
385-
386385
## 🧹 Cleanup
387386

388387
To remove all MLOps benchmark resources:
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
# MLOps Benchmark Configuration
1+
# MLOps Benchmark Configuration Example
22
#
3-
# This ConfigMap is automatically generated by 'make eventlistener'.
4-
# Do not edit manually - regenerate using the Makefile.
3+
# This is an EXAMPLE file for reference only.
4+
# The actual benchmark-config.yaml is automatically generated by the Makefile.
55
#
6-
# To regenerate:
6+
# Recommended deployment method:
77
# cd deploy
88
# make eventlistener \
9-
# ORCHESTRATOR_API_URL=<your-url> \
10-
# NAMESPACE=<your-namespace>
9+
# ORCHESTRATOR_API_URL=http://sast-ai-orchestrator.sast-ai.svc.cluster.local:8080 \
10+
# NAMESPACE=your-namespace
11+
#
12+
# Finding your orchestrator URL:
13+
# oc get svc -l app=sast-ai-orchestrator
14+
#
15+
# Note: The Google Sheet URL is provided via webhook payload when triggering,
16+
# not in this ConfigMap.
1117
#
1218
---
1319
apiVersion: v1
@@ -19,8 +25,9 @@ metadata:
1925
app.kubernetes.io/component: benchmark-mlop
2026
data:
2127
# Orchestrator API base URL (cluster-internal service)
22-
# REPLACE THIS with your actual orchestrator URL
23-
orchestrator-api-url: "http://sast-ai-orchestrator.sast-ai.svc.cluster.local:8080"
28+
# This will be replaced by the Makefile with your actual orchestrator URL
29+
orchestrator-api-url: "http://sast-ai-orchestrator"
2430

2531
# API endpoint path for MLOps batches
2632
api-batch-endpoint: "/api/v1/mlops-batches"
33+

deploy/tekton/eventlistener/benchmark-pipeline.yaml

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,61 +13,51 @@ spec:
1313
batch completion. Designed for performance testing and MLOps workflows.
1414
1515
params:
16-
- name: batch-sheet-url
17-
type: string
18-
description: "Google Sheet URL with package list"
19-
default: ""
20-
2116
- name: submitted-by
2217
type: string
2318
description: "Trigger source identifier"
2419
default: "eventlistener-webhook"
2520

26-
# MLOps-specific parameters
27-
- name: dvc-repo-url
21+
- name: image-version
2822
type: string
29-
description: "DVC repository URL for data versioning"
30-
default: ""
23+
description: "Workflow image version for testing (e.g., v2.1.0, sha-abc123)"
24+
default: "latest"
3125

32-
- name: dvc-data-version
26+
# DVC version parameters (required)
27+
- name: dvc-nvr-version
3328
type: string
34-
description: "DVC data version tag"
35-
default: ""
29+
description: "DVC NVR resource version"
3630

37-
- name: s3-endpoint-url
31+
- name: dvc-prompts-version
3832
type: string
39-
description: "S3 endpoint URL for MLOps data"
40-
default: ""
33+
description: "DVC prompts resource version"
4134

42-
- name: s3-input-bucket-name
35+
- name: dvc-known-false-positives-version
4336
type: string
44-
description: "S3 bucket name for input data"
45-
default: ""
37+
description: "DVC known false positives resource version"
4638

47-
- name: image-version
39+
- name: use-known-false-positive-file
4840
type: string
49-
description: "Workflow image version for testing (e.g., v2.1.0, sha-abc123)"
50-
default: "latest"
41+
description: "Whether to use known false positive file"
42+
default: "true"
5143

5244
tasks:
5345
- name: call-orchestrator-api
5446
taskRef:
5547
name: call-orchestrator-api-mlop
5648
params:
57-
- name: batch-sheet-url
58-
value: $(params.batch-sheet-url)
5949
- name: submitted-by
6050
value: $(params.submitted-by)
61-
- name: dvc-repo-url
62-
value: $(params.dvc-repo-url)
63-
- name: dvc-data-version
64-
value: $(params.dvc-data-version)
65-
- name: s3-endpoint-url
66-
value: $(params.s3-endpoint-url)
67-
- name: s3-input-bucket-name
68-
value: $(params.s3-input-bucket-name)
6951
- name: image-version
7052
value: $(params.image-version)
53+
- name: dvc-nvr-version
54+
value: $(params.dvc-nvr-version)
55+
- name: dvc-prompts-version
56+
value: $(params.dvc-prompts-version)
57+
- name: dvc-known-false-positives-version
58+
value: $(params.dvc-known-false-positives-version)
59+
- name: use-known-false-positive-file
60+
value: $(params.use-known-false-positive-file)
7161

7262
- name: poll-batch-status
7363
taskRef:

deploy/tekton/eventlistener/call-orchestrator-api.yaml

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,33 @@ spec:
1313
testing and benchmark automation.
1414
1515
params:
16-
- name: batch-sheet-url
17-
type: string
18-
description: "Google Sheet URL containing the list of packages to analyze"
19-
2016
- name: submitted-by
2117
type: string
2218
description: "Identifier of who/what triggered this batch"
2319
default: "tekton-eventlistener-mlop"
2420

25-
# MLOps-specific parameters
26-
- name: dvc-repo-url
21+
- name: image-version
2722
type: string
28-
description: "DVC repository URL for data versioning"
29-
default: ""
23+
description: "Workflow image version for testing (e.g., v2.1.0, sha-abc123)"
24+
default: "latest"
3025

31-
- name: dvc-data-version
26+
# DVC version parameters (required)
27+
- name: dvc-nvr-version
3228
type: string
33-
description: "DVC data version tag"
34-
default: ""
29+
description: "DVC NVR resource version"
3530

36-
- name: s3-endpoint-url
31+
- name: dvc-prompts-version
3732
type: string
38-
description: "S3 endpoint URL for MLOps data"
39-
default: ""
33+
description: "DVC prompts resource version"
4034

41-
- name: s3-input-bucket-name
35+
- name: dvc-known-false-positives-version
4236
type: string
43-
description: "S3 input bucket name"
44-
default: ""
37+
description: "DVC known false positives resource version"
4538

46-
- name: image-version
39+
- name: use-known-false-positive-file
4740
type: string
48-
description: "Workflow image version for testing (e.g., v2.1.0, sha-abc123)"
49-
default: ""
41+
description: "Whether to use known false positive file"
42+
default: "true"
5043

5144
results:
5245
- name: batch-id
@@ -86,13 +79,12 @@ spec:
8679
echo "Configuration:"
8780
echo " Orchestrator URL: $ORCHESTRATOR_URL"
8881
echo " API Endpoint: $API_ENDPOINT"
89-
echo " Batch Sheet URL: $(params.batch-sheet-url)"
9082
echo " Submitted By: $(params.submitted-by)"
91-
echo " DVC Repo: $(params.dvc-repo-url)"
92-
echo " DVC Version: $(params.dvc-data-version)"
93-
echo " S3 Endpoint: $(params.s3-endpoint-url)"
94-
echo " S3 Bucket: $(params.s3-input-bucket-name)"
9583
echo " Image Version: $(params.image-version)"
84+
echo " DVC NVR Version: $(params.dvc-nvr-version)"
85+
echo " DVC Prompts Version: $(params.dvc-prompts-version)"
86+
echo " DVC Known False Positives Version: $(params.dvc-known-false-positives-version)"
87+
echo " Use Known False Positive File: $(params.use-known-false-positive-file)"
9688
echo ""
9789
9890
# Construct full API URL by concatenating base URL with endpoint
@@ -104,14 +96,12 @@ spec:
10496
# Note: API expects camelCase field names
10597
PAYLOAD=$(cat <<EOF
10698
{
107-
"batchGoogleSheetUrl": "$(params.batch-sheet-url)",
10899
"submittedBy": "$(params.submitted-by)",
109-
"useKnownFalsePositiveFile": true,
110-
"dvcRepoUrl": "$(params.dvc-repo-url)",
111-
"dvcDataVersion": "$(params.dvc-data-version)",
112-
"s3EndpointUrl": "$(params.s3-endpoint-url)",
113-
"s3InputBucketName": "$(params.s3-input-bucket-name)",
114-
"imageVersion": "$(params.image-version)"
100+
"imageVersion": "$(params.image-version)",
101+
"dvcNvrVersion": "$(params.dvc-nvr-version)",
102+
"dvcPromptsVersion": "$(params.dvc-prompts-version)",
103+
"dvcKnownFalsePositivesVersion": "$(params.dvc-known-false-positives-version)",
104+
"useKnownFalsePositiveFile": $(params.use-known-false-positive-file)
115105
}
116106
EOF
117107
)

0 commit comments

Comments
 (0)