Skip to content

Latest commit

 

History

History
159 lines (110 loc) · 4.85 KB

File metadata and controls

159 lines (110 loc) · 4.85 KB

Setup Guide

This guide covers setting up a HyperFleet environment for running E2E tests locally.

Table of Contents

Deployment Options

Clone the infrastructure repository:

git clone https://github.com/openshift-hyperfleet/hyperfleet-infra/
cd hyperfleet-infra/terraform

Choose one of the following deployment options based on your needs:

  • Kind (local): Fast setup, no cloud dependencies, uses port-forwarding
  • GCP: Cloud environment, requires GCP access, slower setup, uses LoadBalancer services

Option 1: Kind (Local)

1. Deploy HyperFleet to Kind cluster:

# option 1: Export namespace and helmfile env
export NAMESPACE=<your-dev-namespace> ; export HELMFILE_ENV=e2e-kind ; make local-up-kind
# option 2: Set in command line
NAMESPACE=<your-dev-namespace> HELMFILE_ENV=e2e-kind make local-up-kind

2. Set up port-forwarding in two separate terminals:

# Terminal 1 - Port-forward Maestro API
export MAESTRO_LOCAL_PORT=8100
kubectl port-forward -n maestro svc/maestro ${MAESTRO_LOCAL_PORT}:8000

# Terminal 2 - Port-forward HyperFleet API
export API_LOCAL_PORT=8000
kubectl port-forward -n ${NAMESPACE} svc/hyperfleet-api ${API_LOCAL_PORT}:8000

3. Configure environment variables:

export MAESTRO_URL=http://localhost:${MAESTRO_LOCAL_PORT}
export HYPERFLEET_API_URL=http://localhost:${API_LOCAL_PORT}
export NAMESPACE=<your-dev-namespace>

4. Verify deployment:

# Check Helm releases
helm list -n ${NAMESPACE}

# Verify all pods are running
kubectl get pods -n ${NAMESPACE}

# Test API connectivity
curl -f -X GET ${HYPERFLEET_API_URL}/api/hyperfleet/v1/clusters/

Option 2: GCP

1. Deploy HyperFleet to GCP cluster:

Note: Make sure your terraform files are up to date. See hyperfleet-infra/CONTRIBUTING.md for details.

  • terraform/envs/gke/dev.tfbackend
  • terraform/envs/gke/dev.tfvars

See hyperfleet-infra/README.md for infrastructure deployment details.

# option 1: Export namespace and helmfile env
export NAMESPACE=<your-dev-namespace> ; export HELMFILE_ENV=e2e-gcp ; make local-up-gcp
# option 2: Set in command line
NAMESPACE=<your-dev-namespace> HELMFILE_ENV=e2e-gcp make local-up-gcp

2. Expose Maestro service via LoadBalancer:

# Patch Maestro service to expose external IP
kubectl patch svc maestro -n maestro -p '{"spec":{"type":"LoadBalancer"}}'

# Wait for external IPs to be assigned (may take 1-2 minutes)
kubectl get svc maestro -n maestro -w
kubectl get svc hyperfleet-api -n ${NAMESPACE} -w

3. Configure environment variables:

export API_EXTERNAL_IP=$(kubectl get svc hyperfleet-api -n ${NAMESPACE} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export MAESTRO_EXTERNAL_IP=$(kubectl get svc maestro -n maestro -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export HYPERFLEET_API_URL=http://${API_EXTERNAL_IP}:8000
export MAESTRO_URL=http://${MAESTRO_EXTERNAL_IP}:8000
export NAMESPACE=<your-dev-namespace>

4. Verify deployment:

# Check Helm releases
helm list -n ${NAMESPACE}

# Verify all pods are running
kubectl get pods -n ${NAMESPACE}

# Test API connectivity
curl -f -X GET ${HYPERFLEET_API_URL}/api/hyperfleet/v1/clusters/

Configure Test Settings

Override Image Settings (Optional)

If your deployment uses custom image settings, update env/env.local in this repo to match your infrastructure deployment settings:

  • Kind deployments: Match settings from env.kind
  • GCP deployments: Match settings from env.gcp

Update env/env.local:

# env/env.local
export IMAGE_REGISTRY=<registry>
export <COMPONENT>_IMAGE_REPO=<repo>
export <COMPONENT>_IMAGE_TAG=<tag>

Source the configuration:

source env/env.local

This configuration is required for running tier2 tests.

Troubleshooting

Infrastructure Setup Issues

For additional help with infrastructure deployment and configuration, see:

For test-specific troubleshooting (timeouts, API errors, namespace mismatches), see the Runbook Troubleshooting section.


Next Steps: Once your environment is set up, see the Runbook for running tests and troubleshooting.