Skip to content

Commit

Permalink
JetBrains Tools workspace excluded from project
Browse files Browse the repository at this point in the history
How To run Oh My GLB documentation

Prerequisites setup

Local installation

See if everything is well installed

See if everything running smoothly

Cleaning

Update main README.md

Add terratest into Makefile
  • Loading branch information
kuritka committed Apr 14, 2020
1 parent 3ab2abe commit b97b9a2
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,9 @@ tags
.history
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode

### JetBrains GoLand workspace ###
.idea
# End of idea tools

# Exclude chart tar.gz files
chart/ohmyglb/charts/
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ lint:
test:
go test -v ./pkg/controller/gslb/

.PHONY: terratest
terratest: test
cd terratest/test/ && go mod download && go test -v

.PHONY: e2e-test
e2e-test: deploy-gslb-operator
operator-sdk test local ./pkg/test --no-setup --namespace ohmyglb
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Please see the extended documentation [here](/docs/index.md)

### Local Playground

If you need quickly spin-up local environment including all prerequisites, follow [How to run OhMyGLB document](./docs/how-to-run-ohmyglb.md)

#### Deploy local cluster

```sh
Expand Down
105 changes: 105 additions & 0 deletions docs/how-to-run-ohmyglb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# How to run Oh My GLB locally

- [Overview](#overview)
- [Environment prerequisites](#environment-prerequisites)
- [Running project locally](#running-project-locally)
- [See if everything is well installed](#see-if-everything-is-well-installed)
- [See if everything running smoothly](#see-if-everything-running-smoothly)
- [Cleaning](#cleaning)

## Overview
The document helps contributors participating on GSLB to install local environment.
It is not intend to force you to strictly follow the document, but it can help you to
avoid troubles related setup local environment.


![](./images/specialist2.jpg)

## Environment prerequisites

- install **GO 1.14**
- ensure you have standard GO folder structure created and $GOPATH, $GOROOT are properly set.

- install **GIT**
- ensure SSH key is set for your account; see https://github.com/settings/keys

- install **gnu-sed** if you don't have it
- update $PATH in `~/.bash_profile` by sed path `export PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH`

- install **Docker**
- ensure you are able to push/pull from your docker registry
- to run multiple clusters reserve 8GB of memory

![](./images/docker_settings.png)

- install **Kubectl** to operate clusters

- install **Helm** to get charts
- add default repo
```shell script
helm repo add stable https://kubernetes-charts.storage.googleapis.com
```

- install **kind** as tool for running local Kubernetes clusters
- follow https://kind.sigs.k8s.io/docs/user/quick-start/


## Running project locally
Follow instructions [here](../README.md) if you are deploying local cluster step by step. You can remove it any time by calling
```shell script
make destroy-local-cluster
```

To spin-up local environment you start two clusters deployment with test application on the top of it. Just execute command below and that's all.
```shell script
make deploy-full-local-setup
```
## See if everything is well installed
If local setup runs well, check if clusters are correctly installed
```shell script
kubectl cluster-info --context kind-test-gslb1 && kubectl cluster-info --context kind-test-gslb2
```
Cluster [test-gslb1](../deploy/kind/cluster.yaml) is exposing external DNS on default port `:53`
while [test-gslb2](../deploy/kind/cluster2.yaml) on port `:54`.
```shell script
dig @localhost localtargets.app3.cloud.example.com && dig -p54 @localhost localtargets.app3.cloud.example.com
```
As expected result you should see **six A records** divided between nodes of both clusters.
```shell script
...
...
;; ANSWER SECTION:
localtargets.app3.cloud.example.com. 30 IN A 172.17.0.2
localtargets.app3.cloud.example.com. 30 IN A 172.17.0.5
localtargets.app3.cloud.example.com. 30 IN A 172.17.0.3
...
...
localtargets.app3.cloud.example.com. 30 IN A 172.17.0.8
localtargets.app3.cloud.example.com. 30 IN A 172.17.0.6
localtargets.app3.cloud.example.com. 30 IN A 172.17.0.7
```
Both clusters have [podinfo](https://github.com/stefanprodan/podinfo) installed on the top.
Run following command and check if you get two json responses.
```shell script
curl localhost:80 -H "Host:app3.cloud.example.com" && curl localhost:81 -H "Host:app3.cloud.example.com"
```
## See if everything running smoothly
There is wide range of scenarios which [GSLB](../README.md) provides and all of them are covered within [tests](../terratest).
To check whether everything is running properly execute [terratests](https://terratest.gruntwork.io/) :
```shell script
make terratest
```
## Cleaning
From any reason you are killing clusters?
```shell script
make destroy-full-local-setup
```
Binary file added docs/images/docker_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/specialist2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b97b9a2

Please sign in to comment.