agones.dev/agones@v1.54.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 For e2e testing that requires multiple nodes, you can specify the number of nodes using the `MINIKUBE_NODES` environment variable. 275 A minimum of 2-3 nodes is recommended for comprehensive e2e testing: 276 277 ```bash 278 make minikube-test-cluster MINIKUBE_NODES=3 279 ``` 280 281 This will also install the kubectl authentication credentials in `~/.kube`, and set the 282 [`kubectl` context](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) 283 to `agones`. 284 285 Great! Now we are setup, let's try out the development shell, and see if our `kubectl` is working! 286 287 Run `make minikube-shell` to enter the development shell. You should see a bash shell that has you as the root user. 288 Enter `kubectl get pods` and press enter. You should see that you have no resources currently, but otherwise see no errors. 289 Assuming that all works, let's exit the shell by typing `exit` and hitting enter, and look at a building, pushing and 290 installing Agones on Minikube next. 291 292 You may remember in the first part of this walkthrough, we ran `make build-images`, which created all the images and binaries 293 we needed to work with Agones locally. We can push these images them straight into Minikube very easily! 294 295 Run `make minikube-push` which will send all of Agones's docker images from your local Docker into the Agones Minikube 296 instance. 297 298 Now that the images are pushed, to install the development version, 299 run `make minikube-install` and Agones will install the images that you built and pushed to the Agones Minikube instance 300 (if you want to see the resulting installation yaml, you can find it in `build/.install.yaml`). 301 302 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), 303 and build directly on Minikube, but in this case this approach is far simpler, 304 and makes cross-platform support for the build system much easier. 305 306 To push your own images into the cluster, take a look at Minikube's 307 [Pushing Images](https://minikube.sigs.k8s.io/docs/handbook/pushing/) guide. 308 309 Running end-to-end tests on Minikube can be done via the `make minikube-test-e2e` target, but this can often overwhelm a local minikube cluster, so use at your own risk. Take a look at [Running Individual End-to-End Tests](#running-individual-end-to-end-tests) to run individual tests on a case by case basis. 310 311 If you are getting issues connecting to `GameServers` running on minikube, check the 312 [Agones minikube](https://agones.dev/site/docs/installation/creating-cluster/minikube/) documentation. You may need to 313 change the driver version through the `MINIKUBE_DRIVER` variable. See the 314 [local-includes](#set-local-make-targets-and-variables-with-local-includes) on how to change this permanently on 315 your development machine. 316 317 ### Running a Test Kind cluster 318 This will setup a [Kubernetes IN Docker](https://github.com/kubernetes-sigs/kind) cluster named agones by default. 319 320 Because Kind runs on a docker on the host, some of the standard build and development Make targets 321 need to be replaced by kind specific targets. 322 323 First, [install Kind](https://github.com/kubernetes-sigs/kind#installation-and-usage). 324 325 Next we will create the Agones Kind cluster. Run `make kind-test-cluster` to create the `agones` Kubernetes cluster. 326 327 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`. 328 329 You can verify that your new cluster information by running (if you don't have kubectl you can skip to the shell section): 330 331 ``` 332 KUBECONFIG=$(kind get kubeconfig-path --name=agones) kubectl cluster-info 333 ``` 334 335 Great! Now we are setup, we also provide a development shell with a handful set of tools like kubectl and helm. 336 337 Run `make kind-shell` to enter the development shell. You should see a bash shell that has you as the root user. 338 Enter `kubectl get pods` and press enter. You should see that you have no resources currently, but otherwise see no errors. 339 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. 340 341 You may remember in the first part of this walkthrough, we ran `make build-images`, which created all the images and binaries 342 we needed to work with Agones locally. We can push these images them straight into kind very easily! 343 344 Run `make kind-push` which will send all of Agones's docker images from your local Docker into the Agones Kind container. 345 346 Now that the images are pushed, to install the development version, 347 run `make kind-install` and Agones will install the images that you built and pushed to the Agones Kind cluster. 348 349 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. 350 351 352 **Note:** By default, KIND creates a single control-plane node, which is subject to the Kubernetes pod-per-node limit (about 110 pods). For e2e tests, you may want to create additional worker nodes to ensure enough pod availability. You can do this by providing a custom KIND config file when creating the cluster: 353 354 ```yaml 355 kind: Cluster 356 apiVersion: kind.x-k8s.io/v1alpha4 357 nodes: 358 - role: control-plane 359 - role: worker 360 - role: worker 361 ``` 362 363 Create the cluster with: 364 ```sh 365 kind create cluster --name agones --config <your-config.yaml> 366 ``` 367 368 This will ensure enough pod capacity for e2e tests. 369 370 If you are having performance issues, check out these docs [here](https://kind.sigs.k8s.io/docs/user/quick-start/#creating-a-cluster) 371 372 ### Running a Custom Test Environment 373 374 This section is addressed to developers using a custom Kubernetes provider, a custom image repository and/or multiple test clusters. 375 376 Prerequisites: 377 - a(some) running k8s cluster(s) 378 - Have kubeconfig file(s) ready 379 - docker must be logged into the image repository you're going to use 380 381 To begin, you need to set up the following environment variables: 382 - `KUBECONFIG` should point to the kubeconfig file used to access the cluster; 383 if unset, it defaults to `~/.kube/config` 384 - `REGISTRY` should point to your image repository of your choice (i.e. us-docker.pkg.dev/<YOUR-PROJECT-ID>/<YOUR-REGISTRY-NAME>) 385 - `IMAGE_PULL_SECRET` must contain the name of the secret required to pull the Agones images, 386 in case you're using a custom repository; if unset, no pull secret will be used 387 - `IMAGE_PULL_SECRET_FILE` must be initialized to the full path of the file containing 388 the secret for pulling the Agones images, in case of a custom image repository; 389 if set, `make install` will install this secret in both the `agones-system` (for pulling the controller image) 390 and `default` (for pulling the sdk image) repositories 391 392 Now you're ready to begin the development/test cycle: 393 - `make build` will build Agones 394 - `make test` will run local tests, which includes `site-test` target 395 - `make push` will push the Agones images to your image repository 396 - `make install` will install/upgrade Agones into your cluster 397 - `make test-e2e` will run end-to-end tests in your cluster 398 399 If you need to clean up your cluster, you can use `make uninstall` to remove Agones. 400 401 ### Common Development Flows 402 403 You can combine some of the above steps into a single one, for example `make build-images push install` is very 404 common flow, to build you changes on Agones, push them to a container registry and install this development 405 version to your cluster. 406 407 Another would be to run `make lint test-go` to run the golang linter against the Go code, and then run all the unit 408 tests. 409 410 ### Set Local Make Targets and Variables with `local-includes` 411 412 If you want to permanently set `Makefile` variables or add targets to your local setup, all `local-includes/*.mk` 413 are included into the main `Makefile`, and also ignored by the git repository. 414 415 Therefore, you can add your own `.mk` files in the [`local-includes`](./local-includes) directory without affecting 416 the shared git repository. 417 418 For examaple, if I only worked with Linux images for Agones, I could permanently turn off Windows and Arm64 images, 419 by writing a `images.mk` within that folder, with the following contents: 420 421 ```makefile 422 # Just Linux 423 WITH_WINDOWS=0 424 WITH_ARM64=0 425 ``` 426 427 ### Running Individual End-to-End Tests 428 429 When you are working on an individual feature of Agones, it doesn't make sense to run the entire end-to-end suite of 430 tests (and it can take a really long time!). 431 432 The end-to-end tests within the [`tests/e2e`](../test/e2e) folder are plain 433 [Go Tests](https://go.dev/doc/tutorial/add-a-test) that will use your local `~/.kube` configuration to connect and 434 run against the currently active local cluster. 435 436 This means you can run individual e2e tests from within your IDE or as a `go` command. 437 438 For example: 439 440 ```shell 441 go test -race -run ^TestCreateConnect$ 442 ``` 443 444 #### Troubleshooting 445 If you run into cluster connection issues, this can usually be resolved by running any kind of authenticated `kubectl` 446 command from within `make shell` or locally, to refresh your authentication token. 447 448 ## Make Variable Reference 449 450 ### VERSION 451 The version of this build. Version defaults to the short hash of the latest commit. 452 453 ### REGISTRY 454 The registry that is being used to store docker images. It doesn't have default value and has to be set explicitly. 455 456 ### CHARTS_REGISTRY 457 The chart registry that is being used to store helm charts. It doesn't have default value and has to be set explicitly. 458 If not set it would use the `GCP_BUCKET_CHARTS`. 459 460 ### KUBECONFIG 461 The Kubernetes config file used to access the cluster. Defaults to `~/.kube/config` - the file used by default by kubectl. 462 463 ### CLUSTER_NAME 464 The (gcloud) test cluster that is being worked against. Defaults to `test-cluster`. 465 466 ### GCP_PROJECT 467 Your GCP project for deploying GKE cluster. Defaults to gcloud default project settings. 468 469 ### GKE_PASSWORD 470 If specified basic authentication would be enabled for your cluster with username "admin". 471 Empty string `""` would disable basic authentication. 472 473 ### IMAGE_PULL_SECRET 474 The name of the secret required to pull the Agones images, if needed. 475 If unset, no pull secret will be used. 476 477 ### IMAGE_PULL_SECRET_FILE 478 The full path of the file containing the secret for pulling the Agones images, in case it's needed. 479 480 If set, `make install` will install this secret in both the `agones-system` (for pulling the controller image) 481 and `default` (for pulling the sdk image) repositories. 482 483 ### WITH_WINDOWS 484 Build Windows container images for Agones. 485 486 This option is enabled by default via implicit `make WITH_WINDOWS=1 build-images`. 487 To disable, use `make WITH_WINDOWS=0 build-images`. 488 489 ### WINDOWS_VERSIONS 490 List of Windows Server versions to build for. Defaults to `ltsc2019` for Windows Server 2019. 491 See https://hub.docker.com/_/microsoft-windows-servercore for all available Windows versions. 492 493 ### WITH_ARM64 494 Build ARM64 container images for Agones 495 496 This option is enabled by default via implicit `make WITH_ARM64=1 build-images`. 497 To disable, use `make WITH_ARM64=0 build-images`. 498 499 ### MINIKUBE_DRIVER 500 501 Which [driver](https://minikube.sigs.k8s.io/docs/drivers/) to use with a Minikube test cluster. 502 503 Defaults to "docker". 504 505 ## Make Target Reference 506 507 All targets will create the build image if it is not present. 508 509 ### Development Targets 510 511 Targets for developing with the build image. 512 513 #### `make build` 514 Build all the images required for Agones, as well as the SDKs 515 516 #### `make build-images` 517 Build all the images required for Agones 518 519 #### `make build-sdks` 520 Build all the sdks required for Agones 521 522 #### `make build-sdk` 523 Next command `make build-sdk SDK_FOLDER=[SDK_TYPE]` will build SDK of `SDK_TYPE`. 524 For instance, in order to build the cpp sdk static and dynamic libraries (linux libraries only) use `SDK_FOLDER=cpp` 525 526 #### `make run-sdk-command` 527 Next command `make run-sdk-command COMMAND=[COMMAND] SDK_FOLDER=[SDK_TYPE]` will execute command for `SDK_TYPE`. 528 For instance, in order to generate swagger codes when you change swagger.json definition, use `make run-sdk-command COMMAND=gen SDK_FOLDER=restapi` 529 530 #### `make run-sdk-conformance-local` 531 Run Agones sidecar which would wait for all requests from the SDK client. 532 Note that annotation should contain UID and label should contain CreationTimestamp values to pass the test. 533 534 #### `make run-sdk-conformance-no-build` 535 Only run a conformance test for a specific Agones SDK. 536 537 #### `make run-sdk-conformance-test` 538 Build, run and clean conformance test for a specific Agones SDK. 539 540 #### `make run-sdk-conformance-tests` 541 Run SDK conformance test. 542 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. 543 544 #### `make clean-sdk-conformance-tests` 545 Clean leftover binary and package files after running SDK conformance tests. 546 547 #### `make test` 548 Run the go tests, the sdk tests, the website tests and yaml tests. 549 550 #### `make test-go` 551 Run only the golang tests 552 553 #### `make lint` 554 Lint the Go code 555 556 #### `make build-examples` 557 Run `make build` for all `examples` subdirectories 558 559 #### `make site-server` 560 Generate `https://agones.dev` website locally and host on `http://localhost:1313` 561 562 #### `make hugo-test` 563 Check the links in a website 564 565 #### `make site-test` 566 Check the links in a website, includes `test-gen-api-docs` target 567 568 #### `make site-images` 569 Create all the site images from dot and puml diagrams in /site/static/diagrams 570 571 #### `make gen-api-docs` 572 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 573 574 #### `make test-gen-api-docs` 575 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) 576 577 #### `make push` 578 Pushes all built images up to the `$(REGISTRY)` 579 580 #### `make install` 581 Installs the current development version of Agones into the Kubernetes cluster 582 583 #### `make uninstall` 584 Removes Agones from the Kubernetes cluster 585 586 #### `make update-allocation-certs` 587 Updates the Agones installation with the IP of the Allocation LoadBalancer, thereby creating a valid certificate 588 for the Allocation gRPC endpoints. 589 590 The certificates are downloaded from the test kubernetes cluster and stored in ./build/allocation 591 592 #### `make test-e2e` 593 Runs end-to-end tests on the previously installed version of Agones. 594 These tests validate Agones flow from start to finish. 595 596 It uses the KUBECONFIG to target a Kubernetes cluster. 597 598 Use `GAMESERVERS_NAMESPACE` flag to provide a namespace or leave it empty in order to create and use a random one. 599 600 See [`make minikube-test-e2e`](#make-minikube-test-e2e) to run end-to-end tests on Minikube. 601 602 #### `make test-e2e-integration` 603 Runs integration portion of the end-to-end tests. 604 605 Pass flags to [go test](https://golang.org/cmd/go/#hdr-Testing_flags) command 606 using the `ARGS` parameter. For example, to run only the `TestGameServerReserve` test: 607 608 ```bash 609 make test-e2e-integration ARGS='-run TestGameServerReserve' 610 ``` 611 612 #### `make test-e2e-failure` 613 Run controller failure portion of the end-to-end tests. 614 615 #### `make test-e2e-allocator-crash` 616 Run allocator failure portion of the end-to-end test. 617 618 #### `make setup-prometheus` 619 620 Install Prometheus server using [Prometheus Community](https://prometheus-community.github.io/helm-charts) 621 chart into the current cluster. 622 623 By default all exporters and alertmanager is disabled. 624 625 You can use this to collect Agones [Metrics](../site/content/en/docs/Guides/metrics.md). 626 627 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. 628 629 #### make helm-repo-update 630 631 Run helm repo update to get the mose recent charts. 632 633 #### `make setup-grafana` 634 635 Install Grafana server using [grafana community](https://grafana.github.io/helm-charts) chart into 636 the current cluster and setup [Agones dashboards with Prometheus datasource](./grafana/). 637 638 You can set your own password using the `PASSWORD` environment variable. 639 640 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. 641 642 #### `make setup-prometheus-stack` 643 644 Install Prometheus-stack using [Prometheus Community](https://prometheus-community.github.io/helm-charts) chart into the current cluster. 645 646 By default only prometheus and grafana will installed, all exporters and alertmanager is disabled. 647 648 You can use this to collect Agones [Metrics](../site/content/en/docs/Guides/metrics.md) using ServiceMonitor. 649 650 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. 651 652 #### `make prometheus-portforward` 653 654 Sets up port forwarding to the 655 Prometheus deployment (port 9090 Prometheus UI). 656 657 On Windows and MacOS you will need to have installed [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/). 658 659 See [`make minikube-prometheus-portforward`](#make-minikube-prometheus-portforward) and [`make kind-prometheus-portforward`](#make-minikube-prometheus-portforward) to run on Minikube or Kind. 660 661 #### `make grafana-portforward` 662 663 Sets up port forwarding to the 664 grafana deployment (port 3000 UI). 665 666 On Windows and MacOS you will need to have installed [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/). 667 668 See [`make minikube-grafana-portforward`](#make-minikube-grafana-portforward) and [`make kind-grafana-portforward`](#make-minikube-grafana-portforward) to run on Minikube or Kind. 669 670 #### `make controller-portforward` 671 672 Sets up port forwarding to a specified PORT var (defaults to 8080 for controller metrics) to the 673 controller deployment. 674 675 #### `make pprof-cpu-web` 676 677 Start the web interface for pprof for cpu profiling. 678 679 #### `make pprof-heap-web` 680 681 Start the web interface for pprof for heap profiling. 682 683 #### `make shell` 684 Run a bash shell with the developer tools (go tooling, kubectl, etc) and source code in it. 685 686 #### `make pkgsite` 687 Run a container with pkgsite on port 8888 688 689 #### `make build-controller-image` 690 Compile the gameserver controller and then build the docker image 691 692 #### `make build-agones-sdk-image` 693 Compile the gameserver sidecar and then build the docker image 694 695 #### `make build-ping-image` 696 Compile the ping binary and then build the docker image 697 698 #### `make gen-install` 699 Generate the `/install/yaml/install.yaml` from the Helm template 700 701 #### `make gen-embedded-openapi` 702 Generate the embedded OpenAPI specs for existing Kubernetes Objects, such as `PodTemplateSpec` and `ObjectMeta`. 703 704 This should be run against a clean or brand new cluster, as external CRD's or schemas could cause errors to occur. 705 706 #### `make gen-crd-code` 707 Generate the Custom Resource Definition client(s), conversions, deepcopy, and defaults code. 708 709 #### `make gen-allocation-grpc` 710 Generate the allocator gRPC code 711 712 #### `make gen-all-sdk-grpc` 713 Generate the SDK gRPC server and client code for all SDKs. 714 715 #### `make gen-sdk-grpc` 716 Generate the SDK gRPC server and client code for a single SDK (specified in the `SDK_FOLDER` variable). 717 718 ### Build Image Targets 719 720 Targets for building the build image 721 722 #### `make clean-config` 723 Cleans the kubernetes and gcloud configurations 724 725 #### `make clean-build-image` 726 Deletes the local build docker image 727 728 #### `make build-build-image` 729 Creates the build docker image 730 731 ### Google Cloud Platform 732 733 A set of utilities for setting up a Kubernetes Engine cluster on Google Cloud Platform, 734 since it's an easy way to get a test cluster working with Kubernetes. 735 736 #### `make gcloud-init` 737 Initialise the gcloud login and project configuration, if you are working with GCP. 738 739 #### `make gcloud-test-cluster` 740 Creates and authenticates a GKE cluster to work against. 741 742 #### `make clean-gcloud-test-cluster` 743 Delete a GKE cluster previously created with `make gcloud-test-cluster`. 744 745 #### `make gcloud-auth-cluster` 746 Pulls down authentication information for kubectl against a cluster, name can be specified through CLUSTER_NAME 747 (defaults to 'test-cluster'). 748 749 #### `make gcloud-auth-docker` 750 Creates a short lived access to Google Cloud container repositories, so that you are able to call 751 `docker push` directly. Useful when used in combination with `make push` command. 752 753 ### Terraform 754 755 Utilities for deploying a Kubernetes Engine cluster on Google Cloud Platform using `google` Terraform provider. 756 757 #### `make gcloud-terraform-cluster` 758 Create GKE cluster and install release version of agones. 759 Run next command to create GKE cluster with agones (version from helm repository): 760 ``` 761 [GKE_PASSWORD="<YOUR_PASSWORD>"] make gcloud-terraform-cluster 762 ``` 763 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. 764 Also you can define password `password=<YOUR_PASSWORD>` string in `build/terraform.tfvars`. 765 Change AGONES_VERSION to a specific version you want to install. 766 767 #### `make gcloud-terraform-install` 768 Create GKE cluster and install current version of agones. 769 The current version should be built and pushed to `$(REGISTRY)` beforehand: 770 ``` 771 make build-images 772 make push 773 ``` 774 775 #### `make gcloud-terraform-destroy-cluster` 776 Run `terraform destroy` on your cluster. 777 778 #### `make terraform-clean` 779 Remove .terraform directory with configs as well as tfstate files. 780 781 ### Minikube 782 783 A set of utilities for setting up and running a [Minikube](https://github.com/kubernetes/minikube) instance, 784 for local development. 785 786 Since Minikube runs locally, there are some targets that need to be used instead of the standard ones above. 787 788 #### `make minikube-test-cluster` 789 Switches to an "agones" profile, and starts a kubernetes cluster 790 of the right version. Uses "docker" as the default driver. 791 792 If needed, use MINIKUBE_DRIVER variable to change the VM driver. 793 794 #### `make minikube-install` 795 796 Installs the current development version of Agones into the Kubernetes cluster. 797 Use this instead of `make install`, as it disables PullAlways on the install.yaml 798 799 #### `make minikube-push` 800 801 Push the local Agones Docker images that have already been built 802 via `make build` or `make build-images` into the "agones" minikube instance with `minikube cache add` 803 804 #### `make minikube-setup-prometheus` 805 806 Installs prometheus metric backend into the Kubernetes cluster. 807 Use this instead of `make setup-prometheus`, as it disables Persistent Volume Claim. 808 809 #### `make minikube-setup-grafana` 810 811 Installs grafana into the Kubernetes cluster. 812 Use this instead of `make setup-grafana`, as it disables Persistent Volume Claim. 813 814 #### `make minikube-setup-prometheus-stack` 815 816 Installs prometheus-stack into the Kubernetes cluster. 817 Use this instead of `make setup-prometheus-stack`, as it disables Persistent Volume Claim. 818 819 #### `make minikube-prometheus-portforward` 820 821 The minikube version of [`make prometheus-portforward`](#make-prometheus-portforward) to setup 822 port forwarding to the prometheus deployment. 823 824 #### `make minikube-grafana-portforward` 825 826 The minikube version of [`make grafana-portforward`](#make-grafana-portforward) to setup 827 port forwarding to the grafana deployment. 828 829 #### `make minikube-test-e2e` 830 Runs end-to-end tests on the previously installed version of Agones. 831 These tests validate Agones flow from start to finish. 832 833 ⚠ Running all the e2e tests can often overwhelm a local minikube cluster, so use at your own risk. You should look at 834 [Running Individual End-to-End Tests](#running-individual-end-to-end-tests) to run tests on a case by case basis. 835 836 #### `make minikube-shell` 837 Connecting to Minikube requires so enhanced permissions, so use this target 838 instead of `make shell` to start an interactive shell for development on Minikube. 839 840 #### `make minikube-controller-portforward` 841 The minikube version of [`make controller-portforward`](#make-controller-portforward) to setup 842 port forwarding to the controller deployment. 843 844 ### Kind 845 846 [Kind - kubernetes in docker](https://github.com/kubernetes-sigs/kind) is a tool for running local Kubernetes clusters using Docker container "nodes". 847 848 Since Kind runs locally, there are some targets that need to be used instead of the standard ones above. 849 850 #### `make kind-test-cluster` 851 Starts a local kubernetes cluster, you can delete it with `make kind-delete-cluster` 852 853 Use KIND_PROFILE variable to change the name of the cluster. 854 855 #### `make kind-push` 856 Push the local Agones Docker images that have already been built 857 via `make build` or `make build-images` into the "agones" Kind cluster. 858 859 #### `make kind-install` 860 Installs the current development version of Agones into the Kubernetes cluster. 861 Use this instead of `make install`, as it disables PullAlways on the install.yaml 862 863 #### `make kind-setup-prometheus` 864 865 Installs prometheus metric backend into the Kubernetes cluster. 866 Use this instead of `make setup-prometheus`, as it disables Persistent Volume Claim. 867 868 #### `make kind-setup-grafana` 869 870 Installs grafana into the Kubernetes cluster. 871 Use this instead of `make setup-grafana`, as it disables Persistent Volume Claim. 872 873 #### `make kind-setup-prometheus-stack` 874 875 Installs prometheus-stack into the Kubernetes cluster. 876 Use this instead of `make setup-prometheus-stack`, as it disables Persistent Volume Claim. 877 878 #### `make kind-prometheus-portforward` 879 880 The kind version of [`make prometheus-portforward`](#make-prometheus-portforward) to setup 881 port forwarding to the prometheus deployment. 882 883 #### `make kind-grafana-portforward` 884 885 The kind version of [`make grafana-portforward`](#make-grafana-portforward) to setup 886 port forwarding to the grafana deployment. 887 888 889 #### `make kind-test-e2e` 890 Runs end-to-end tests on the previously installed version of Agones. 891 These tests validate Agones flow from start to finish. 892 893 #### `make kind-shell` 894 Connecting to Kind requires so enhanced permissions, so use this target 895 instead of `make shell` to start an interactive shell for development on Kind. 896 897 #### `make kind-controller-portforward` 898 The Kind version of [`make controller-portforward`](#make-controller-portforward) to setup 899 port forwarding to the controller deployment. 900 901 ## Dependencies 902 903 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). 904 905 #### Vendoring 906 907 Agones uses [module vendoring](https://tip.golang.org/cmd/go/#hdr-Modules_and_vendoring) to reliably produce versioned builds with consistent behavior. 908 909 Adding a new dependency to Agones: 910 911 * `go mod tidy` This will import your new deps into the go.mod file and trim out any removed dependencies. 912 * `go mod vendor` Pulls module code into the vendor directory. 913 914 Sometimes the code added to vendor may not include a subdirectory that houses code being used but not as an import 915 (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. 916 917 Here is an example for getting third_party from grpc-ecosystem/grpc-gateway v1.5.1 into vendor: 918 919 * AGONES_PATH=/wherever/your/agones/path/is 920 * 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/ 921 922 Note the version in the pathname. Go may eliminate the need to do this in future versions. 923 924 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. 925 926 ## Running Performance Test 927 928 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: 929 930 #### Install a standard GKE cluster 931 932 Follow for more details here: https://agones.dev/site/docs/installation/creating-cluster/gke/ 933 934 #### Install Agones 935 936 Follow for more details here: https://agones.dev/site/docs/installation/install-agones/helm/ 937 938 #### Set up node for prometheus 939 940 ``` 941 gcloud container node-pools create agones-metrics --cluster={CLUSTER_NAME} --zone={REGION} \ 942 --node-taints agones.dev/agones-metrics=true:NoExecute \ 943 --node-labels agones.dev/agones-metrics=true \ 944 --num-nodes=1 \ 945 --machine-type=e2-standard-4 946 ``` 947 948 #### Install Prometheus, Grafana and port-forward 949 950 cd agones/ 951 952 https://agones.dev/site/docs/guides/metrics/#installation 953 954 #### Modify the performance-test.sh 955 956 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: 957 958 ``` 959 CLUSTER_NAME=agones-standard 960 CLUSTER_LOCATION=us-central1-c 961 REGISTRY=us-east1-docker.pkg.dev/user/agones 962 PROJECT=my-project 963 REPLICAS=10000 964 AUTO_SHUTDOWN_DELAY=60 965 BUFFER_SIZE=9900 966 MAX_REPLICAS=20000 967 DURATION=10m 968 CLIENTS=50 969 INTERVAL=1000 970 ``` 971 972 You might also want to comment out the first couple lines that come after the variables are set and also change the cd directoy: 973 974 ``` 975 # export SHELL="/bin/bash" 976 # mkdir -p /go/src/agones.dev/ 977 # ln -sf /workspace /go/src/agones.dev/agones 978 # cd /go/src/agones.dev/agones/build 979 980 # gcloud config set project $PROJECT 981 # gcloud container clusters get-credentials $CLUSTER_NAME \ 982 # --zone=$CLUSTER_LOCATION --project=$PROJECT 983 984 # make install LOG_LEVEL=info REGISTRY='"'$REGISTRY'"' DOCKER_RUN="" 985 986 # cd /go/src/agones.dev/agones/test/load/allocation 987 cd ../test/load/allocation 988 ``` 989 990 This script is an entyrpoint to be able to run the allocation performance test which can be found at `agones/test/load/allocation` 991 992 You can see the fleet and autoscaler configuration (such as buffer size and min/max replicas, etc) in the following files: 993 994 * [performance-test-fleet-template](https://github.com/googleforgames/agones/blob/main/test/load/allocation/performance-test-fleet-template.yaml) 995 * [performance-test-autoscaler-template.yaml](https://github.com/googleforgames/agones/blob/main/test/load/allocation/performance-test-autoscaler-template.yaml) 996 997 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. 998 999 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. 1000 1001 Finally, you can cd agones/build and run `sh performance-test.sh` if you see timeout issues please re-run the command. 1002 1003 ## Troubleshooting 1004 1005 Frequent issues and possible solutions 1006 1007 #### $GOPATH/$GOROOT error when building in WSL 1008 1009 If you get this error when building Agones in WSL (`make build`, `make test` or any other related target): 1010 1011 ```can't load package: package agones.dev/agones/cmd/controller: cannot find package "agones.dev/agones/cmd/controller" in any of: 1012 /usr/local/go/src/agones.dev/agones/cmd/controller (from $GOROOT) 1013 /go/src/agones.dev/agones/cmd/controller (from $GOPATH) 1014 ``` 1015 1016 - 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 1017 - 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) 1018 1019 #### Error: cluster-admin-binding already exists 1020 1021 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. 1022 1023 #### Error: releases do not exist 1024 1025 Run `make uninstall` then run `make install` again. 1026 1027 #### I want to use pprof to profile the controller. 1028 1029 Run `make build-images GO_BUILD_TAGS=profile` and this will build images with [pprof](https://golang.org/pkg/net/http/pprof/) 1030 enabled in the controller, which you can then push and install on your cluster. 1031 1032 To get the pprof ui working, run `make controller-portforward PORT=6060` (or `minikube-controller-portforward PORT=6060` if you are on minikube), 1033 which will setup the port forwarding to the pprof http endpoint. 1034 1035 To view CPU profiling, run `make pprof-cpu-web`, which will start the web interface with a CPU usage graph 1036 on [http://localhost:6061](http://localhost:6061). 1037 1038 To view heap metrics, run `make pprof-heap-web`, which will start the web interface with a Heap usage graph. 1039 on [http://localhost:6062](http://localhost:6062). 1040 1041 #### Error: Kubernetes cluster unreachable: invalid configuration: no configuration has been provided 1042 1043 If you run into this error while creating a test cluster run `make terraform-clean`. 1044 1045 #### Error: project: required field is not set Error: Invalid value for network: project: required field is not set 1046 1047 Run `make gcloud-init`. If you still get the same error, log into the developer 1048 shell `make shell` and run `gcloud init`. 1049 1050 #### Error: could not download chart: failed to download "https://agones.dev/chart/stable/agones-1.28.0.tgz" 1051 1052 Run `helm repo add agones https://agones.dev/chart/stable` followed by `helm repo update` which will add 1053 the latest stable version of the agones tar file to your ~/.cache/helm/repository/. 1054 1055 #### Invalid argument "/agones-controller:1.29.0-961d8ae-amd64" for "-t, --tag" flag: invalid reference format 1056 1057 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.