@@ -1329,132 +1329,200 @@ ibmcloud-ce-rm:
1329
1329
# =============================================================================
1330
1330
# 🧪 MINIKUBE LOCAL CLUSTER
1331
1331
# =============================================================================
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
+ # -----------------------------------------------------------------------------
1332
1377
# 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)
1341
1391
1342
1392
.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
1344
1395
1396
+ # -----------------------------------------------------------------------------
1397
+ # 🚀 INSTALLATION HELPERS
1398
+ # -----------------------------------------------------------------------------
1345
1399
minikube-install :
1346
1400
@echo " 💻 Detecting OS and installing Minikube + kubectl…"
1347
- @if [ " $$ (uname)" = " Darwin" ]; then \
1348
- echo " 🍎 Installing via Homebrew…" ; \
1401
+ @if [ " $( shell uname) " = " Darwin" ]; then \
1349
1402
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" && \
1357
1407
chmod +x kubectl && sudo mv kubectl /usr/local/bin/; \
1358
1408
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" ; \
1374
1410
else \
1375
- echo " ❌ Unsupported OS. Please install Helm manually." ; \
1376
- exit 1; \
1411
+ echo " ❌ Unsupported OS. Install manually ↗" ; exit 1; \
1377
1412
fi
1378
1413
1414
+ # -----------------------------------------------------------------------------
1415
+ # ⏯ LIFECYCLE COMMANDS
1416
+ # -----------------------------------------------------------------------------
1379
1417
minikube-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
1389
1426
1390
1427
minikube-stop :
1391
- @echo " 🛑 Stopping Minikube cluster... "
1392
- minikube stop -p mcpgw
1428
+ @echo " 🛑 Stopping Minikube … "
1429
+ minikube stop -p $( MINIKUBE_PROFILE )
1393
1430
1394
1431
minikube-delete :
1395
- @echo " 🗑 Deleting Minikube cluster... "
1396
- minikube delete -p mcpgw
1432
+ @echo " 🗑 Deleting Minikube profile ' $( MINIKUBE_PROFILE ) ' … "
1433
+ minikube delete -p $( MINIKUBE_PROFILE )
1397
1434
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
+ # -----------------------------------------------------------------------------
1398
1462
minikube-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; \
1403
1466
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 )
1407
1468
1408
1469
minikube-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
1421
1472
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."
1434
1481
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
1437
1492
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! "
1440
1495
1441
1496
# -----------------------------------------------------------------------------
1442
1497
# 🛠️ HELM CHART TASKS
1443
1498
# -----------------------------------------------------------------------------
1444
1499
# help: 🛠️ HELM CHART TASKS
1500
+ # help: helm-install - Install Helm 3 CLI
1445
1501
# help: helm-lint - Lint the Helm chart (static analysis)
1446
1502
# help: helm-package - Package the chart into dist/ as mcp-stack-<ver>.tgz
1447
1503
# help: helm-deploy - Upgrade/Install chart into Minikube (profile mcpgw)
1448
1504
# help: helm-delete - Uninstall the chart release from Minikube
1449
1505
# -----------------------------------------------------------------------------
1450
1506
1451
- .PHONY : helm-lint helm-package helm-deploy helm-delete
1507
+ .PHONY : helm-install helm- lint helm-package helm-deploy helm-delete
1452
1508
1453
1509
CHART_DIR ?= charts/mcp-stack
1454
1510
RELEASE_NAME ?= mcp-stack
1455
1511
NAMESPACE ?= mcp
1456
1512
VALUES ?= $(CHART_DIR ) /values.yaml
1457
1513
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
+
1458
1526
helm-lint :
1459
1527
@echo " 🔍 Helm lint..."
1460
1528
helm lint $(CHART_DIR )
0 commit comments