-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add how to install operator locally; fix telegram link #31
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f59c7d6
Add validating and defaulting webhooks and tests
sircthulhu 89f9d84
Merge branch 'main' into add-how-to-install
e8ef0cf
Merge branch 'main' into add-how-to-install
7bc0ba1
add how-to-start-development; fix tg link
23a1990
fix minor stuff
d381bc8
fix line that switches context
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# How to start contributing | ||
|
||
## Read kubebuilder documentation | ||
[Docs](https://book.kubebuilder.io/introduction) | ||
|
||
## Build your develop environment | ||
|
||
### Easy way | ||
1. Download and install [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#creating-a-cluster). | ||
2. Create lind cluster `kind create cluster --name etcd-operator-kind`. | ||
3. Switch kubectl context to kind `kubectl cluster-info --context kind-etcd-operator-kind`. Be attentive to avoid damaging your production environment. | ||
4. Install cert-manager (it creates certificate k8s secrets). Refer to the [docs](https://cert-manager.io/docs/installation/helm/#4-install-cert-manager). | ||
5. Build docker image *controller:latest* `make docker-build`. | ||
6. Retag image to upload to kind cluster with correct name `docker tag controller:latest ghcr.io/aenix-io/etcd-operator:latest`. | ||
7. Load image to kind cluster `kind load docker-image ghcr.io/aenix-io/etcd-operator:latest`. | ||
8. Install CRDs `make install`. | ||
9. Deploy operator, RBAC, webhook certs `make deploy`. | ||
|
||
To deploy your code changes | ||
1. Rebuild the image `make docker-build`. | ||
2. Retag image to upload to kind cluster with correct name `docker tag controller:latest ghcr.io/aenix-io/etcd-operator:latest`. | ||
3. Load image to kind cluster `kind load docker-image ghcr.io/aenix-io/etcd-operator:latest`. | ||
4. Redeploy yaml manifests if necessary `make deploy`. | ||
5. Restart etcd-operator `kubectl rollout restart -n etcd-operator-system deploy/etcd-operator-controller-manager`. | ||
|
||
### Advanced way | ||
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. | ||
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. | ||
|
||
**General steps** | ||
1. Install VSCode Kubernetes extension. | ||
2. Install VSCode Dev Containers extension. | ||
3. Create pvc to store operator code, go modules and your files. | ||
4. Build Dockerfile to create image for your develop environment (git, golang , etc...). Take base image that you love most. | ||
5. Patch operator deployment to | ||
* Attach PVC from step 3. | ||
* Change operator image to your image. | ||
* Change command and args to endless sleep loop. | ||
* Change rolling update strategy to recreate if you use RWO storage class. | ||
* Change security context RunAsNonRoot to false. | ||
* Increase requests and limits. | ||
* Remove readiness and liveness probes. | ||
6. Attach VSCode to a running container through Kubernetes extension. | ||
7. Install necessary extensions to the container. They will be preserved after container restart if you attached pvc to home directory. | ||
8. Run `go run cmd/main.go`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write it like
kubectl set-context kind-etcd-operator-kind
or something like that. The command you provided does not change context. Followingmake
commands will be executed against some other cluster :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, will have a look today.
Probably I accidentally copied the wrong line from my history. At least I executed everything against correct cluster :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sircthulhu fixed