agones.dev/agones@v1.53.0/build/README.md (about)

     1  # Developing, Testing and Building Agones
     2  
     3  Tooling for building and developing against Agones, with only dependencies being
     4  [Make](https://www.gnu.org/software/make/) and [Docker](https://www.docker.com)
     5  
     6  Rather than installing all the dependencies locally, you can test and build Agones using the Docker image that is
     7  built from the Dockerfile in this directory. There is an accompanying Makefile for all the common
     8  tasks you may wish to accomplish.
     9  
    10  Table of Contents
    11  =================
    12  
    13    * [Building on Different Platforms](#building-on-different-platforms)
    14       * [Linux](#linux)
    15       * [Windows](#windows)
    16       * [macOS](#macos)
    17    * [Testing and Building](#testing-and-building)
    18       * [Running a Test Google Kubernetes Engine Cluster](#running-a-test-google-kubernetes-engine-cluster)
    19       * [Running a Test Minikube cluster](#running-a-test-minikube-cluster)
    20       * [Running a Test Kind cluster](#running-a-test-kind-cluster)
    21       * [Running a Custom Test Environment](#running-a-custom-test-environment)
    22       * [Common Development Flows](#common-development-flows)
    23       * [Set Local Make Targets and Variables with `local-includes`](#set-local-make-targets-and-variables-with-local-includes)
    24       * [Running Individual End-to-End Tests](#running-individual-end-to-end-tests)
    25    * [Make Variable Reference](#make-variable-reference)
    26       * [VERSION](#version)
    27       * [REGISTRY](#registry)
    28       * [KUBECONFIG](#kubeconfig)
    29       * [CLUSTER_NAME](#cluster_name)
    30       * [IMAGE_PULL_SECRET](#image_pull_secret)
    31       * [IMAGE_PULL_SECRET_FILE](#image_pull_secret_file)
    32       * [WITH_WINDOWS](#with_windows)
    33       * [WINDOWS_VERSIONS](#windows_versions)
    34       * [WITH_ARM64](#with_arm64)
    35    * [Make Target Reference](#make-target-reference)
    36       * [Development Targets](#development-targets)
    37          * [make build](#make-build)
    38          * [make build-images](#make-build-images)
    39          * [make build-sdks](#make-build-sdks)
    40          * [make build-sdk](#make-build-sdk)
    41          * [make run-sdk-command](#make-run-sdk-command)
    42          * [make run-sdk-conformance-tests](#make-run-sdk-conformance-tests)
    43          * [make clean-sdk-conformance-tests](#make-clean-sdk-conformance-tests)
    44          * [make test](#make-test)
    45          * [make test-go](#make-test-go)
    46          * [make lint](#make-lint)
    47          * [make push](#make-push)
    48          * [make install](#make-install)
    49          * [make uninstall](#make-uninstall)
    50          * [make test-e2e](#make-test-e2e)
    51          * [make test-e2e-integration](#make-test-e2e-integration)
    52          * [make test-e2e-failure](#make-test-e2e-failure)
    53          * [make setup-prometheus](#make-setup-prometheus)
    54          * [make setup-grafana](#make-setup-grafana)
    55          * [make setup-prometheus-stack](#make-setup-prometheus-stack)
    56          * [make prometheus-portforward](#make-prometheus-portforward)
    57          * [make grafana-portforward](#make-grafana-portforward)
    58          * [make controller-portforward](#make-controller-portforward)
    59          * [make pprof-cpu-web](#make-pprof-cpu-web)
    60          * [make pprof-heap-web](#make-pprof-heap-web)
    61          * [make shell](#make-shell)
    62          * [make pkgsite](#make-pkgsite)
    63          * [make build-controller-image](#make-build-controller-image)
    64          * [make build-agones-sdk-image](#make-build-agones-sdk-image)
    65          * [make gen-install](#make-gen-install)
    66          * [make gen-embedded-openapi](#make-gen-embedded-openapi)
    67          * [make gen-crd-code](#make-gen-crd-code)
    68          * [make gen-allocation-grpc](#make-gen-allocation-grpc)
    69          * [make gen-all-sdk-grpc](#make-gen-all-sdk-grpc)
    70          * [make gen-sdk-grpc](#make-gen-sdk-grpc)
    71       * [Build Image Targets](#build-image-targets)
    72          * [make clean-config](#make-clean-config)
    73          * [make clean-build-image](#make-clean-build-image)
    74          * [make build-build-image](#make-build-build-image)
    75       * [Google Cloud Platform](#google-cloud-platform)
    76          * [make gcloud-init](#make-gcloud-init)
    77          * [make gcloud-test-cluster](#make-gcloud-test-cluster)
    78          * [make gcloud-test-cluster-allocation-certs](#gcloud-test-cluster-allocation-certs)
    79          * [make clean-gcloud-test-cluster](#make-clean-gcloud-test-cluster)
    80          * [make gcloud-auth-cluster](#make-gcloud-auth-cluster)
    81          * [make gcloud-auth-docker](#make-gcloud-auth-docker)
    82       * [Minikube](#minikube)
    83          * [make minikube-test-cluster](#make-minikube-test-cluster)
    84          * [make minikube-push](#make-minikube-push)
    85          * [make minikube-install](#make-minikube-install)
    86          * [make minikube-setup-prometheus](#make-minikube-setup-prometheus)
    87          * [make minikube-setup-grafana](#make-minikube-setup-grafana)
    88          * [make minikube-setup-prometheus-stack](#make-minikube-setup-prometheus)
    89          * [make minikube-prometheus-portforward](#make-minikube-prometheus-portforward)
    90          * [make minikube-grafana-portforward](#make-minikube-grafana-portforward)
    91          * [make minikube-test-e2e](#make-minikube-test-e2e)
    92          * [make minikube-shell](#make-minikube-shell)
    93          * [make minikube-transfer-image](#make-minikube-transfer-image)
    94          * [make minikube-controller-portforward](#make-minikube-controller-portforward)
    95       * [Kind](#Kind)
    96          * [make kind-test-cluster](#make-kind-test-cluster)
    97          * [make kind-push](#make-kind-push)
    98          * [make kind-install](#make-kind-install)
    99          * [make kind-setup-prometheus](#make-kind-setup-prometheus)
   100          * [make kind-setup-grafana](#make-kind-setup-grafana)
   101          * [make kind-setup-prometheus-stack](#make-kind-setup-prometheus-stack)
   102          * [make kind-prometheus-portforward](#make-kind-prometheus-portforward)
   103          * [make kind-grafana-portforward](#make-kind-grafana-portforward)
   104          * [make kind-test-e2e](#make-kind-test-e2e)
   105          * [make kind-shell](#make-kind-shell)
   106          * [make kind-controller-portforward](#make-kind-controller-portforward)
   107    * [Dependencies](#dependencies)
   108    * [Running Performance Test](#running-performance-test)
   109    * [Troubleshooting](#troubleshooting)
   110        * [$GOPATH/$GOROOT error when building in WSL](#gopathgoroot-error-when-building-in-wsl)
   111        * [Error: cluster-admin-binding already exists](#error-cluster-admin-binding-already-exists)
   112        * [Error: releases do not exist](#error-releases-do-not-exist)
   113        * [I want to use pprof to profile the controller](#i-want-to-use-pprof-to-profile-the-controller)
   114        * [Error: Kubernetes cluster unreachable](#error-kubernetes-cluster-unreachable-invalid-configuration-no-configuration-has-been-provided)
   115        * [Error: project: required field is not set](#error-project-required-field-is-not-set-error-invalid-value-for-network-project-required-field-is-not-set)
   116        * [Error: could not download chart](#error-could-not-download-chart-failed-to-download-httpsagonesdevchartstableagones-1280tgz)
   117        * [Invalid argument "/agones-controller:$(VERSION)" for "-t, --tag" flag: invalid reference format](#invalid-argument-agones-controller1290-961d8ae-amd64-for--t---tag-flag-invalid-reference-format)
   118  
   119  ## Building on Different Platforms
   120  
   121  ### Linux
   122  - Install Make, either via `apt install make` or `yum install make` depending on platform.
   123  - [Install Docker](https://docs.docker.com/engine/installation/) for your Linux platform.
   124  
   125  ### Windows
   126  Building and developing Agones requires you to use the
   127  [Windows Subsystem for Linux](https://blogs.msdn.microsoft.com/wsl/)(WSL),
   128  as this makes it easy to create a (relatively) cross platform development and build system.
   129  
   130  - [Install WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
   131    - Preferred release is [Ubuntu 16.04](https://www.microsoft.com/en-us/store/p/ubuntu/9nblggh4msv6) or greater.
   132  - [Install Docker for Windows](https://docs.docker.com/docker-for-windows/install/)
   133  - Within WSL, Install [Docker for Ubuntu](https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/)
   134  - Follow [this guide](https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly)
   135    from "Configure WSL to Connect to Docker for Windows" forward
   136    for integrating the Docker on WSL with the Windows Docker installation
   137    - Note the binding of `/c` to `/mnt/c` (or drive of your choice) - this is very important!
   138  - Agones will need to be cloned somewhere on your `/c` (or drive of your choice) path, as that is what Docker will support mounts from
   139  - All interaction with Agones must be on the `/c` (or drive of your choice) path, otherwise Docker mounts will not work
   140  - Now the `make` commands can all be run from within your WSL shell
   141  - The Minikube setup on Windows has not been tested. Pull Requests would be appreciated!
   142  
   143  ### macOS
   144  
   145  - Install Make, `brew install make`, if it's not installed already
   146  - Install [Docker for Mac](https://docs.docker.com/docker-for-mac/install/)
   147  
   148  ## Testing and Building
   149  
   150  Make sure you are in the `build` directory to start.
   151  
   152  First, let's test the Agones system code. To do this, run `make test-go`, which will execute all the unit tests for
   153  the Go codebase (there are other tests, but they can take a long time to run).
   154  
   155  If you haven't run any of Make targets before then this will also create the Docker based build
   156  image, and then run the tests.
   157  
   158  Building the build image may take a few minutes to download all the dependencies, so feel
   159  free to make cup of tea or coffee at this point. ☕️
   160  
   161  **Note**: If you get build errors and you followed all the instructions so far, consult the [Troubleshooting](#troubleshooting) section
   162  
   163  The build image is only created the first time one of the make targets is executed, and will only rebuild if the build
   164  Dockerfile has changed.
   165  
   166  Assuming that the tests all pass, let's go ahead and compile the code and build the Docker images that Agones
   167  consists of.
   168  
   169  To compile the Agones images, run `make build-images`. This is often all you need for Agones development.
   170  
   171  If you want to compile and build everything (this can take a while), run `make build`, this will:
   172  
   173  - Compile the Agones Kubernetes integration code
   174  - Create the Docker images that we will later push
   175  - Build the local development tooling for all supported OS's
   176  - Compile and archive the SDKs in various languages
   177  
   178  You may note that docker images, and tar archives are tagged with a concatenation of the
   179  upcoming release number and short git hash for the current commit. This has also been set in
   180  the code itself, so that it can be seen in via log statements.
   181  
   182  Congratulations! You have now successfully tested and built Agones!
   183  
   184  ### Running a Test Google Kubernetes Engine Cluster
   185  
   186  This will setup a test GKE cluster on Google Cloud, with firewall rules set for each of the nodes for ports 7000-8000
   187  to be open to UDP traffic.
   188  
   189  First step is to create a Google Cloud Project at https://console.cloud.google.com or reuse an existing one.
   190  
   191  The build tools (by default) maintain configuration for gcloud within the `build` folder, to keep
   192  everything separate (see below for overwriting these config locations). Therefore, once the project has been created,
   193  we will need to authenticate our gcloud tooling against it. To do that run `make gcloud-init` and fill in the
   194  prompts as directed.
   195  
   196  Once authenticated, to create the test cluster, run `make gcloud-test-cluster`
   197  (or run `make gcloud-e2e-test-cluster` for end to end tests), which will use the Terraform configuration found in the `build/terraform/gke` directory.
   198  
   199  You can customize the GKE cluster by appending the following parameters to your make target, via environment
   200  variables, or by setting them within your
   201  [`local-includes`](#set-local-make-targets-and-variables-with-local-includes) directory. For end to end tests, update `GCP_CLUSTER_NAME` to e2e-test-cluster
   202  in the Makefile.
   203  
   204  See the table below for available customizations :
   205  
   206  | Parameter                                      | Description                                                                           | Default         |
   207  |------------------------------------------------|---------------------------------------------------------------------------------------|-----------------|
   208  | `GCP_CLUSTER_NAME`                             | The name of the cluster                                                               | `test-cluster`  |
   209  | `GCP_CLUSTER_ZONE` or `GCP_CLUSTER_LOCATION`   | The name of the Google Compute Engine zone/location in which the cluster will resides | `us-west1-c`    |
   210  | `GCP_CLUSTER_NODEPOOL_AUTOSCALE`               | Whether or not to enable autoscaling on game server nodepool                          | `false`         |
   211  | `GCP_CLUSTER_NODEPOOL_MIN_NODECOUNT`           | The number of minimum nodes if autoscale is enabled                                   | `1`             |
   212  | `GCP_CLUSTER_NODEPOOL_MAX_NODECOUNT`           | The number of maximum nodes if autoscale is enabled                                   | `5`             |
   213  | `GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT`        | The number of nodes to create in this cluster.                                        | `4`             |
   214  | `GCP_CLUSTER_NODEPOOL_MACHINETYPE`             | The name of a Google Compute Engine machine type.                                     | `e2-standard-4` |
   215  | `GCP_CLUSTER_NODEPOOL_ENABLEIMAGESTREAMING`    | Whether or not to enable image streaming for the `"default"` node pool in the cluster | `true`          |
   216  | `GCP_CLUSTER_NODEPOOL_WINDOWSINITIALNODECOUNT` | The number of Windows nodes to create in this cluster.                                | `0`             |
   217  | `GCP_CLUSTER_NODEPOOL_WINDOWSMACHINETYPE`      | The name of a Google Compute Engine machine type for Windows nodes.                   | `e2-standard-4` |
   218  
   219  This will take several minutes to complete, but once done you can go to the Google Cloud Platform console and see that
   220  a cluster is up and running!
   221  
   222  To grab the kubectl authentication details for this cluster, run `make gcloud-auth-cluster`, which will generate the
   223  required Kubernetes security credentials for `kubectl`. This will be stored in `~/.kube/config` by default, but can also be
   224  overwritten by setting the `KUBECONFIG` environment variable before running the command.
   225  
   226  Great! Now we are setup, let's try out the development shell, and see if our `kubectl` is working!
   227  
   228  Run `make shell` to enter the development shell. You should see a bash shell that has you as the root user.
   229  Enter `kubectl get pods` and press enter. You should see that you have no resources currently, but otherwise see no errors.
   230  Assuming that all works, let's exit the shell by typing `exit` and hitting enter, and look at building, pushing and
   231  installing Agones next.
   232  
   233  To prepare building and pushing images, let's set the REGISTRY environment variable to point to our new project.
   234  You can choose either Google Container Registry or Google Artifact Registry but you must set it explicitly.
   235  For this guidance, we will use Google Artifact Registry.
   236  You can [choose any registry region](https://cloud.google.com/artifact-registry/docs/docker/pushing-and-pulling)
   237  but for this example, we'll just use `us-docker.pkg.dev`.
   238  Please follow the [instructions](https://cloud.google.com/artifact-registry/docs/docker/pushing-and-pulling#before_you_begin) to create the registry
   239  in your project properly before you contine.
   240  
   241  In your shell, run `export REGISTRY=us-docker.pkg.dev/<YOUR-PROJECT-ID>/<YOUR-REGISTRY-NAME>` which will set the required `REGISTRY` parameters in our
   242  Make targets. Then, to rebuild our images for this registry, we run `make build-images` again.
   243  
   244  Before we can push the images, there is one more small step! So that we can run regular `docker push` commands
   245  (rather than `gcloud docker -- push`), we have to authenticate against the registry, which will give us a short
   246  lived key for our local docker config. To do this, run `make gcloud-auth-docker`, and now we have the short lived tokens.
   247  
   248  To push our images up at this point, is simple `make push` and that will push up all images you just built to your
   249  project's container registry.
   250  
   251  Now that the images are pushed, to install the development version (with all imagePolicies set to always download),
   252  run `make install` and Agones will install the image that you just built and pushed on the test cluster you
   253  created at the beginning of this section. (if you want to see the resulting installation yaml, you can find it in `build/.install.yaml`)
   254  
   255  Finally, to run all the end-to-end tests against your development version previously installed in your test cluster run
   256  `make test-e2e` (this can also take a while). This will validate the whole application flow from start to finish. If
   257  you're curious about how they work head to [tests/e2e](../test/e2e/).
   258  Also [see below](#running-individual-end-to-end-tests) for how to run individual end-to-end tests during development.
   259  
   260  When you are finished, you can run `make clean-gcloud-test-cluster` (or
   261  `make clean-gcloud-e2e-test-cluster`) to tear down your cluster.
   262  
   263  ### Running a Test Minikube cluster
   264  This will setup a [Minikube](https://github.com/kubernetes/minikube) cluster, running on an `agones` profile,
   265  
   266  Because Minikube runs on a virtualisation layer on the host (usually Docker), some of the standard build and development
   267   Make targets need to be replaced by Minikube specific targets.
   268  
   269  First, [install Minikube](https://github.com/kubernetes/minikube#installation).
   270  
   271  Next we will create the Agones Minikube cluster. Run `make minikube-test-cluster` to create the `agones` profile,
   272  and a Kubernetes cluster of the supported version under this profile.
   273  
   274  This will also install the kubectl authentication credentials in `~/.kube`, and set the
   275  [`kubectl` context](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)
   276  to `agones`.
   277  
   278  Great! Now we are setup, let's try out the development shell, and see if our `kubectl` is working!
   279  
   280  Run `make minikube-shell` to enter the development shell. You should see a bash shell that has you as the root user.
   281  Enter `kubectl get pods` and press enter. You should see that you have no resources currently, but otherwise see no errors.
   282  Assuming that all works, let's exit the shell by typing `exit` and hitting enter, and look at a building, pushing and
   283  installing Agones on Minikube next.
   284  
   285  You may remember in the first part of this walkthrough, we ran `make build-images`, which created all the images and binaries
   286  we needed to work with Agones locally. We can push these images them straight into Minikube very easily!
   287  
   288  Run `make minikube-push` which will send all of Agones's docker images from your local Docker into the Agones Minikube
   289  instance.
   290  
   291  Now that the images are pushed, to install the development version,
   292  run `make minikube-install` and Agones will install the images that you built and pushed to the Agones Minikube instance
   293  (if you want to see the resulting installation yaml, you can find it in `build/.install.yaml`).
   294  
   295  It's worth noting that Minikube does let you [reuse its Docker daemon](https://minikube.sigs.k8s.io/docs/handbook/pushing/#1-pushing-directly-to-the-in-cluster-docker-daemon-docker-env),
   296  and build directly on Minikube, but in this case this approach is far simpler,
   297  and makes cross-platform support for the build system much easier.
   298  
   299  To push your own images into the cluster, take a look at Minikube's
   300  [Pushing Images](https://minikube.sigs.k8s.io/docs/handbook/pushing/) guide.
   301  
   302  Running end-to-end tests on Minikube can be done via the `make minikube-test-e2e` target, but this can often overwhelm
   303  a local minikube cluster, so use at your own risk. Take a look at
   304  [Running Individual End-to-End Tests](#running-individual-end-to-end-tests) to run individual tests on a case by case
   305  basis.
   306  
   307  If you are getting issues connecting to `GameServers` running on minikube, check the
   308  [Agones minikube](https://agones.dev/site/docs/installation/creating-cluster/minikube/) documentation. You may need to
   309  change the driver version through the `MINIKUBE_DRIVER` variable. See the
   310  [local-includes](#set-local-make-targets-and-variables-with-local-includes) on how to change this permanently on
   311  your development machine.
   312  
   313  ### Running a Test Kind cluster
   314   This will setup a [Kubernetes IN Docker](https://github.com/kubernetes-sigs/kind) cluster named agones by default.
   315  
   316  Because Kind runs on a docker on the host, some of the standard build and development Make targets
   317  need to be replaced by kind specific targets.
   318  
   319  First, [install Kind](https://github.com/kubernetes-sigs/kind#installation-and-usage).
   320  
   321  Next we will create the Agones Kind cluster. Run `make kind-test-cluster` to create the `agones` Kubernetes cluster.
   322  
   323  This will also setup helm and a kubeconfig, the kubeconfig location can found using the following command `kind get kubeconfig --name=agones` assuming you're using the default `KIND_PROFILE`.
   324  
   325  You can verify that your new cluster information by running (if you don't have kubectl you can skip to the shell section):
   326  
   327  ```
   328  KUBECONFIG=$(kind get kubeconfig-path --name=agones) kubectl cluster-info
   329  ```
   330  
   331  Great! Now we are setup, we also provide a development shell with a handful set of tools like kubectl and helm.
   332  
   333  Run `make kind-shell` to enter the development shell. You should see a bash shell that has you as the root user.
   334  Enter `kubectl get pods` and press enter. You should see that you have no resources currently, but otherwise see no errors.
   335  Assuming that all works, let's exit the shell by typing `exit` and hitting enter, and look at a building, pushing and installing Agones on Kind next.
   336  
   337  You may remember in the first part of this walkthrough, we ran `make build-images`, which created all the images and binaries
   338  we needed to work with Agones locally. We can push these images them straight into kind very easily!
   339  
   340  Run `make kind-push` which will send all of Agones's docker images from your local Docker into the Agones Kind container.
   341  
   342  Now that the images are pushed, to install the development version,
   343  run `make kind-install` and Agones will install the images that you built and pushed to the Agones Kind cluster.
   344  
   345  Running end-to-end tests on Kind is done via the `make kind-test-e2e` target. This target use the same `make test-e2e` but also setup some prerequisites for use with a Kind cluster.
   346  
   347  If you are having performance issues, check out these docs [here](https://kind.sigs.k8s.io/docs/user/quick-start/#creating-a-cluster)
   348  
   349  ### Running a Custom Test Environment
   350  
   351  This section is addressed to developers using a custom Kubernetes provider, a custom image repository and/or multiple test clusters.
   352  
   353  Prerequisites:
   354  - a(some) running k8s cluster(s)
   355  - Have kubeconfig file(s) ready
   356  - docker must be logged into the image repository you're going to use
   357  
   358  To begin, you need to set up the following environment variables:
   359  - `KUBECONFIG` should point to the kubeconfig file used to access the cluster;
   360     if unset, it defaults to `~/.kube/config`
   361  - `REGISTRY` should point to your image repository of your choice (i.e. us-docker.pkg.dev/<YOUR-PROJECT-ID>/<YOUR-REGISTRY-NAME>)
   362  - `IMAGE_PULL_SECRET` must contain the name of the secret required to pull the Agones images,
   363     in case you're using a custom repository; if unset, no pull secret will be used
   364  - `IMAGE_PULL_SECRET_FILE` must be initialized to the full path of the file containing
   365     the secret for pulling the Agones images, in case of a custom image repository;
   366     if set, `make install` will install this secret in both the `agones-system` (for pulling the controller image)
   367     and `default` (for pulling the sdk image) repositories
   368  
   369  Now you're ready to begin the development/test cycle:
   370  - `make build` will build Agones
   371  - `make test` will run local tests, which includes `site-test` target
   372  - `make push` will push the Agones images to your image repository
   373  - `make install` will install/upgrade Agones into your cluster
   374  - `make test-e2e` will run end-to-end tests in your cluster
   375  
   376  If you need to clean up your cluster, you can use `make uninstall` to remove Agones.
   377  
   378  ### Common Development Flows
   379  
   380  You can combine some of the above steps into a single one, for example `make build-images push install` is very
   381  common flow, to build you changes on Agones, push them to a container registry and install this development
   382  version to your cluster.
   383  
   384  Another would be to run `make lint test-go` to run the golang linter against the Go code, and then run all the unit
   385  tests.
   386  
   387  ### Set Local Make Targets and Variables with `local-includes`
   388  
   389  If you want to permanently set `Makefile` variables or add targets to your local setup, all `local-includes/*.mk`
   390  are included into the main `Makefile`, and also ignored by the git repository.
   391  
   392  Therefore, you can add your own `.mk` files in the [`local-includes`](./local-includes) directory without affecting
   393  the shared git repository.
   394  
   395  For examaple, if I only worked with Linux images for Agones, I could permanently turn off Windows and Arm64 images,
   396  by writing a `images.mk` within that folder, with the following contents:
   397  
   398  ```makefile
   399  # Just Linux
   400  WITH_WINDOWS=0
   401  WITH_ARM64=0
   402  ```
   403  
   404  ### Running Individual End-to-End Tests
   405  
   406  When you are working on an individual feature of Agones, it doesn't make sense to run the entire end-to-end suite of
   407  tests (and it can take a really long time!).
   408  
   409  The end-to-end tests within the [`tests/e2e`](../test/e2e) folder are plain
   410  [Go Tests](https://go.dev/doc/tutorial/add-a-test) that will use your local `~/.kube` configuration to connect and
   411  run against the currently active local cluster.
   412  
   413  This means you can run individual e2e tests from within your IDE or as a `go` command.
   414  
   415  For example:
   416  
   417  ```shell
   418  go test -race -run ^TestCreateConnect$
   419  ```
   420  
   421  #### Troubleshooting
   422  If you run into cluster connection issues, this can usually be resolved by running any kind of authenticated `kubectl`
   423  command from within `make shell` or locally, to refresh your authentication token.
   424  
   425  ## Make Variable Reference
   426  
   427  ### VERSION
   428  The version of this build. Version defaults to the short hash of the latest commit.
   429  
   430  ### REGISTRY
   431  The registry that is being used to store docker images. It doesn't have default value and has to be set explicitly.
   432  
   433  ### CHARTS_REGISTRY
   434  The chart registry that is being used to store helm charts. It doesn't have default value and has to be set explicitly.
   435  If not set it would use the `GCP_BUCKET_CHARTS`.
   436  
   437  ### KUBECONFIG
   438  The Kubernetes config file used to access the cluster. Defaults to `~/.kube/config` - the file used by default by kubectl.
   439  
   440  ### CLUSTER_NAME
   441  The (gcloud) test cluster that is being worked against. Defaults to `test-cluster`.
   442  
   443  ### GCP_PROJECT
   444  Your GCP project for deploying GKE cluster. Defaults to gcloud default project settings.
   445  
   446  ### GKE_PASSWORD
   447  If specified basic authentication would be enabled for your cluster with username "admin".
   448  Empty string `""` would disable basic authentication.
   449  
   450  ### IMAGE_PULL_SECRET
   451  The name of the secret required to pull the Agones images, if needed.
   452  If unset, no pull secret will be used.
   453  
   454  ### IMAGE_PULL_SECRET_FILE
   455  The full path of the file containing the secret for pulling the Agones images, in case it's needed.
   456  
   457  If set, `make install` will install this secret in both the `agones-system` (for pulling the controller image)
   458  and `default` (for pulling the sdk image) repositories.
   459  
   460  ### WITH_WINDOWS
   461  Build Windows container images for Agones.
   462  
   463  This option is enabled by default via implicit `make WITH_WINDOWS=1 build-images`.
   464  To disable, use `make WITH_WINDOWS=0 build-images`.
   465  
   466  ### WINDOWS_VERSIONS
   467  List of Windows Server versions to build for. Defaults to `ltsc2019` for Windows Server 2019.
   468  See https://hub.docker.com/_/microsoft-windows-servercore for all available Windows versions.
   469  
   470  ### WITH_ARM64
   471  Build ARM64 container images for Agones
   472  
   473  This option is enabled by default via implicit `make WITH_ARM64=1 build-images`.
   474  To disable, use `make WITH_ARM64=0 build-images`.
   475  
   476  ### MINIKUBE_DRIVER
   477  
   478  Which [driver](https://minikube.sigs.k8s.io/docs/drivers/) to use with a Minikube test cluster.
   479  
   480  Defaults to "docker".
   481  
   482  ## Make Target Reference
   483  
   484  All targets will create the build image if it is not present.
   485  
   486  ### Development Targets
   487  
   488  Targets for developing with the build image.
   489  
   490  #### `make build`
   491  Build all the images required for Agones, as well as the SDKs
   492  
   493  #### `make build-images`
   494  Build all the images required for Agones
   495  
   496  #### `make build-sdks`
   497  Build all the sdks required for Agones
   498  
   499  #### `make build-sdk`
   500  Next command `make build-sdk SDK_FOLDER=[SDK_TYPE]` will build SDK of `SDK_TYPE`.
   501  For instance, in order to build the cpp sdk static and dynamic libraries (linux libraries only) use `SDK_FOLDER=cpp`
   502  
   503  #### `make run-sdk-command`
   504  Next command `make run-sdk-command COMMAND=[COMMAND] SDK_FOLDER=[SDK_TYPE]` will execute command for `SDK_TYPE`.
   505  For instance, in order to generate swagger codes when you change swagger.json definition, use `make run-sdk-command COMMAND=gen SDK_FOLDER=restapi`
   506  
   507  #### `make run-sdk-conformance-local`
   508  Run Agones sidecar which would wait for all requests from the SDK client.
   509  Note that annotation should contain UID and label should contain CreationTimestamp values to pass the test.
   510  
   511  #### `make run-sdk-conformance-no-build`
   512  Only run a conformance test for a specific Agones SDK.
   513  
   514  #### `make run-sdk-conformance-test`
   515  Build, run and clean conformance test for a specific Agones SDK.
   516  
   517  #### `make run-sdk-conformance-tests`
   518  Run SDK conformance test.
   519  Run SDK server (sidecar) in test mode (which would record all GRPC requests) versus all SDK test clients which should generate those requests. All methods are verified.
   520  
   521  #### `make clean-sdk-conformance-tests`
   522  Clean leftover binary and package files after running SDK conformance tests.
   523  
   524  #### `make test`
   525  Run the go tests, the sdk tests, the website tests and yaml tests.
   526  
   527  #### `make test-go`
   528  Run only the golang tests
   529  
   530  #### `make lint`
   531  Lint the Go code
   532  
   533  #### `make build-examples`
   534  Run `make build` for all `examples` subdirectories
   535  
   536  #### `make site-server`
   537  Generate `https://agones.dev` website locally and host on `http://localhost:1313`
   538  
   539  #### `make hugo-test`
   540  Check the links in a website
   541  
   542  #### `make site-test`
   543  Check the links in a website, includes `test-gen-api-docs` target
   544  
   545  #### `make site-images`
   546  Create all the site images from dot and puml diagrams in /site/static/diagrams
   547  
   548  #### `make gen-api-docs`
   549  Generate Agones CRD reference documentation [Agones CRD API reference](../site/content/en/docs/Reference/agones_crd_api_reference.html). Set `feature` shortcode with proper version automatically
   550  
   551  #### `make test-gen-api-docs`
   552  Verifies that there is no changes in generated [Agones CRD API reference](../site/content/en/docs/Reference/agones_crd_api_reference.html) compared to the current one (useful for CI)
   553  
   554  #### `make push`
   555  Pushes all built images up to the `$(REGISTRY)`
   556  
   557  #### `make install`
   558  Installs the current development version of Agones into the Kubernetes cluster
   559  
   560  #### `make uninstall`
   561  Removes Agones from the Kubernetes cluster
   562  
   563  #### `make update-allocation-certs`
   564  Updates the Agones installation with the IP of the Allocation LoadBalancer, thereby creating a valid certificate
   565  for the Allocation gRPC endpoints.
   566  
   567  The certificates are downloaded from the test kubernetes cluster and stored in ./build/allocation
   568  
   569  #### `make test-e2e`
   570  Runs end-to-end tests on the previously installed version of Agones.
   571  These tests validate Agones flow from start to finish.
   572  
   573  It uses the KUBECONFIG to target a Kubernetes cluster.
   574  
   575  Use `GAMESERVERS_NAMESPACE` flag to provide a namespace or leave it empty in order to create and use a random one.
   576  
   577  See [`make minikube-test-e2e`](#make-minikube-test-e2e) to run end-to-end tests on Minikube.
   578  
   579  #### `make test-e2e-integration`
   580  Runs integration portion of the end-to-end tests.
   581  
   582  Pass flags to [go test](https://golang.org/cmd/go/#hdr-Testing_flags) command
   583  using the `ARGS` parameter. For example, to run only the `TestGameServerReserve` test:
   584  
   585  ```bash
   586  make test-e2e-integration ARGS='-run TestGameServerReserve'
   587  ```
   588  
   589  #### `make test-e2e-failure`
   590  Run controller failure portion of the end-to-end tests.
   591  
   592  #### `make test-e2e-allocator-crash`
   593  Run allocator failure portion of the end-to-end test.
   594  
   595  #### `make setup-prometheus`
   596  
   597  Install Prometheus server using [Prometheus Community](https://prometheus-community.github.io/helm-charts)
   598  chart into the current cluster.
   599  
   600  By default all exporters and alertmanager is disabled.
   601  
   602  You can use this to collect Agones [Metrics](../site/content/en/docs/Guides/metrics.md).
   603  
   604  See [`make minikube-setup-prometheus`](#make-minikube-setup-prometheus) and [`make kind-setup-prometheus`](#make-kind-setup-prometheus) to run the installation on Minikube or Kind.
   605  
   606  #### make helm-repo-update
   607  
   608  Run helm repo update to get the mose recent charts.
   609  
   610  #### `make setup-grafana`
   611  
   612  Install Grafana server using [grafana community](https://grafana.github.io/helm-charts) chart into
   613  the current cluster and setup [Agones dashboards with Prometheus datasource](./grafana/).
   614  
   615  You can set your own password using the `PASSWORD` environment variable.
   616  
   617  See [`make minikube-setup-grafana`](#make-minikube-setup-grafana) and [`make kind-setup-grafana`](#make-kind-setup-grafana) to run the installation on Minikube or Kind.
   618  
   619  #### `make setup-prometheus-stack`
   620  
   621  Install Prometheus-stack using [Prometheus Community](https://prometheus-community.github.io/helm-charts) chart into the current cluster.
   622  
   623  By default only prometheus and grafana will installed, all exporters and alertmanager is disabled.
   624  
   625  You can use this to collect Agones [Metrics](../site/content/en/docs/Guides/metrics.md) using ServiceMonitor.
   626  
   627  See [`make minikube-setup-prometheus-stack`](#make-minikube-setup-prometheus-stack) and [`make kind-setup-prometheus-stack`](#make-kind-setup-prometheus-stack) to run the installation on Minikube or Kind.
   628  
   629  #### `make prometheus-portforward`
   630  
   631  Sets up port forwarding to the
   632  Prometheus deployment (port 9090 Prometheus UI).
   633  
   634  On Windows and MacOS you will need to have installed [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
   635  
   636  See [`make minikube-prometheus-portforward`](#make-minikube-prometheus-portforward) and [`make kind-prometheus-portforward`](#make-minikube-prometheus-portforward) to run  on Minikube or Kind.
   637  
   638  #### `make grafana-portforward`
   639  
   640  Sets up port forwarding to the
   641  grafana deployment (port 3000 UI).
   642  
   643  On Windows and MacOS you will need to have installed [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
   644  
   645  See [`make minikube-grafana-portforward`](#make-minikube-grafana-portforward) and [`make kind-grafana-portforward`](#make-minikube-grafana-portforward) to run  on Minikube or Kind.
   646  
   647  #### `make controller-portforward`
   648  
   649  Sets up port forwarding to a specified PORT var (defaults to 8080 for controller metrics) to the
   650  controller deployment.
   651  
   652  #### `make pprof-cpu-web`
   653  
   654  Start the web interface for pprof for cpu profiling.
   655  
   656  #### `make pprof-heap-web`
   657  
   658  Start the web interface for pprof for heap profiling.
   659  
   660  #### `make shell`
   661  Run a bash shell with the developer tools (go tooling, kubectl, etc) and source code in it.
   662  
   663  #### `make pkgsite`
   664  Run a container with pkgsite on port 8888
   665  
   666  #### `make build-controller-image`
   667  Compile the gameserver controller and then build the docker image
   668  
   669  #### `make build-agones-sdk-image`
   670  Compile the gameserver sidecar and then build the docker image
   671  
   672  #### `make build-ping-image`
   673  Compile the ping binary and then build the docker image
   674  
   675  #### `make gen-install`
   676  Generate the `/install/yaml/install.yaml` from the Helm template
   677  
   678  #### `make gen-embedded-openapi`
   679  Generate the embedded OpenAPI specs for existing Kubernetes Objects, such as `PodTemplateSpec` and `ObjectMeta`.
   680  
   681  This should be run against a clean or brand new cluster, as external CRD's or schemas could cause errors to occur.
   682  
   683  #### `make gen-crd-code`
   684  Generate the Custom Resource Definition client(s), conversions, deepcopy, and defaults code.
   685  
   686  #### `make gen-allocation-grpc`
   687  Generate the allocator gRPC code
   688  
   689  #### `make gen-all-sdk-grpc`
   690  Generate the SDK gRPC server and client code for all SDKs.
   691  
   692  #### `make gen-sdk-grpc`
   693  Generate the SDK gRPC server and client code for a single SDK (specified in the `SDK_FOLDER` variable).
   694  
   695  ### Build Image Targets
   696  
   697  Targets for building the build image
   698  
   699  #### `make clean-config`
   700  Cleans the kubernetes and gcloud configurations
   701  
   702  #### `make clean-build-image`
   703  Deletes the local build docker image
   704  
   705  #### `make build-build-image`
   706  Creates the build docker image
   707  
   708  ### Google Cloud Platform
   709  
   710  A set of utilities for setting up a Kubernetes Engine cluster on Google Cloud Platform,
   711  since it's an easy way to get a test cluster working with Kubernetes.
   712  
   713  #### `make gcloud-init`
   714  Initialise the gcloud login and project configuration, if you are working with GCP.
   715  
   716  #### `make gcloud-test-cluster`
   717  Creates and authenticates a GKE cluster to work against.
   718  
   719  #### `make clean-gcloud-test-cluster`
   720  Delete a GKE cluster previously created with `make gcloud-test-cluster`.
   721  
   722  #### `make gcloud-auth-cluster`
   723  Pulls down authentication information for kubectl against a cluster, name can be specified through CLUSTER_NAME
   724  (defaults to 'test-cluster').
   725  
   726  #### `make gcloud-auth-docker`
   727  Creates a short lived access to Google Cloud container repositories, so that you are able to call
   728  `docker push` directly. Useful when used in combination with `make push` command.
   729  
   730  ### Terraform
   731  
   732  Utilities for deploying a Kubernetes Engine cluster on Google Cloud Platform using `google` Terraform provider.
   733  
   734  #### `make gcloud-terraform-cluster`
   735  Create GKE cluster and install release version of agones.
   736  Run next command to create GKE cluster with agones (version from helm repository):
   737  ```
   738  [GKE_PASSWORD="<YOUR_PASSWORD>"] make gcloud-terraform-cluster
   739  ```
   740  Where `<YOUR_PASSWORD>` should be at least 16 characters in length. You can omit GKE_PASSWORD and then basic auth would be disabled. Also you change `ports="7000-8000"` setting using tfvars file.
   741  Also you can define password `password=<YOUR_PASSWORD>` string in `build/terraform.tfvars`.
   742  Change AGONES_VERSION to a specific version you want to install.
   743  
   744  #### `make gcloud-terraform-install`
   745  Create GKE cluster and install current version of agones.
   746  The current version should be built and pushed to `$(REGISTRY)` beforehand:
   747  ```
   748  make build-images
   749  make push
   750  ```
   751  
   752  #### `make gcloud-terraform-destroy-cluster`
   753  Run `terraform destroy` on your cluster.
   754  
   755  #### `make terraform-clean`
   756  Remove .terraform directory with configs as well as tfstate files.
   757  
   758  ### Minikube
   759  
   760  A set of utilities for setting up and running a [Minikube](https://github.com/kubernetes/minikube) instance,
   761  for local development.
   762  
   763  Since Minikube runs locally, there are some targets that need to be used instead of the standard ones above.
   764  
   765  #### `make minikube-test-cluster`
   766  Switches to an "agones" profile, and starts a kubernetes cluster
   767  of the right version. Uses "docker" as the default driver.
   768  
   769  If needed, use MINIKUBE_DRIVER variable to change the VM driver.
   770  
   771  #### `make minikube-install`
   772  
   773  Installs the current development version of Agones into the Kubernetes cluster.
   774  Use this instead of `make install`, as it disables PullAlways on the install.yaml
   775  
   776  #### `make minikube-push`
   777  
   778  Push the local Agones Docker images that have already been built
   779  via `make build` or `make build-images` into the "agones" minikube instance with `minikube cache add`
   780  
   781  #### `make minikube-setup-prometheus`
   782  
   783  Installs prometheus metric backend into the Kubernetes cluster.
   784  Use this instead of `make setup-prometheus`, as it disables Persistent Volume Claim.
   785  
   786  #### `make minikube-setup-grafana`
   787  
   788  Installs grafana into the Kubernetes cluster.
   789  Use this instead of `make setup-grafana`, as it disables Persistent Volume Claim.
   790  
   791  #### `make minikube-setup-prometheus-stack`
   792  
   793  Installs prometheus-stack into the Kubernetes cluster.
   794  Use this instead of `make setup-prometheus-stack`, as it disables Persistent Volume Claim.
   795  
   796  #### `make minikube-prometheus-portforward`
   797  
   798  The minikube version of [`make prometheus-portforward`](#make-prometheus-portforward) to setup
   799  port forwarding to the prometheus deployment.
   800  
   801  #### `make minikube-grafana-portforward`
   802  
   803  The minikube version of [`make grafana-portforward`](#make-grafana-portforward) to setup
   804  port forwarding to the grafana deployment.
   805  
   806  #### `make minikube-test-e2e`
   807  Runs end-to-end tests on the previously installed version of Agones.
   808  These tests validate Agones flow from start to finish.
   809  
   810  ⚠ Running all the e2e tests can often overwhelm a local minikube cluster, so use at your own risk. You should look at
   811  [Running Individual End-to-End Tests](#running-individual-end-to-end-tests) to run tests on a case by case basis.
   812  
   813  #### `make minikube-shell`
   814  Connecting to Minikube requires so enhanced permissions, so use this target
   815  instead of `make shell` to start an interactive shell for development on Minikube.
   816  
   817  #### `make minikube-controller-portforward`
   818  The minikube version of [`make controller-portforward`](#make-controller-portforward) to setup
   819  port forwarding to the controller deployment.
   820  
   821  ### Kind
   822  
   823  [Kind - kubernetes in docker](https://github.com/kubernetes-sigs/kind) is a tool for running local Kubernetes clusters using Docker container "nodes".
   824  
   825  Since Kind runs locally, there are some targets that need to be used instead of the standard ones above.
   826  
   827  #### `make kind-test-cluster`
   828  Starts a local kubernetes cluster, you can delete it with `make kind-delete-cluster`
   829  
   830  Use KIND_PROFILE variable to change the name of the cluster.
   831  
   832  #### `make kind-push`
   833  Push the local Agones Docker images that have already been built
   834  via `make build` or `make build-images` into the "agones" Kind cluster.
   835  
   836  #### `make kind-install`
   837  Installs the current development version of Agones into the Kubernetes cluster.
   838  Use this instead of `make install`, as it disables PullAlways on the install.yaml
   839  
   840  #### `make kind-setup-prometheus`
   841  
   842  Installs prometheus metric backend into the Kubernetes cluster.
   843  Use this instead of `make setup-prometheus`, as it disables Persistent Volume Claim.
   844  
   845  #### `make kind-setup-grafana`
   846  
   847  Installs grafana into the Kubernetes cluster.
   848  Use this instead of `make setup-grafana`, as it disables Persistent Volume Claim.
   849  
   850  #### `make kind-setup-prometheus-stack`
   851  
   852  Installs prometheus-stack into the Kubernetes cluster.
   853  Use this instead of `make setup-prometheus-stack`, as it disables Persistent Volume Claim.
   854  
   855  #### `make kind-prometheus-portforward`
   856  
   857  The kind version of [`make prometheus-portforward`](#make-prometheus-portforward) to setup
   858  port forwarding to the prometheus deployment.
   859  
   860  #### `make kind-grafana-portforward`
   861  
   862  The kind version of [`make grafana-portforward`](#make-grafana-portforward) to setup
   863  port forwarding to the grafana deployment.
   864  
   865  
   866  #### `make kind-test-e2e`
   867  Runs end-to-end tests on the previously installed version of Agones.
   868  These tests validate Agones flow from start to finish.
   869  
   870  #### `make kind-shell`
   871  Connecting to Kind requires so enhanced permissions, so use this target
   872  instead of `make shell` to start an interactive shell for development on Kind.
   873  
   874  #### `make kind-controller-portforward`
   875  The Kind version of [`make controller-portforward`](#make-controller-portforward) to setup
   876  port forwarding to the controller deployment.
   877  
   878  ## Dependencies
   879  
   880  This project uses the [go modules](https://github.com/golang/go/wiki/Modules) as its manager. You can see the list of dependencies [here](https://github.com/googleforgames/agones/blob/main/go.mod).
   881  
   882  #### Vendoring
   883  
   884  Agones uses [module vendoring](https://tip.golang.org/cmd/go/#hdr-Modules_and_vendoring) to reliably produce versioned builds with consistent behavior.
   885  
   886  Adding a new dependency to Agones:
   887  
   888  *  `go mod tidy` This will import your new deps into the go.mod file and trim out any removed dependencies.
   889  *  `go mod vendor` Pulls module code into the vendor directory.
   890  
   891  Sometimes the code added to vendor may not include a subdirectory that houses code being used but not as an import
   892  (protos passed as args to scripts is a good example). In this case you can go into the module cache and copy what you need to the path in vendor.
   893  
   894  Here is an example for getting third_party from grpc-ecosystem/grpc-gateway v1.5.1 into vendor:
   895  
   896  *  AGONES_PATH=/wherever/your/agones/path/is
   897  *  cp -R $GOPATH/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.5.1/third_party $AGONES_PATH/vendor/github.com/grpc-ecosystem/grpc-gateway/
   898  
   899  Note the version in the pathname. Go may eliminate the need to do this in future versions.
   900  
   901  We also use vendor to hold code patches while waiting for the project to release the fixes in their own code. An example is in [k8s.io/apimachinery](https://github.com/googleforgames/agones/issues/414) where a fix will be released later this year, but we updated our own vendored version in order to fix the issue sooner.
   902  
   903  ## Running Performance Test
   904  
   905  To be able to run the performance script located in the following path: `agones/build/performance-test.sh` you need to have the following setup:
   906  
   907  #### Install a standard GKE cluster 
   908  
   909  Follow for more details here: https://agones.dev/site/docs/installation/creating-cluster/gke/
   910  
   911  #### Install Agones
   912  
   913  Follow for more details here: https://agones.dev/site/docs/installation/install-agones/helm/
   914  
   915  #### Set up node for prometheus 
   916  
   917  ```
   918  gcloud container node-pools create agones-metrics --cluster={CLUSTER_NAME} --zone={REGION} \
   919    --node-taints agones.dev/agones-metrics=true:NoExecute \
   920    --node-labels agones.dev/agones-metrics=true \
   921    --num-nodes=1 \
   922    --machine-type=e2-standard-4
   923  ```
   924  
   925  #### Install Prometheus, Grafana and port-forward
   926  
   927  cd agones/
   928  
   929  https://agones.dev/site/docs/guides/metrics/#installation
   930  
   931  #### Modify the performance-test.sh
   932  
   933  The performance-tests script contains a set of variables that need to be overwritten to work with your cluster and configuration settings. You can also pass these values through command line This is an example:
   934  
   935  ```
   936  CLUSTER_NAME=agones-standard
   937  CLUSTER_LOCATION=us-central1-c
   938  REGISTRY=us-east1-docker.pkg.dev/user/agones
   939  PROJECT=my-project
   940  REPLICAS=10000
   941  AUTO_SHUTDOWN_DELAY=60
   942  BUFFER_SIZE=9900
   943  MAX_REPLICAS=20000
   944  DURATION=10m
   945  CLIENTS=50
   946  INTERVAL=1000
   947  ```
   948  
   949  You might also want to comment out the first couple lines that come after the variables are set and also change the cd directoy:
   950  
   951  ```
   952  # export SHELL="/bin/bash"
   953  # mkdir -p /go/src/agones.dev/
   954  # ln -sf /workspace /go/src/agones.dev/agones
   955  # cd /go/src/agones.dev/agones/build
   956  
   957  # gcloud config set project $PROJECT
   958  # gcloud container clusters get-credentials $CLUSTER_NAME \
   959  #        --zone=$CLUSTER_LOCATION --project=$PROJECT
   960  
   961  # make install LOG_LEVEL=info REGISTRY='"'$REGISTRY'"' DOCKER_RUN=""
   962  
   963  # cd /go/src/agones.dev/agones/test/load/allocation
   964  cd ../test/load/allocation
   965  ```
   966  
   967  This script is an entyrpoint to be able to run the allocation performance test which can be found at `agones/test/load/allocation`
   968  
   969  You can see the fleet and autoscaler configuration (such as buffer size and min/max replicas, etc) in the following files: 
   970  
   971  * [performance-test-fleet-template](https://github.com/googleforgames/agones/blob/main/test/load/allocation/performance-test-fleet-template.yaml)
   972  * [performance-test-autoscaler-template.yaml](https://github.com/googleforgames/agones/blob/main/test/load/allocation/performance-test-autoscaler-template.yaml)
   973  
   974  You could also modify the `automatic shutdown delay` parameter where if the value is greater than zero, it will automatically shut down the server this many seconds after the server becomes allocated (cannot be used if `automaticShutdownDelayMin` is set). It's a configuration for the simple game server.
   975  
   976  Something to keep in mind with CLIENTS and INTERVAL is the following. Let's say you have client count 50 and interval 500ms, which means every client will submit 2 allocation requests in 1s, so the entire allocation requests that the allocator receives in 1s is 50 * 2 = 100, so the allocation request QPS from the allocator view is 100. 
   977  
   978  Finally, you can cd agones/build and run `sh performance-test.sh` if you see timeout issues please re-run the command. 
   979  
   980  ## Troubleshooting
   981  
   982  Frequent issues and possible solutions
   983  
   984  #### $GOPATH/$GOROOT error when building in WSL
   985  
   986  If you get this error when building Agones in WSL (`make build`, `make test` or any other related target):
   987  
   988  ```can't load package: package agones.dev/agones/cmd/controller: cannot find package "agones.dev/agones/cmd/controller" in any of:
   989         /usr/local/go/src/agones.dev/agones/cmd/controller (from $GOROOT)
   990         /go/src/agones.dev/agones/cmd/controller (from $GOPATH)
   991  ```
   992  
   993  - Are your project files on a different folder than C? If yes, then you should either move them on drive C or set up Docker for Windows to share your project drive as well
   994  - Did you set up the volume mount for Docker correctly? By default, drive C is mapped by WSL as /mnt/c, but Docker expects it as /c. You can test by executing `ls /c` in your linux shell. If you get an error, then follow the instructions for [setting up volume mount for Docker](https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly#ensure-volume-mounts-work)
   995  
   996  #### Error: cluster-admin-binding already exists
   997  
   998  This surfaces while running `make gcloud-auth-cluster`. The solution is to run `kubectl describe clusterrolebinding | grep cluster-admin-binding- -A10`, find clusterrolebinding which belongs to your `User` account and then run `kubectl delete clusterrolebindings cluster-admin-binding-<md5Hash>` where `<md5Hash>` is a value specific to your account. Now you can execute `make gcloud-auth-cluster` again. If you run into a permission denied error when attempting the delete operation, you need to run `sudo chown <your username> <path to .kube/config>` to change ownership of the file to yourself.
   999  
  1000  #### Error: releases do not exist
  1001  
  1002  Run `make uninstall` then run `make install` again.
  1003  
  1004  #### I want to use pprof to profile the controller.
  1005  
  1006  Run `make build-images GO_BUILD_TAGS=profile` and this will build images with [pprof](https://golang.org/pkg/net/http/pprof/)
  1007  enabled in the controller, which you can then push and install on your cluster.
  1008  
  1009  To get the pprof ui working, run `make controller-portforward PORT=6060` (or `minikube-controller-portforward PORT=6060` if you are on minikube),
  1010  which will setup the port forwarding to the pprof http endpoint.
  1011  
  1012  To view CPU profiling, run `make pprof-cpu-web`, which will start the web interface with a CPU usage graph
  1013  on [http://localhost:6061](http://localhost:6061).
  1014  
  1015  To view heap metrics, run `make pprof-heap-web`, which will start the web interface with a Heap usage graph.
  1016  on [http://localhost:6062](http://localhost:6062).
  1017  
  1018  #### Error: Kubernetes cluster unreachable: invalid configuration: no configuration has been provided
  1019  
  1020  If you run into this error while creating a test cluster run `make terraform-clean`.
  1021  
  1022  #### Error: project: required field is not set Error: Invalid value for network: project: required field is not set
  1023  
  1024  Run `make gcloud-init`. If you still get the same error, log into the developer
  1025  shell `make shell` and run `gcloud init`.
  1026  
  1027  #### Error: could not download chart: failed to download "https://agones.dev/chart/stable/agones-1.28.0.tgz"
  1028  
  1029  Run `helm repo add agones https://agones.dev/chart/stable` followed by `helm repo update` which will add
  1030  the latest stable version of the agones tar file to your ~/.cache/helm/repository/.
  1031  
  1032  #### Invalid argument "/agones-controller:1.29.0-961d8ae-amd64" for "-t, --tag" flag: invalid reference format
  1033  
  1034  The $(REGISTRY) variable is not set in ~/agones/build/Makefile. For GKE follow instructions under [Running a Test Google Kubernetes Engine Cluster](#running-a-test-google-kubernetes-engine-cluster) for creating a registry and exporting the path to the registry.