Add local k3d dev stack for integration tests#96
Open
Aadarsh-Sankar wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds a local development stack for OpenCost based on k3d, providing scripts to spin up a complete environment with Prometheus, OpenCost, and seed workloads for integration testing.
Changes:
- Adds shell scripts to create/destroy a k3d cluster with Prometheus and OpenCost deployed via Helm, plus helper scripts for port-forwarding, log collection, workload deployment, and Prometheus toggling.
- Adds Helm values files for Prometheus (with kube-state-metrics annotation allowlist) and OpenCost (with MCP, UI, custom pricing enabled), along with seed Kubernetes workload manifests.
- Adds comprehensive documentation in
dev/README.mdand a pointer from the rootREADME.md.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| dev/up.sh | Main script to create k3d cluster and deploy all components |
| dev/down.sh | Teardown script to delete the k3d cluster |
| dev/scripts/port-forward.sh | Port-forwards Prometheus and OpenCost services |
| dev/scripts/deploy-workloads.sh | Applies seed workload manifests |
| dev/scripts/toggle-prometheus.sh | Scales Prometheus up/down for resilience testing |
| dev/scripts/collect-logs.sh | Collects pod logs and status for debugging |
| dev/helm/prometheus-values.yaml | Helm values for Prometheus with kube-state-metrics config |
| dev/helm/opencost-values.yaml | Helm values for OpenCost |
| dev/manifests/workloads/seed.yaml | Seed workloads (nginx Deployment + web StatefulSet) |
| dev/README.md | Documentation for the dev stack |
| README.md | Adds pointer to dev stack docs |
| .gitignore | Ignores dev/logs/ directory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+6
to
+10
| metricAnnotationsAllowList: #allows all annotations to be collected | ||
| - "pods=[*]" #allows all pods to be collected | ||
| - "namespaces=[*]" #allows all namespaces to be collected | ||
| extraArgs: | ||
| - --metric-annotations-allowlist=pods=[*],namespaces=[*] #allows all annotations to be collected |
| @@ -0,0 +1,3 @@ | |||
| #!/usr/bin/env bash | |||
| set -euo pipefail | |||
| k3d cluster delete opencost-dev No newline at end of file | |||
Comment on lines
+9
to
+18
| kubectl port-forward -n prometheus-system svc/prometheus-server 9090:80 & | ||
| PROM_PID=$! | ||
|
|
||
| kubectl port-forward -n opencost svc/opencost 9003:9003 8081:8081 & | ||
| OC_PID=$! | ||
|
|
||
| cleanup() { | ||
| kill "$PROM_PID" "$OC_PID" 2>/dev/null || true | ||
| } | ||
| trap cleanup EXIT INT TERM |
Comment on lines
+7
to
+8
| - "pods=[*]" #allows all pods to be collected | ||
| - "namespaces=[*]" #allows all namespaces to be collected |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dev/up.shanddev/down.shfor one-command k3d stack (Prometheus + OpenCost + seed workloads)dev/README.mdwith setup, test instructions, and local test matrix