An agent for collecting vSphere inventory data and reporting to the Migration Planner console.
make buildThis produces the binary at bin/agent.
bin/agent run --agent-id <uuid> --source-id <uuid> --opa-policies-folder <path>Required flags:
--agent-idand--source-idmust be valid UUIDs--opa-policies-foldermust point to a directory containing OPA policy files for VM validation
Run in disconnected mode (default):
bin/agent run \
--agent-id 550e8400-e29b-41d4-a716-446655440000 \
--source-id 6ba7b810-9dad-11d1-80b4-00c04fd430c8 \
--opa-policies-folder /path/to/policiesRun in connected mode with authentication:
bin/agent run \
--agent-id 550e8400-e29b-41d4-a716-446655440000 \
--source-id 6ba7b810-9dad-11d1-80b4-00c04fd430c8 \
--opa-policies-folder /path/to/policies \
--mode connected \
--authentication-enabled \
--authentication-jwt-filepath /path/to/jwtRun in production mode with persistent storage:
bin/agent run \
--agent-id 550e8400-e29b-41d4-a716-446655440000 \
--source-id 6ba7b810-9dad-11d1-80b4-00c04fd430c8 \
--opa-policies-folder /var/lib/agent/policies \
--server-mode prod \
--server-statics-folder /var/www/statics \
--data-folder /var/lib/agent| Flag | Default | Description |
|---|---|---|
--agent-id |
required | Unique identifier (UUID) for this agent |
--source-id |
required | Source identifier (UUID) for this agent |
--mode |
disconnected |
connected | disconnected |
--data-folder |
— | Path to persistent data folder (uses in-memory if not set) |
--opa-policies-folder |
required | Path to OPA policies folder for VM validation |
--num-workers |
3 |
Number of scheduler workers |
--version |
v0.0.0 |
Agent version to report to console |
--legacy-status-enabled |
true |
Use legacy status like waiting-for-credentials |
--server-http-port |
8000 |
HTTP server port |
--server-mode |
dev |
dev | prod (prod enables HTTPS with self-signed certs) |
--server-statics-folder |
— | Path to static files (required when --server-mode=prod) |
--console-url |
http://localhost:7443 |
Migration planner console URL |
--console-update-interval |
5s |
Status update interval |
--authentication-enabled |
true |
Enable console authentication |
--authentication-jwt-filepath |
— | Path to JWT file (required when --authentication-enabled) |
--log-format |
console |
console | json |
--log-level |
debug |
debug | info | warn | error |
Run tests:
make testRun linter:
make lintFormat code:
make formatRun all validations:
make validate-allE2E tests require a built agent container image. Before running tests, build the latest image:
make image| Target | Description |
|---|---|
make e2e |
Run e2e tests (default: container mode) |
make e2e.container |
Run e2e tests in container mode using Podman |
make e2e.vm |
Run e2e tests in VM mode (infrastructure managed externally) |
make e2e.container.clean |
Remove all e2e test containers and volumes |
| Flag | Default | Description |
|---|---|---|
-infra-mode |
container |
Infrastructure mode: container (Podman) or vm (externally managed) |
-agent-image |
— | Agent container image to test |
-backend-image |
— | Backend container image (migration-planner-api) |
-backend-agent-endpoint |
http://localhost:7443 |
Agent endpoint on backend (port 7443) |
-backend-user-endpoint |
http://localhost:3443 |
User endpoint on backend (port 3443) |
-agent-proxy-url |
http://localhost:8080 |
Agent proxy URL |
-agent-api-url |
https://localhost:8000 |
Agent local API URL |
-podman-socket |
unix:///run/user/1000/podman/podman.sock |
Podman socket path |
-iso-path |
— | Path to directory containing rhcos-live-iso.x86_64.iso |
Containers are automatically kept running when tests fail, allowing you to inspect logs and debug issues. Use make e2e.container.clean to remove them after debugging.
| Variable | Default | Description |
|---|---|---|
E2E_AGENT_IMAGE |
quay.io/kubev2v/assisted-migration-agent:latest |
Agent image to use |
E2E_BACKEND_IMAGE |
quay.io/kubev2v/migration-planner-api:latest |
Backend image to use |
E2E_ISO_PATH |
Current directory | Path containing the RHCOS ISO |
E2E_INFRA_MODE |
container |
Infrastructure mode |
Run e2e tests with a custom agent image:
make image
E2E_AGENT_IMAGE=quay.io/myrepo/agent:dev make e2eClean up after failed tests:
make e2e.container.cleanTo test the agent against the staging backend, you need to generate a JWT token and run the agent with authentication enabled.
Use the migration-planner CLI to generate a JWT:
../migration-planner/bin/planner sso token \
--org 12345678 \
--private-key ./privatekey \
--username your-username \
--source-id <source-uuid> \
--kid <key-id> > ./jwtThe --agent-id can be any valid UUID. Generate one with uuidgen.
bin/agent run \
--legacy-status-enabled \
--agent-id $(uuidgen) \
--source-id <source-uuid> \
--opa-policies-folder ./policies \
--data-folder . \
--authentication-enabled \
--authentication-jwt-filepath ./jwt \
--console-url https://console.stage.redhat.com/api/migration-assessment/