Merge pull request #34 from akram/update-doc-to-developing-with-remote-k8s

Add documentation to allow development with remote k8s server
This commit is contained in:
Tomasz Sęk 2019-06-22 10:00:27 +02:00 committed by GitHub
commit e441c746d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 1 deletions

View File

@ -7,6 +7,7 @@ This document explains how to setup your development environment.
- [operator_sdk][operator_sdk]
- [git][git_tool]
- [go][go_tool] version v1.12+
- [goimports, golint, checkmake and staticcheck][install_dev_tools]
- [minikube][minikube] version v1.1.0+ (preferred Hypervisor - [virtualbox][virtualbox])
- [docker][docker_tool] version 17.03+
@ -36,6 +37,20 @@ kubectl get jenkins -o yaml
kubectl get po
```
## Build and run with a remote cluster
If you are using a Linux development environment, you can also run the controller locally and make it listen to a remote
server.
```bash
export KUBECONFIG=$HOME/.crc/cache/crc_libvirt_4.1.0/kubeconfig
kubectl apply -f deploy/crds/jenkins_v1alpha2_jenkins_crd.yaml
```
You can then build and run the controller locally and make it connect to your server:
```bash
make build && OPERATOR_NAME=jenkins-operator WATCH_NAMESPACE=default build/_output/bin/jenkins-operator --kubeconfig $KUBECONFIG
```
## Testing
Run unit tests:
@ -94,4 +109,6 @@ kubectl get secret jenkins-operator-credentials-<cr_name> -o 'jsonpath={.data.pa
[kubectl_tool]:https://kubernetes.io/docs/tasks/tools/install-kubectl/
[minikube]:https://kubernetes.io/docs/tasks/tools/install-minikube/
[virtualbox]:https://www.virtualbox.org/wiki/Downloads
[jenkins-operator]:../README.md
[jenkins-operator]:../README.md
[install_dev_tools]:./install_dev_tools.md

42
docs/install_dev_tools.md Normal file
View File

@ -0,0 +1,42 @@
# Installation of the required development tools
This document explains how to install the Go tools used by the development process.
## goimports
```
go get golang.org/x/tools/cmd/goimports
cd $GOPATH/src/golang.org/x/tools/cmd/goimports
go build
go install
```
## golint
```
go get -u golang.org/x/lint/golint
cd $GOPATH/src/golang.org/x/lint/golint
go build
go install
```
## checkmake
```
go get github.com/mrtazz/checkmake
cd $GOPATH/src/github.com/mrtazz/checkmake
go build
go install
```
## staticcheck
```
mkdir -p $GOPATH/src/github.com/dominikh/
cd $GOPATH/src/github.com/dominikh/
git clone https://github.com/dominikh/go-tools.git
cd $GOPATH/src/github.com/dominikh/go-tools/staticcheck
go build
go install
```