diff --git a/.cursor/prompts/check-versions.md b/.cursor/prompts/check-versions.md index 61270b2..99c7f36 100644 --- a/.cursor/prompts/check-versions.md +++ b/.cursor/prompts/check-versions.md @@ -11,7 +11,7 @@ Query running DCM containers and resolve their image digests to git commit SHAs. ### Custom deploy directory ```bash -./scripts/deploy-dcm.sh --api-gateway-dir /path/to/deploy --running-versions +./scripts/deploy-dcm.sh --control-plane-dir /path/to/deploy --running-versions ``` ## Prerequisites @@ -25,7 +25,7 @@ Writes `dcm-versions.json` to the current directory. Example: ```json { - "quay.io/dcm-project/catalog-manager:latest": { + "quay.io/dcm-project/control-plane:latest": { "image_digest": "sha256:1cdf5482f586...", "git_sha": "2388248" }, diff --git a/.cursor/prompts/deploy-dcm.md b/.cursor/prompts/deploy-dcm.md index 6a3bb82..6cfb2da 100644 --- a/.cursor/prompts/deploy-dcm.md +++ b/.cursor/prompts/deploy-dcm.md @@ -23,23 +23,23 @@ Deploy the full DCM stack for E2E testing using `scripts/deploy-dcm.sh`. # Auto-resolve the latest semver tag from Quay.io ./scripts/deploy-dcm.sh --version release -# Explicit version with a custom api-gateway branch -./scripts/deploy-dcm.sh --version v0.1.0-rc.1 --api-gateway-branch my-branch +# Explicit version with a custom control-plane branch +./scripts/deploy-dcm.sh --version v0.1.0-rc.1 --control-plane-branch my-branch ``` ### Deploy from a Different Branch ```bash -./scripts/deploy-dcm.sh --api-gateway-branch feature-x +./scripts/deploy-dcm.sh --control-plane-branch feature-x ``` ### Deploy from a Fork ```bash -./scripts/deploy-dcm.sh --api-gateway-repo https://github.com/myfork/api-gateway.git +./scripts/deploy-dcm.sh --control-plane-repo https://github.com/myfork/control-plane.git ``` ### Deploy to a Custom Directory ```bash -./scripts/deploy-dcm.sh --api-gateway-dir /tmp/my-dcm-deploy +./scripts/deploy-dcm.sh --control-plane-dir /tmp/my-dcm-deploy ``` ### Deploy with Auto-Cleanup on Failure @@ -90,9 +90,9 @@ When any service provider is enabled, the script resolves cluster access in this | Variable | Flag equivalent | |----------|----------------| | `DCM_VERSION` | `--version` | -| `API_GATEWAY_REPO` | `--api-gateway-repo` | -| `API_GATEWAY_BRANCH` | `--api-gateway-branch` | -| `API_GATEWAY_TMP_DIR` | `--api-gateway-dir` | +| `CONTROL_PLANE_REPO` | `--control-plane-repo` | +| `CONTROL_PLANE_BRANCH` | `--control-plane-branch` | +| `CONTROL_PLANE_TMP_DIR` | `--control-plane-dir` | | `KUBECONFIG` | `--kubeconfig` | | `KUBEVIRT_VM_NAMESPACE` | `--kubevirt-vm-namespace` | | `K8S_CONTAINER_SP_NAMESPACE` | `--k8s-container-namespace` | @@ -104,14 +104,14 @@ Flags take precedence over environment variables. ## What Happens -1. Clones api-gateway (owns `compose.yaml`) +1. Clones control-plane (`deploy/compose.yaml`) 2. Runs `podman-compose up -d` 3. Verifies all containers are running -4. Polls `/api/v1alpha1/health/*` endpoints (90s timeout) +4. Polls `/api/v1alpha1/health` (90s timeout) 5. Resolves container images to git commit SHAs via Quay.io API 6. Writes `dcm-versions.json` ## Output -- Stack available at `http://localhost:9080` +- Stack available at `http://localhost:8080` - Version info written to `dcm-versions.json` diff --git a/.cursor/prompts/tear-down.md b/.cursor/prompts/tear-down.md index 620fa38..ad1d8a7 100644 --- a/.cursor/prompts/tear-down.md +++ b/.cursor/prompts/tear-down.md @@ -11,7 +11,7 @@ Stop and clean up a running DCM deployment. ### Custom deploy directory ```bash -./scripts/deploy-dcm.sh --api-gateway-dir /path/to/deploy --tear-down +./scripts/deploy-dcm.sh --control-plane-dir /path/to/deploy --tear-down ``` ## What Happens diff --git a/.cursor/prompts/troubleshoot-deploy.md b/.cursor/prompts/troubleshoot-deploy.md index bef26df..c73e90e 100644 --- a/.cursor/prompts/troubleshoot-deploy.md +++ b/.cursor/prompts/troubleshoot-deploy.md @@ -51,35 +51,28 @@ oc get crd virtualmachines.kubevirt.io ### Containers fail to start ```bash # Check container status -podman-compose -f /tmp/dcm-e2e/compose.yaml ps +podman-compose -f /tmp/dcm-e2e/deploy/compose.yaml ps # View logs for a failing service -podman-compose -f /tmp/dcm-e2e/compose.yaml logs --tail=50 +podman-compose -f /tmp/dcm-e2e/deploy/compose.yaml logs --tail=50 # Check for port conflicts -podman ps --format '{{.Ports}}' | grep 9080 +podman ps --format '{{.Ports}}' | grep 8080 ``` ### Health check timeouts ```bash # Manual health check -curl -v http://localhost:9080/api/v1alpha1/health/providers +curl -v http://localhost:8080/api/v1alpha1/health -# All health endpoints -for ep in providers catalog policies placement; do - echo -n "$ep: " - curl -s -o /dev/null -w "%{http_code}" "http://localhost:9080/api/v1alpha1/health/$ep" - echo -done - -# Check gateway logs -podman-compose -f /tmp/dcm-e2e/compose.yaml logs --tail=50 api-gateway +# Check control-plane logs +podman-compose -f /tmp/dcm-e2e/deploy/compose.yaml logs --tail=50 control-plane ``` ### Compose file not found ```bash # Verify clone worked -ls -la /tmp/dcm-e2e/compose.yaml +ls -la /tmp/dcm-e2e/deploy/compose.yaml # Re-deploy (cleans and re-clones) ./scripts/deploy-dcm.sh @@ -87,8 +80,8 @@ ls -la /tmp/dcm-e2e/compose.yaml ### Port already in use ```bash -# Find what's using port 9080 -lsof -i :9080 +# Find what's using port 8080 +lsof -i :8080 # Tear down and redeploy ./scripts/deploy-dcm.sh --tear-down @@ -99,13 +92,13 @@ lsof -i :9080 ```bash # All container status -podman-compose -f /tmp/dcm-e2e/compose.yaml ps +podman-compose -f /tmp/dcm-e2e/deploy/compose.yaml ps # Recent container logs (all services) -podman-compose -f /tmp/dcm-e2e/compose.yaml logs --tail=20 +podman-compose -f /tmp/dcm-e2e/deploy/compose.yaml logs --tail=20 # Specific service logs -podman-compose -f /tmp/dcm-e2e/compose.yaml logs --tail=50 +podman-compose -f /tmp/dcm-e2e/deploy/compose.yaml logs --tail=50 # Container resource usage podman stats --no-stream diff --git a/.cursor/rules/deploy-script.mdc b/.cursor/rules/deploy-script.mdc index c34b12a..433c274 100644 --- a/.cursor/rules/deploy-script.mdc +++ b/.cursor/rules/deploy-script.mdc @@ -13,7 +13,7 @@ See `CLAUDE.md` → "Key Script: scripts/deploy-dcm.sh" for the full description - New functions go above the argument parsing section - New flags need entries in both `usage()` and the `while/case` loop - Add corresponding environment variable overrides where appropriate -- Compose variable names (`KUBEVIRT_KUBECONFIG`, `K8S_CONTAINER_SP_KUBECONFIG`, etc.) are owned by api-gateway's compose.yaml — see the contract comment at the top of the script +- Compose variable names (`KUBEVIRT_KUBECONFIG`, `K8S_CONTAINER_SP_KUBECONFIG`, etc.) are owned by control-plane's `deploy/compose.yaml` — see the contract comment at the top of the script - Run `shellcheck scripts/deploy-dcm.sh` after changes ## Podman / Compose diff --git a/.cursor/rules/e2e-tests.mdc b/.cursor/rules/e2e-tests.mdc index a0f5c41..66891b2 100644 --- a/.cursor/rules/e2e-tests.mdc +++ b/.cursor/rules/e2e-tests.mdc @@ -12,11 +12,11 @@ Files follow `{layer}_{subject}_test.go` with a matching `{layer}_helpers_test.g | Prefix | Interface | Helpers | |--------|-----------|---------| -| `api_` | Gateway HTTP API (`doRequest` → `localhost:9080`) | `api_helpers_test.go` | +| `api_` | Control plane HTTP API (`doRequest` → `localhost:8080`) | `api_helpers_test.go` | | `cli_` | CLI binary (`runDCM` → `os/exec`) | `cli_helpers_test.go` | | `sp_container_` | Container SP direct API + NATS (`doContainerSPRequest` → `localhost:8082`) | `sp_helpers_test.go` | | `sp_acm_cluster_` | ACM Cluster SP direct API (`doAcmClusterSPRequest` → `localhost:8083`) | `sp_acm_cluster_helpers_test.go` | -| `core_` | Cross-service provisioning flow via gateway (`doRequest`) | `api_helpers_test.go`, `sp_helpers_test.go` | +| `core_` | Cross-service provisioning flow via control plane (`doRequest`) | `api_helpers_test.go`, `sp_helpers_test.go` | When adding a new service provider, add `sp_{provider}_{concern}_test.go` (e.g. `sp_kubevirt_api_test.go`). Each provider gets its own helpers file (`sp_{provider}_helpers_test.go`). Shared infrastructure (kubectl, podman, NATS collector) stays in `sp_helpers_test.go`. @@ -37,7 +37,7 @@ When adding a new service provider, add `sp_{provider}_{concern}_test.go` (e.g. ## Environment Variables | Variable | Default | Purpose | |----------|---------|---------| -| `DCM_GATEWAY_URL` | `http://localhost:9080/api/v1alpha1` | Gateway API | +| `DCM_GATEWAY_URL` | `http://localhost:8080/api/v1alpha1` | Control plane API | | `DCM_CONTAINER_SP_URL` | `http://localhost:8082/api/v1alpha1` | Container SP direct API | | `DCM_ACM_CLUSTER_SP_URL` | `http://localhost:8083/api/v1alpha1` | ACM Cluster SP direct API | | `DCM_NATS_URL` | `nats://localhost:4222` | NATS for status events | diff --git a/.github/workflows/validate-scripts.yaml b/.github/workflows/validate-scripts.yaml index e467897..f643718 100644 --- a/.github/workflows/validate-scripts.yaml +++ b/.github/workflows/validate-scripts.yaml @@ -94,8 +94,8 @@ jobs: run_case "--help contains core flags" \ --expect-exit "--help" 0 \ - --expect-contains "--api-gateway-repo" "api-gateway-repo flag" \ - --expect-contains "--api-gateway-branch" "api-gateway-branch flag" \ + --expect-contains "--control-plane-repo" "control-plane-repo flag" \ + --expect-contains "--control-plane-branch" "control-plane-branch flag" \ --expect-contains "--kubeconfig" "kubeconfig flag" \ --expect-contains "--compose-file" "compose-file flag" \ --expect-contains "--cleanup-on-failure" "cleanup-on-failure flag" \ @@ -133,8 +133,8 @@ jobs: run_case "--kubeconfig requires a value" \ --expect-exit "--kubeconfig" 1 - run_case "--api-gateway-repo requires a value" \ - --expect-exit "--api-gateway-repo" 1 + run_case "--control-plane-repo requires a value" \ + --expect-exit "--control-plane-repo" 1 run_case "--compose-file requires a value" \ --expect-exit "--compose-file" 1 diff --git a/CLAUDE.md b/CLAUDE.md index bedd5eb..36a14ef 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -26,9 +26,9 @@ CI runs ShellCheck on changed `*.sh` files via `.github/workflows/lint.yaml` (on ## Key Script: `scripts/deploy-dcm.sh` -Deploys the full DCM stack for E2E testing by cloning api-gateway (which owns `compose.yaml`), running `podman-compose up`, and polling health endpoints until all services respond 2xx. +Deploys the full DCM stack for E2E testing by cloning control-plane (`deploy/compose.yaml`), running `podman-compose up`, and polling health endpoints until all services respond 2xx. -**Flow:** clone api-gateway → `podman-compose up -d` → verify containers running → poll `/api/v1alpha1/health/*` endpoints → collect container versions from Quay.io API → write `dcm-versions.json`. +**Flow:** clone control-plane → `podman-compose up -d` → verify containers running → poll `/api/v1alpha1/health` → collect container versions from Quay.io API → write `dcm-versions.json`. **Modes:** The script has three mutually exclusive modes: - **Deploy** (default): full clone + bring-up + health check. Pass `--cleanup-on-failure` to auto-teardown on error (default leaves partial state for debugging). @@ -40,7 +40,7 @@ Deploys the full DCM stack for E2E testing by cloning api-gateway (which owns `c - `--version v0.1.0-rc.1` — pin all images to an explicit tag - `--version release` — auto-resolve the latest semver tag from Quay.io -When a non-main version is specified, `--api-gateway-branch` is auto-derived to the corresponding release branch (e.g. `v0.1.0-rc.1` → `release/v0.1.0`) unless explicitly passed. +When a non-main version is specified, `--control-plane-branch` is auto-derived to the corresponding release branch (e.g. `v0.1.0-rc.1` → `release/v0.1.0`) unless explicitly passed. **Service providers:** Configured via `providers/*.conf` files (see "Provider Registry" below). Enable with `--