Skip to content

Latest commit

 

History

History
163 lines (107 loc) · 4.89 KB

quickstart.md

File metadata and controls

163 lines (107 loc) · 4.89 KB

Development Quickstart

This guide will assist you in setting up your development environment for NGINX Gateway Fabric, covering the steps to build, install, and execute tasks necessary for submitting pull requests. By following this guide, you'll have a fully prepared development environment that allows you to contribute to the project effectively.

Setup Your Development Environment

Follow these steps to set up your development environment.

  1. Install:

    brew install pre-commit

    and then run

    pre-commit install

    in the project root directory to install the git hooks.

  2. Fork the project repository

  3. Clone your repository, and install the project dependencies:

    git clone https://github.com/<YOUR-USERNAME>/nginx-gateway-fabric.git
    cd nginx-gateway-fabric
    make deps

Build the Binary and Image

Build the Binary

To build the binary, run the make build command from the project's root directory:

make build

This command will build the binary and output it to the /build/.out directory.

Build the Images

To build the NGINX Gateway Fabric and NGINX container images from source run the following make command:

make TAG=$(whoami) build-images

This will build the docker images nginx-gateway-fabric:<your-user> and nginx-gateway-fabric/nginx:<your-user>.

Deploy on Kind

  1. Create a kind cluster:

    make create-kind-cluster
  2. Load the previously built images onto your kind cluster:

    kind load docker-image nginx-gateway-fabric:$(whoami) nginx-gateway-fabric/nginx:$(whoami)
  3. Install Gateway API CRDs:

    kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/standard-install.yaml
  4. Install NGF using your custom image and expose NGF with a NodePort Service:

    • To install with Helm (where your release name is my-release):

      helm install my-release ./deploy/helm-chart --create-namespace --wait --set service.type=NodePort --set nginxGateway.image.repository=nginx-gateway-fabric --set nginxGateway.image.tag=$(whoami) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=nginx-gateway-fabric/nginx --set nginx.image.tag=$(whoami) --set nginx.image.pullPolicy=Never -n nginx-gateway

      For more information on helm configuration options see the Helm README.

    • To install with manifests:

      make generate-manifests HELM_TEMPLATE_COMMON_ARGS="--set nginxGateway.image.repository=nginx-gateway-fabric --set nginxGateway.image.tag=$(whoami) --set nginxGateway.image.pullPolicy=Never --set nginx.image.repository=nginx-gateway-fabric/nginx --set nginx.image.tag=$(whoami) --set nginx.image.pullPolicy=Never"
      kubectl apply -f deploy/manifests/crds
      kubectl apply -f deploy/manifests/nginx-gateway.yaml
      kubectl apply -f deploy/manifests/service/nodeport.yaml

Run Examples

To make sure NGF is running properly, try out the examples.

Run the Unit Tests

To run all the unit tests, run the make unit-test command from the project's root directory:

make unit-test

For more details on testing, see the testing documentation.

Gateway API Conformance Testing

To run Gateway API conformance tests, please follow the instructions on this page.

Run the Linter

To lint the code, run the following make command from the project's root directory:

make lint

Note fieldalignment errors can be fixed by running: fieldalignment -fix <path-to-package>

Run the Helm Linter

Run the following make command from the project's root directory to lint the Helm Chart code:

make lint-helm

Run go generate

To ensure all the generated code is up to date, run the following make command from the project's root directory:

make generate

Update Generated Manifests

To update the generated manifests, run the following make command from the project's root directory:

make generate-manifests