epic-gateway / dev-test-environment

Scripts and Vagrant/Ansible config to set up a local EPIC Gateway environment for development and test.
https://www.epic-gateway.org/
2 stars 0 forks source link
ansible developer-tools development-environment vagrant

EPIC Gateway Development/Test Environment

This project provides scripts to install and configure EPIC Gateway development/test environments. There are two environments:

Prerequisites

Vagrant and libvirt manage the virtual machines so you'll need to ensure that both are installed and configured for your operating system. Vagrant uses Ansible to configure the virtual machines that it creates.

Hint: on a recent Debian or Ubuntu system this command will install the tools that you need:

# apt-get update && apt-get install -y git ansible vagrant-libvirt qemu-kvm

Setup

$ git clone https://github.com/epic-gateway/dev-test-environment.git
$ cd dev-test-environment
$ vagrant up          # create/configure the VMs

This clones the repo, creates two VMs called gateway and gwclient, installs a Kubernetes cluster on each of them, installs the EPIC Gateway on gateway, and installs our Kubernetes Gateway API implementation on gwclient.

Use

The gateway VM runs the EPIC Gateway cluster. You can use vagrant ssh to access it. For example:

$ vagrant ssh gateway -- kubectl get nodes
NAME           STATUS   ROLES                  AGE   VERSION
epic-gateway   Ready    control-plane,master   31m   v1.23.5

gwclient runs the EPIC Gateway client. You can use vagrant ssh to access it. For example:

$ vagrant ssh gwclient -- kubectl get gatewayclassconfig gwdev-http4 -oyaml
apiVersion: puregw.epic-gateway.org/v1
kind: GatewayClassConfig

  ... etc etc ...

status:
  conditions:
  - lastTransitionTime: "2023-10-26T17:06:23Z"
    message: EPIC connection succeeded
    observedGeneration: 1
    reason: Valid
    status: "True"
    type: Accepted

The status from the previous command should contain a condition with the message EPIC connection succeeded. This means that the Gateway client is able to communicate with the Gateway server.

Creating a Gateway is a good next step:

$ vagrant ssh gwclient -- kubectl apply -f - < files/gateway_v1a2_gateway-devtest.yaml
deployment.apps/devtest created
service/devtest created
gateway.gateway.networking.k8s.io/devtest created
httproute.gateway.networking.k8s.io/devtest-1 created

Now you can check the status of the gateway:

$ vagrant ssh gwclient -- kubectl get gateways devtest
NAME      CLASS         ADDRESS        READY   AGE
devtest   gwdev-http4   192.168.77.2   True    93s

If your gateway is ready you can make an http request to the gateway address. EPIC will proxy the request to the client which is running an http echo server:

$ vagrant ssh gateway -- curl -s 192.168.77.2/get
{
  "args": {},
  "headers": {
    "Accept": [
      "*/*"
    ],
    "Host": [
      "192.168.77.2"
    ],

  ... etc etc ...

  "method": "GET",
  "origin": "192.168.121.83",
  "url": "http://192.168.77.2/get"
}