Skip to content

Commit 34d962d

Browse files
Add how to install operator locally; fix telegram link (#31)
fixes #23 fixes #30 --------- Co-authored-by: Kirill Ilin <[email protected]> Co-authored-by: Kirill Garbar <[email protected]>
1 parent 9e35e26 commit 34d962d

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

HOW-TO-START-DEVELOPMENT.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# How to start contributing
2+
3+
## Read kubebuilder documentation
4+
[Docs](https://book.kubebuilder.io/introduction)
5+
6+
## Build your develop environment
7+
8+
### Easy way
9+
1. Download and install [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#creating-a-cluster).
10+
2. Create lind cluster `kind create cluster --name etcd-operator-kind`.
11+
3. Switch kubectl context to kind `kubectl config use-context kind-etcd-operator-kind`. Be attentive to avoid damaging your production environment.
12+
4. Install cert-manager (it creates certificate k8s secrets). Refer to the [docs](https://cert-manager.io/docs/installation/helm/#4-install-cert-manager).
13+
5. Build docker image *controller:latest* `make docker-build`.
14+
6. Retag image to upload to kind cluster with correct name `docker tag controller:latest ghcr.io/aenix-io/etcd-operator:latest`.
15+
7. Load image to kind cluster `kind load docker-image ghcr.io/aenix-io/etcd-operator:latest`.
16+
8. Install CRDs `make install`.
17+
9. Deploy operator, RBAC, webhook certs `make deploy`.
18+
19+
To deploy your code changes
20+
1. Rebuild the image `make docker-build`.
21+
2. Retag image to upload to kind cluster with correct name `docker tag controller:latest ghcr.io/aenix-io/etcd-operator:latest`.
22+
3. Load image to kind cluster `kind load docker-image ghcr.io/aenix-io/etcd-operator:latest`.
23+
4. Redeploy yaml manifests if necessary `make deploy`.
24+
5. Restart etcd-operator `kubectl rollout restart -n etcd-operator-system deploy/etcd-operator-controller-manager`.
25+
26+
### Advanced way
27+
Using *easy way* you will not be able to debug golang code locally and every change will be necessary to build as an image, upload to the cluster and then restart operator.
28+
If you use VSCode, you can connect your IDE to a pod in kubernetes cluster and use `go run cmd/main.go` from the pod. It will allow you to debug easily and faster integrate code changes to you develop environment.
29+
30+
**General steps**
31+
1. Install VSCode Kubernetes extension.
32+
2. Install VSCode Dev Containers extension.
33+
3. Create pvc to store operator code, go modules and your files.
34+
4. Build Dockerfile to create image for your develop environment (git, golang , etc...). Take base image that you love most.
35+
5. Patch operator deployment to
36+
* Attach PVC from step 3.
37+
* Change operator image to your image.
38+
* Change command and args to endless sleep loop.
39+
* Change rolling update strategy to recreate if you use RWO storage class.
40+
* Change security context RunAsNonRoot to false.
41+
* Increase requests and limits.
42+
* Remove readiness and liveness probes.
43+
6. Attach VSCode to a running container through Kubernetes extension.
44+
7. Install necessary extensions to the container. They will be preserved after container restart if you attached pvc to home directory.
45+
8. Run `go run cmd/main.go`.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[![Open Source](https://img.shields.io/badge/Open-Source-brightgreen)](https://opensource.org/)
55
[![Apache-2.0 License](https://img.shields.io/github/license/aenix-io/etcd-operator)](https://opensource.org/licenses/)
6-
[![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=flat&logo=telegram&logoColor=white)](https://t.me/etcd-operator)
6+
[![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=flat&logo=telegram&logoColor=white)](https://t.me/etcd_operator)
77
[![Active](http://img.shields.io/badge/Status-Active-green.svg)](https://aenix.io/etcd-operator/)
88
[![GitHub Release](https://img.shields.io/github/release/aenix-io/etcd-operator.svg?style=flat)](https://github.com/aenix-io/etcd-operator)
99
[![GitHub Commit](https://img.shields.io/github/commit-activity/y/aenix-io/etcd-operator)](https://github.com/aenix-io/etcd-operator)

0 commit comments

Comments
 (0)