@@ -1329,132 +1329,200 @@ ibmcloud-ce-rm:
13291329# =============================================================================
13301330# 🧪 MINIKUBE LOCAL CLUSTER
13311331# =============================================================================
1332+ # A self‑contained block with sensible defaults, overridable via the CLI.
1333+ # Examples:
1334+ # make minikube-start MINIKUBE_DRIVER=podman
1335+ # make minikube-image-load TAG=v0.1.2
1336+ #
1337+ # # Push via the internal registry (registry addon):
1338+ # # 1️⃣ Discover the randomized host‑port (docker driver only):
1339+ # REG_URL=$(shell minikube -p $(MINIKUBE_PROFILE) service registry -n kube-system --url)
1340+ # # 2️⃣ Tag & push:
1341+ # docker build -t $${REG_URL}/$(PROJECT_NAME):dev .
1342+ # docker push $${REG_URL}/$(PROJECT_NAME):dev
1343+ # # 3️⃣ Reference in manifests:
1344+ # image: $${REG_URL}/$(PROJECT_NAME):dev
1345+ #
1346+ # # If you built a prod image via:
1347+ # # make docker-prod # ⇒ mcpgateway/mcpgateway:latest
1348+ # # Tag & push it into Minikube:
1349+ # docker tag mcpgateway/mcpgateway:latest $${REG_URL}/mcpgateway:latest
1350+ # docker push $${REG_URL}/mcpgateway:latest
1351+ # # Override the Make target variable or patch your Helm values:
1352+ # make minikube-k8s-apply IMAGE=$${REG_URL}/mcpgateway:latest
1353+ # -----------------------------------------------------------------------------
1354+
1355+ # ▸ Tunables (export or pass on the command line)
1356+ MINIKUBE_PROFILE ?= mcpgw # Profile/cluster name
1357+ MINIKUBE_DRIVER ?= docker # docker | podman | hyperkit | virtualbox …
1358+ MINIKUBE_CPUS ?= 4 # vCPUs to allocate
1359+ MINIKUBE_MEMORY ?= 6g # RAM (supports m / g suffix)
1360+ # Enabled addons – tweak to suit your workflow (`minikube addons list`).
1361+ # • ingress / ingress-dns – Ingress controller + CoreDNS wildcard hostnames
1362+ # • metrics-server – HPA / kubectl top
1363+ # • dashboard – Web UI (make minikube-dashboard)
1364+ # • registry – Local Docker registry, *dynamic* host-port
1365+ # • registry-aliases – Adds handy DNS names inside the cluster
1366+ MINIKUBE_ADDONS ?= ingress ingress-dns metrics-server dashboard registry registry-aliases
1367+ # OCI image tag to preload into the cluster.
1368+ # • By default we point to the *local* image built via `make docker-prod`, e.g.
1369+ # mcpgateway/mcpgateway:latest. Override with IMAGE=<repo:tag> to use a
1370+ # remote registry (e.g. ghcr.io/ibm/mcp-context-forge:v0.1.1).
1371+ TAG ?= latest # override with TAG=<ver>
1372+ IMAGE ?= $(IMG ) :$(TAG ) # or IMAGE=ghcr.io/ibm/mcp-context-forge:$(TAG)
1373+
1374+ # -----------------------------------------------------------------------------
1375+ # 🆘 HELP TARGETS (parsed by `make help`)
1376+ # -----------------------------------------------------------------------------
13321377# help: 🧪 MINIKUBE LOCAL CLUSTER
1333- # help: minikube-install - Install Minikube (macOS, Linux, or Windows via choco)
1334- # help: helm-install - Install Helm CLI (macOS, Linux, or Windows)
1335- # help: minikube-start - Start local Minikube cluster with Ingress + DNS + metrics-server
1336- # help: minikube-stop - Stop the Minikube cluster
1337- # help: minikube-delete - Delete the Minikube cluster
1338- # help: minikube-image-load - Build and load ghcr.io/ibm/mcp-context-forge:latest into Minikube
1339- # help: minikube-k8s-apply - Apply Kubernetes manifests from k8s/
1340- # help: minikube-status - Show status of Minikube and ingress pods
1378+ # help: minikube-install - Install Minikube + kubectl (macOS / Linux / Windows)
1379+ # help: minikube-start - Start cluster + enable $(MINIKUBE_ADDONS)
1380+ # help: minikube-stop - Stop the cluster
1381+ # help: minikube-delete - Delete the cluster completely
1382+ # help: minikube-tunnel - Run "minikube tunnel" (LoadBalancer) in foreground
1383+ # help: minikube-dashboard - Print & (best‑effort) open the Kubernetes dashboard URL
1384+ # help: minikube-image-load - Load $(IMAGE) into Minikube container runtime
1385+ # help: minikube-k8s-apply - Apply manifests from k8s/
1386+ # help: minikube-status - Cluster + addon health overview
1387+ # help: minikube-context - Switch kubectl context to Minikube
1388+ # help: minikube-ssh - SSH into the Minikube VM
1389+ # help: minikube-reset - 🚨 delete ➜ start ➜ apply ➜ status (idempotent dev helper)
1390+ # help: minikube-registry-url - Echo the dynamic registry URL (e.g. http://localhost:32790)
13411391
13421392.PHONY : minikube-install helm-install minikube-start minikube-stop minikube-delete \
1343- minikube-image-load minikube-k8s-apply minikube-status
1393+ minikube-tunnel minikube-dashboard minikube-image-load minikube-k8s-apply \
1394+ minikube-status minikube-context minikube-ssh minikube-reset minikube-registry-url
13441395
1396+ # -----------------------------------------------------------------------------
1397+ # 🚀 INSTALLATION HELPERS
1398+ # -----------------------------------------------------------------------------
13451399minikube-install :
13461400 @echo " 💻 Detecting OS and installing Minikube + kubectl…"
1347- @if [ " $$ (uname)" = " Darwin" ]; then \
1348- echo " 🍎 Installing via Homebrew…" ; \
1401+ @if [ " $( shell uname) " = " Darwin" ]; then \
13491402 brew install minikube kubernetes-cli; \
1350- elif [ " $$ (uname)" = " Linux" ]; then \
1351- echo " 🐧 Installing via direct download…" ; \
1352- curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && \
1353- sudo install minikube-linux-amd64 /usr/local/bin/minikube && \
1354- rm minikube-linux-amd64; \
1355- echo " 🔧 Installing kubectl…" ; \
1356- curl -LO " https://dl.k8s.io/release/$$ (curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
1403+ elif [ " $( shell uname) " = " Linux" ]; then \
1404+ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && \
1405+ chmod +x minikube && sudo mv minikube /usr/local/bin/; \
1406+ curl -Lo kubectl " https://dl.k8s.io/release/$$ (curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
13571407 chmod +x kubectl && sudo mv kubectl /usr/local/bin/; \
13581408 elif command -v powershell.exe > /dev/null; then \
1359- echo " 🪟 Installing via Chocolatey…" ; \
1360- powershell.exe -Command " choco install -y minikube kubernetes-cli" ; \
1361- else \
1362- echo " ❌ Unsupported OS. Please install manually." ; \
1363- exit 1; \
1364- fi
1365-
1366- helm-install :
1367- @echo " 📦 Installing Helm CLI…"
1368- @if [ " $$ (uname)" = " Darwin" ]; then \
1369- brew install helm; \
1370- elif [ " $$ (uname)" = " Linux" ]; then \
1371- curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash; \
1372- elif command -v powershell.exe > /dev/null; then \
1373- powershell.exe -Command " choco install -y kubernetes-helm" ; \
1409+ powershell.exe -NoProfile -Command " choco install -y minikube kubernetes-cli" ; \
13741410 else \
1375- echo " ❌ Unsupported OS. Please install Helm manually." ; \
1376- exit 1; \
1411+ echo " ❌ Unsupported OS. Install manually ↗" ; exit 1; \
13771412 fi
13781413
1414+ # -----------------------------------------------------------------------------
1415+ # ⏯ LIFECYCLE COMMANDS
1416+ # -----------------------------------------------------------------------------
13791417minikube-start :
1380- @echo " 🚀 Starting Minikube with profile 'mcpgw'..."
1381- minikube start \
1382- --driver=docker \
1383- --cpus=4 --memory=6g \
1384- --profile=mcpgw
1385- @echo " 🔌 (Re)enabling required addons…"
1386- minikube addons enable ingress -p mcpgw
1387- minikube addons enable ingress-dns -p mcpgw
1388- minikube addons enable metrics-server -p mcpgw
1418+ @echo " 🚀 Starting Minikube profile '$( MINIKUBE_PROFILE) ' (driver=$( MINIKUBE_DRIVER) ) …"
1419+ minikube start -p $(MINIKUBE_PROFILE ) \
1420+ --driver=$(MINIKUBE_DRIVER ) \
1421+ --cpus=$(MINIKUBE_CPUS ) --memory=$(MINIKUBE_MEMORY )
1422+ @echo " 🔌 Enabling addons: $( MINIKUBE_ADDONS) "
1423+ @for addon in $(MINIKUBE_ADDONS ) ; do \
1424+ minikube addons enable $$ addon -p $(MINIKUBE_PROFILE ) ; \
1425+ done
13891426
13901427minikube-stop :
1391- @echo " 🛑 Stopping Minikube cluster... "
1392- minikube stop -p mcpgw
1428+ @echo " 🛑 Stopping Minikube … "
1429+ minikube stop -p $( MINIKUBE_PROFILE )
13931430
13941431minikube-delete :
1395- @echo " 🗑 Deleting Minikube cluster... "
1396- minikube delete -p mcpgw
1432+ @echo " 🗑 Deleting Minikube profile ' $( MINIKUBE_PROFILE ) ' … "
1433+ minikube delete -p $( MINIKUBE_PROFILE )
13971434
1435+ # -----------------------------------------------------------------------------
1436+ # 🛠 UTILITIES
1437+ # -----------------------------------------------------------------------------
1438+ minikube-tunnel :
1439+ @echo " 🌐 Starting minikube tunnel (Ctrl+C to quit) …"
1440+ minikube -p $(MINIKUBE_PROFILE ) tunnel
1441+
1442+ minikube-dashboard :
1443+ @echo " 📊 Fetching dashboard URL …"
1444+ @minikube dashboard -p $(MINIKUBE_PROFILE ) --url | { \
1445+ read url; \
1446+ echo " 🔗 Dashboard: $$ url" ; \
1447+ ( command -v xdg-open > /dev/null && xdg-open $$ url > /dev/null 2>&1 ) || \
1448+ ( command -v open > /dev/null && open $$ url > /dev/null 2>&1 ) || true ; \
1449+ }
1450+
1451+ minikube-context :
1452+ @echo " 🎯 Switching kubectl context to Minikube …"
1453+ kubectl config use-context minikube
1454+
1455+ minikube-ssh :
1456+ @echo " 🔧 Connecting to Minikube VM (exit with Ctrl+D) …"
1457+ minikube ssh -p $(MINIKUBE_PROFILE )
1458+
1459+ # -----------------------------------------------------------------------------
1460+ # 📦 IMAGE & MANIFEST HANDLING
1461+ # -----------------------------------------------------------------------------
13981462minikube-image-load :
1399- @echo " 📦 Loading image into Minikube (must be pre-built)..."
1400- @if ! docker image inspect ghcr.io/ibm/mcp-context-forge:latest > /dev/null 2>&1 ; then \
1401- echo " ❌ Image ghcr.io/ibm/mcp-context-forge:latest not found. Download or build it first." ; \
1402- exit 1; \
1463+ @echo " 📦 Loading $( IMAGE) into Minikube …"
1464+ @if ! docker image inspect $(IMAGE ) > /dev/null 2>&1 ; then \
1465+ echo " ❌ $( IMAGE) not found locally. Build or pull it first." ; exit 1; \
14031466 fi
1404- minikube image load ghcr.io/ibm/mcp-context-forge:latest -p mcpgw
1405- @echo " 🔍 Verifying image presence inside Minikube..."
1406- minikube ssh -p mcpgw " sudo crictl images | grep ghcr.io/ibm/mcp-context-forge || echo '❌ Image not found in Minikube runtime'"
1467+ minikube image load $(IMAGE ) -p $(MINIKUBE_PROFILE )
14071468
14081469minikube-k8s-apply :
1409- @echo " 🧩 Applying Kubernetes manifests..."
1410- kubectl apply -f k8s/postgres-config.yaml || true
1411- kubectl apply -f k8s/postgres-pv.yaml || true
1412- kubectl apply -f k8s/postgres-pvc.yaml || true
1413- kubectl apply -f k8s/postgres-deployment.yaml
1414- kubectl apply -f k8s/postgres-service.yaml
1415- kubectl apply -f k8s/redis-deployment.yaml
1416- kubectl apply -f k8s/redis-service.yaml
1417- kubectl apply -f k8s/mcp-context-forge-deployment.yaml
1418- kubectl apply -f k8s/mcp-context-forge-service.yaml
1419- kubectl apply -f k8s/mcp-context-forge-ingress.yaml
1420- minikube status -p mcpgw
1470+ @echo " 🧩 Applying k8s manifests in ./k8s …"
1471+ @kubectl apply -f k8s/ --recursive
14211472
1422- minikube-status :
1423- @echo " 📊 Minikube cluster status:"
1424- minikube status -p mcpgw
1425-
1426- @echo "\n📦 Addon status (ingress, ingress-dns, metrics-server):"
1427- minikube addons list | grep -E 'ingress|ingress-dns|metrics-server'
1428-
1429- @echo "\n🚦 Ingress controller pods:"
1430- kubectl get pods -n ingress-nginx -o wide || true
1431-
1432- @echo "\n🧭 Ingress-DNS pods (coredns):"
1433- kubectl get pods -n kube-system -l k8s-app=kube-dns -o wide || true
1473+ # -----------------------------------------------------------------------------
1474+ # 🔍 Utility: print the current registry URL (host‑port) – works after cluster
1475+ # + registry addon are up.
1476+ # -----------------------------------------------------------------------------
1477+ minikube-registry-url :
1478+ @echo " 📦 Internal registry URL:" && \
1479+ minikube -p $(MINIKUBE_PROFILE ) service registry -n kube-system --url || \
1480+ echo " ⚠️ Registry addon not ready – run make minikube-start first."
14341481
1435- @echo "\n🧩 Application services:"
1436- kubectl get svc || true
1482+ # -----------------------------------------------------------------------------
1483+ # 📊 INSPECTION & RESET
1484+ # -----------------------------------------------------------------------------
1485+ minikube-status :
1486+ @echo " 📊 Minikube cluster status:" && minikube status -p $(MINIKUBE_PROFILE )
1487+ @echo " \n📦 Addon status:" && minikube addons list | grep -E " $( subst $( space) ,| ,$( MINIKUBE_ADDONS) ) "
1488+ @echo " \n🚦 Ingress controller:" && kubectl get pods -n ingress-nginx -o wide || true
1489+ @echo " \n🔍 Dashboard:" && kubectl get pods -n kubernetes-dashboard -o wide || true
1490+ @echo " \n🧩 Services:" && kubectl get svc || true
1491+ @echo " \n🌐 Ingress:" && kubectl get ingress || true
14371492
1438- @echo "\n🌐 Application ingress:"
1439- kubectl get ingress || true
1493+ minikube-reset : minikube-delete minikube-start minikube-image-load minikube-k8s-apply minikube-status
1494+ @echo " ✅ Minikube reset complete! "
14401495
14411496# -----------------------------------------------------------------------------
14421497# 🛠️ HELM CHART TASKS
14431498# -----------------------------------------------------------------------------
14441499# help: 🛠️ HELM CHART TASKS
1500+ # help: helm-install - Install Helm 3 CLI
14451501# help: helm-lint - Lint the Helm chart (static analysis)
14461502# help: helm-package - Package the chart into dist/ as mcp-stack-<ver>.tgz
14471503# help: helm-deploy - Upgrade/Install chart into Minikube (profile mcpgw)
14481504# help: helm-delete - Uninstall the chart release from Minikube
14491505# -----------------------------------------------------------------------------
14501506
1451- .PHONY : helm-lint helm-package helm-deploy helm-delete
1507+ .PHONY : helm-install helm- lint helm-package helm-deploy helm-delete
14521508
14531509CHART_DIR ?= charts/mcp-stack
14541510RELEASE_NAME ?= mcp-stack
14551511NAMESPACE ?= mcp
14561512VALUES ?= $(CHART_DIR ) /values.yaml
14571513
1514+ helm-install :
1515+ @echo " 📦 Installing Helm CLI…"
1516+ @if [ " $( shell uname) " = " Darwin" ]; then \
1517+ brew install helm; \
1518+ elif [ " $( shell uname) " = " Linux" ]; then \
1519+ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash; \
1520+ elif command -v powershell.exe > /dev/null; then \
1521+ powershell.exe -NoProfile -Command " choco install -y kubernetes-helm" ; \
1522+ else \
1523+ echo " ❌ Unsupported OS. Install Helm manually ↗" ; exit 1; \
1524+ fi
1525+
14581526helm-lint :
14591527 @echo " 🔍 Helm lint..."
14601528 helm lint $(CHART_DIR )
0 commit comments