Skip to content

Commit 634eac2

Browse files
committed
Add gitops ArgoCD targets
Signed-off-by: Mihai Criveti <[email protected]>
1 parent 1f641e7 commit 634eac2

File tree

1 file changed

+76
-7
lines changed

1 file changed

+76
-7
lines changed

Makefile

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,19 +1549,88 @@ helm-delete:
15491549
@echo "🗑 Deleting $(RELEASE_NAME) release..."
15501550
helm uninstall $(RELEASE_NAME) -n $(NAMESPACE) || true
15511551

1552+
1553+
# =============================================================================
1554+
# 🚢 ARGO CD – GITOPS
1555+
# TODO: change default to custom namespace (e.g. mcp-gitops)
1556+
# =============================================================================
1557+
# help: 🚢 ARGO CD – GITOPS
1558+
# help: argocd-cli-install - Install Argo CD CLI locally
1559+
# help: argocd-install - Install Argo CD into Minikube (ns=$(ARGOCD_NS))
1560+
# help: argocd-password - Echo initial admin password
1561+
# help: argocd-forward - Port-forward API/UI to http://localhost:$(ARGOCD_PORT)
1562+
# help: argocd-login - Log in to Argo CD CLI (requires argocd-forward)
1563+
# help: argocd-app-bootstrap - Create & auto-sync $(ARGOCD_APP) from $(GIT_REPO)/$(GIT_PATH)
1564+
# help: argocd-app-sync - Manual re-sync of the application
1565+
# -----------------------------------------------------------------------------
1566+
1567+
ARGOCD_NS ?= argocd
1568+
ARGOCD_PORT ?= 8083
1569+
ARGOCD_APP ?= mcp-gateway
1570+
GIT_REPO ?= https://github.com/ibm/mcp-context-forge.git
1571+
GIT_PATH ?= k8s
1572+
1573+
.PHONY: argocd-cli-install argocd-install argocd-password argocd-forward \
1574+
argocd-login argocd-app-bootstrap argocd-app-sync
1575+
1576+
argocd-cli-install:
1577+
@echo "🔧 Installing Argo CD CLI…"
1578+
@if command -v argocd >/dev/null 2>&1; then echo "✅ argocd already present"; \
1579+
elif [ "$$(uname)" = "Darwin" ]; then brew install argocd; \
1580+
elif [ "$$(uname)" = "Linux" ]; then curl -sSL -o /tmp/argocd \
1581+
https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 && \
1582+
sudo install -m 555 /tmp/argocd /usr/local/bin/argocd; \
1583+
else echo "❌ Unsupported OS – install argocd manually"; exit 1; fi
1584+
1585+
argocd-install:
1586+
@echo "🚀 Installing Argo CD into Minikube…"
1587+
kubectl create namespace $(ARGOCD_NS) --dry-run=client -o yaml | kubectl apply -f -
1588+
kubectl apply -n $(ARGOCD_NS) \
1589+
-f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
1590+
@echo "⏳ Waiting for Argo CD server pod…"
1591+
kubectl -n $(ARGOCD_NS) rollout status deploy/argocd-server
1592+
1593+
argocd-password:
1594+
@kubectl -n $(ARGOCD_NS) get secret argocd-initial-admin-secret \
1595+
-o jsonpath='{.data.password}' | base64 -d ; echo
1596+
1597+
argocd-forward:
1598+
@echo "🌐 Port-forward http://localhost:$(ARGOCD_PORT) → svc/argocd-server:443 (Ctrl-C to stop)…"
1599+
kubectl -n $(ARGOCD_NS) port-forward svc/argocd-server $(ARGOCD_PORT):443
1600+
1601+
argocd-login: argocd-cli-install
1602+
@echo "🔐 Logging into Argo CD CLI…"
1603+
@PASS=$$(kubectl -n $(ARGOCD_NS) get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d); \
1604+
argocd login localhost:$(ARGOCD_PORT) --username admin --password $$PASS --insecure
1605+
1606+
argocd-app-bootstrap:
1607+
@echo "🚀 Creating Argo CD application $(ARGOCD_APP)"
1608+
-argocd app create $(ARGOCD_APP) \
1609+
--repo $(GIT_REPO) \
1610+
--path $(GIT_PATH) \
1611+
--dest-server https://kubernetes.default.svc \
1612+
--dest-namespace default \
1613+
--sync-policy automated \
1614+
--revision HEAD || true
1615+
argocd app sync $(ARGOCD_APP)
1616+
1617+
argocd-app-sync:
1618+
@echo "🔄 Syncing Argo CD application $(ARGOCD_APP)"
1619+
argocd app sync $(ARGOCD_APP)
1620+
15521621
# =============================================================================
15531622
# 🏠 LOCAL PYPI SERVER
15541623
# Currently blocked by: https://github.com/pypiserver/pypiserver/issues/630
15551624
# =============================================================================
15561625
# help: 🏠 LOCAL PYPI SERVER
1557-
# help: local-pypi-install - Install pypiserver for local testing
1558-
# help: local-pypi-start - Start local PyPI server on :8084 (no auth)
1559-
# help: local-pypi-start-auth - Start local PyPI server with basic auth (admin/admin)
1560-
# help: local-pypi-stop - Stop local PyPI server
1561-
# help: local-pypi-upload - Upload existing package to local PyPI (no auth)
1626+
# help: local-pypi-install - Install pypiserver for local testing
1627+
# help: local-pypi-start - Start local PyPI server on :8084 (no auth)
1628+
# help: local-pypi-start-auth - Start local PyPI server with basic auth (admin/admin)
1629+
# help: local-pypi-stop - Stop local PyPI server
1630+
# help: local-pypi-upload - Upload existing package to local PyPI (no auth)
15621631
# help: local-pypi-upload-auth - Upload existing package to local PyPI (with auth)
1563-
# help: local-pypi-test - Install package from local PyPI
1564-
# help: local-pypi-clean - Full cycle: build → upload → install locally
1632+
# help: local-pypi-test - Install package from local PyPI
1633+
# help: local-pypi-clean - Full cycle: build → upload → install locally
15651634

15661635
.PHONY: local-pypi-install local-pypi-start local-pypi-start-auth local-pypi-stop local-pypi-upload \
15671636
local-pypi-upload-auth local-pypi-test local-pypi-clean

0 commit comments

Comments
 (0)