Skip to content

Add local k3d dev stack for integration tests#96

Open
Aadarsh-Sankar wants to merge 1 commit into
opencost:mainfrom
Aadarsh-Sankar:issue-89-dev-stack
Open

Add local k3d dev stack for integration tests#96
Aadarsh-Sankar wants to merge 1 commit into
opencost:mainfrom
Aadarsh-Sankar:issue-89-dev-stack

Conversation

@Aadarsh-Sankar

Copy link
Copy Markdown
  • Add dev/up.sh and dev/down.sh for one-command k3d stack (Prometheus + OpenCost + seed workloads)
  • Add helper scripts: port-forward, deploy-workloads, toggle-prometheus, collect-logs
  • Add dev/README.md with setup, test instructions, and local test matrix
  • Configure kube-state-metrics annotation allowlist for allocation annotation tests

Copilot AI review requested due to automatic review settings June 11, 2026 17:09
@Aadarsh-Sankar Aadarsh-Sankar requested a review from a team as a code owner June 11, 2026 17:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.md and a pointer from the root README.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
Comment thread dev/down.sh
@@ -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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants