Skip to content

Commit

Permalink
Split development into subsections and removed some old tutorials (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
javier-op committed Jul 19, 2022
1 parent 5656dc5 commit 8a99544
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 318 deletions.
318 changes: 0 additions & 318 deletions docs/development.md

This file was deleted.

21 changes: 21 additions & 0 deletions docs/development/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
layout: default
title: Development
nav_order: 14
has_children: true
---

# Development

This section contains development notes and tips for working with Thundernetes source code.

## Kubebuilder notes

Project was bootstrapped using [kubebuilder](https://github.com/kubernetes-sigs/kubebuilder) using the following commands:

```bash
kubebuilder init --domain playfab.com --repo github.com/playfab/thundernetes/pkg/operator
kubebuilder create api --group mps --version v1alpha1 --kind GameServer
kubebuilder create api --group mps --version v1alpha1 --plural gameserverbuilds --kind GameServerBuild
kubebuilder create api --group mps --version v1alpha1 --plural gameserverdetails --kind GameServerDetail
```
35 changes: 35 additions & 0 deletions docs/development/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: default
title: Debugging
parent: Development
nav_order: 1
---

# Debugging

To test your local code you have 2 options: you can run the code in a local kind cluster, or you can build local container images, upload them to a container registry, and then deploy them to a cluster.

## Run end to end tests locally

This command will run the e2e tests locally, and it won't delete the cluster after it's done, so you can either deploy more GameServerBuilds or check the ones used for the tests under the `e2e` namespace.

```bash
make clean deletekindcluster builddockerlocal createkindcluster e2elocal
```

### Running end to end tests on macOS

First of all, end to end tests require `envsubst` utility, assuming that you have Homebrew installed you can get it via `brew install gettext && brew link --force gettext`.
We assume that you have installed Go, then you should install kind with `go install sigs.k8s.io/kind@latest`. Kind will be installed in `$(go env GOPATH)/bin` directory. Then, you should move kind to the `<projectRoot>/operator/testbin/bin/` folder with a command like `cp $(go env GOPATH)/bin/kind ./operator/testbin/bin/kind`. You can run end to end tests with `make clean builddockerlocal createkindcluster e2elocal`.

## Test your changes on a cluster

To test your changes to Thundernetes on a Kubernetes cluster, you can use the following steps:

- The Makefile on the root of the project contains a variable `NS` that points to the container registry that you use during development. So you'd need to either set the variable in your environment (`export NS=<your-container-registry>`) or set it before calling `make` (like `NS=<your-container-registry> make build push`).
- Login to your container registry (`docker login`)
- Run `make clean build push` to build the container images and push them to your container registry
- Run `create-install-files-dev` to create the install files for the cluster
- Checkout the `installfilesdev` folder for the generated install files. This file is included in .gitignore so it will never be committed.
- Test your changes as required.
- single command: `NS=docker.io/<repo>/ make clean build push create-install-files-dev`
Loading

0 comments on commit 8a99544

Please sign in to comment.