Setting up the Development Environment
Environment Setup
Prerequisites
Developing on Gloo Gateway requires the following to be installed on your system:
Make
Git
Go
(solo-io
projects are built using version1.23.3
)Protoc
(solo-io
projects are built using version3.6.1
)- Standard development tools like
gcc
To install all the requirements, do the following:
# install build tools
# - macOS
xcode-select --install
# - other operating systems:
# distro meta-packages, like "build-essential", should have what is required
############################################
# install version of go in go.mod
############################################
# - macOS:
brew install go@1.23
# - other operating systems:
# follow directions at https://go.dev/doc/install
# install protoc
make install-protoc
# install go related tools
make install-go-tools
Setting up the Gloo Gateway repositories
Next, we’ll clone the Gloo Gateway and Solo-Kit source code. Solo-Kit is required for code generation in Gloo Gateway.
To clone the repository:
git clone https://github.com/solo-io/gloo
# or with SSH
git clone git@github.com:solo-io/gloo.git
To run the main.go
files locally in your system make sure to have a Kubernetes Cluster
running.
You should now be able to run any main.go
file in the Gloo Gateway repository using:
go run <path-to-cmd>/main.go
For example:
# run gloo locally
go run projects/gloo/cmd/main.go
# run discovery locally
go run projects/discovery/cmd/main.go
# run gateway locally
go run projects/gateway/cmd/main.go
Awesome! You’re ready to start developing on Gloo Gateway! Check out the Writing Upstream Plugins Guide to see how to add plugins to gloo.
Developing with a local K8s cluster (kind)
Developers without a K8s cluster are encouraged to use Docker and Kind to build a development and test environment.
Prerequisites: Install the following tools:
Install Gloo Gateway on a Kind cluster so that you can start making changes to the Gloo Gateway code.
# Prepare the kind cluster, build images, and upload them.
make kind-setup
# Install Gloo Gateway
helm upgrade --install -n gloo-system --create-namespace gloo ./_test/gloo-1.0.1-dev.tgz --values ./test/kubernetes/e2e/tests/manifests/common-recommendations.yaml
############################################
# Make changes to the code in the Gloo Gateway repo.
############################################
# Update the Gloo Gateway installation in your cluster to apply your changes
make -B kind-build-and-load-gloo
Code Generation
Follow these steps to make changes to Gloo Gateway’s Protobuf-based API.
Confirm code generation works with Gloo Gateway:
make -B generated-code
echo $?
The echo
output should be 0
if everything worked correctly.