Skip to content

Commit

Permalink
feat(main): add docs for automq operator
Browse files Browse the repository at this point in the history
Signed-off-by: cuisongliu <cuisongliu@qq.com>
  • Loading branch information
cuisongliu committed Oct 15, 2024
1 parent c33943e commit ddbe323
Show file tree
Hide file tree
Showing 3 changed files with 290 additions and 8 deletions.
220 changes: 220 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
If you don't understand the github open source project contribution process at all, it is strongly recommended to read: [first contributions](https://github.com/firstcontributions/first-contributions)

# Contributing to automq-operator

It is warmly welcomed if you have interest to hack on automq-operator. First, we encourage this kind of willing very much. And here is a list of contributing guide for you.

## Topics

- [Code and doc contribution](#code-and-doc-contribution)
- [Engage to help anything](#engage-to-help-anything)

## Code and doc contribution

Every action to make project automq-operator better is encouraged. On GitHub, every improvement for automq-operator be via a PR (short for pull request).

- If you find a typo, try to fix it!
- If you find a bug, try to fix it!
- If you find some redundant codes, try to remove them!
- If you find some test cases missing, try to add them!
- If you could enhance a feature, please **DO NOT** hesitate!
- If you find code implicit, try to add comments to make it clear!
- If you find code ugly, try to refactor that!
- If you can help to improve documents, it could not be better!
- If you find document incorrect, just do it and fix that!
- ...

Actually it is impossible to list them completely. Just remember one princinple:

> WE ARE LOOKING FORWARD TO ANY PR FROM YOU.
Since you are ready to improve automq-operator with a PR, we suggest you could take a look at the PR rules here.

- [Workspace Preparation](#workspace-preparation)
- [Branch Definition](#branch-definition)
- [Commit Rules](#commit-rules)
- [PR Description](#pr-description)
- [Developing Environment](#developing-environment)
- [Docs Contribution](#docs-contribution)

### Workspace Preparation

To put forward a PR, we assume you have registered a GitHub ID. Then you could finish the preparation in the following steps:

1. **FORK** automq-operator to your repository. To make this work, you just need to click the button Fork in right-left of [cuisongliu/automq-operator](https://github.com/cuisongliu/automq-operator) main page. Then you will end up with your repository in `https://github.com/<your-username>/automq-operator`, in which `your-username` is your GitHub username.

1. **CLONE** your own repository to master locally. Use `git clone https://github.com/<your-username>/automq-operator.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make.

1. **Set Remote** upstream to be `https://github.com/cuisongliu/automq-operator.git` using the following two commands:

```shell
git remote add upstream https://github.com/cuisongliu/automq-operator.git
git remote set-url --push upstream no-pushing
```

With this remote setting, you can check your git remote configuration like this:

```shell
$ git remote -v
origin https://github.com/<your-username>/automq-operator.git (fetch)
origin https://github.com/<your-username>/automq-operator.git (push)
upstream https://github.com/cuisongliu/automq-operator.git (fetch)
upstream no-pushing (push)
```

Adding this, we can easily synchronize local branches with upstream branches.

1. **Create a branch** to add a new feature or fix issues

Update local working directory and remote forked repository:

```shell
cd automq-operator
git fetch upstream
git checkout main
```

Create a new branch:

```shell
git checkout -b <new-branch>
```

Make any change on the `new-branch` then build and test your codes.
1. **Commit your changes** to your local branch, lint before committing and commit with sign-off
```shell
git rebase upstream/main
golangci-lint run -c .golangci.yml # lint
git add -A # add changes to staging
git commit -s -m "message for your changes" # -s adds a Signed-off-by trailer
```

1. **Push your branch** to your forked repository, it is recommended to have only one commit for a PR.

```shell
# sync up with upstream
git fetch upstream main
git rebase upstream/main

git rebase -i <commit-id> # rebase with interactive mode to squash your commits into a single one
git push # push to the remote repository, if it's a first time push, run git push --set-upstream origin <new-branch>
```

You can also use `git commit -s --amend && git push -f` to update modifications on the previous commit.

If you have developed multiple features in the same branch, you should create PR separately by rebasing to the main branch between each push:

```shell
# create new branch, for example git checkout -b feature/infra
git checkout -b <new branch>
# update some code, feature1
git add -A
git commit -m -s "feature one"
git push # if it's first time push, run git push --set-upstream origin <new-branch>
# then create pull request, and merge
# update some new feature, feature2, rebase main branch first.
git rebase upstream/main # rebase the current branch to upstream/main branch
git add -A
git commit -m -s "feature two"
# then create pull request, and merge
```

1. **File a pull request** to cuisongliu/automq-operator:master

It is recommended to review your changes before filing a pull request. Check if your code doesn't conflict with the main branch and no redundant code is included.

### Branch Definition

Right now we assume every contribution via pull request is for [branch master](https://github.com/cuisongliu/automq-operator/tree/master) in automq-operator. Before contributing, be aware of branch definition would help a lot.

As a contributor, keep in mind again that every contribution via pull request is for branch master. While in project automq-operator, there are several other branches, we generally call them rc branches, release branches and backport branches.

Before officially releasing a version, we will checkout a rc(release candidate) branch. In this branch, we will test more than branch main.

When officially releasing a version, there will be a release branch before tagging. After tagging, we will delete the release branch.

When backporting some fixes to existing released version, we will checkout backport branches. After backporting, the backporting effects will be in PATCH number in MAJOR.MINOR.PATCH of [SemVer](http://semver.org/).

### Commit Rules

Actually in automq-operator, we take two rules serious when committing:

- [Commit Message](#commit-message)
- [Commit Content](#commit-content)

#### Commit Message

Commit message could help reviewers better understand what the purpose of submitted PR is. It could help accelerate the code review procedure as well. We encourage contributors to use **EXPLICIT** commit message rather than ambiguous message. In general, we advocate the following commit message type:

- docs: xxxx. For example, "docs: add docs about storage installation".
- feature: xxxx.For example, "feature: make result show in sorted order".
- bugfix: xxxx. For example, "bugfix: fix panic when input nil parameter".
- style: xxxx. For example, "style: format the code style of Constants.java".
- refactor: xxxx. For example, "refactor: simplify to make codes more readable".
- test: xxx. For example, "test: add unit test case for func InsertIntoArray".
- chore: xxx. For example, "chore: integrate travis-ci". It's the type of mantainance change.
- other readable and explicit expression ways.

On the other side, we discourage contributors from committing message like the following ways:

- ~~fix bug~~
- ~~update~~
- ~~add doc~~

#### Commit Content

Commit content represents all content changes included in one commit. We had better include things in one single commit which could support reviewer's complete review without any other commits' help. In another word, contents in one single commit can pass the CI to avoid code mess. In brief, there are two minor rules for us to keep in mind:

- avoid very large change in a commit;
- complete and reviewable for each commit.

No matter what the commit message, or commit content is, we do take more emphasis on code review.

### PR Description

PR is the only way to make change to automq-operator project files. To help reviewers better get your purpose, PR description could not be too detailed. We encourage contributors to follow the [PR template](https://github.com/cuisongliu/automq-operator/tree/main/.github/PULL_REQUEST_TEMPLATE.md) to finish the pull request.

### Developing Environment

As a contributor, if you want to make any contribution to automq-operator project, we should reach an agreement on the version of tools used in the development environment.
Here are some dependents with specific version:

- golang : v1.23+

When you develop the automq-operator project at the local environment, you should use subcommands of Makefile to help yourself to check and build the latest version of automq-operator. For the convenience of developers, we use the docker to build automq-operator. It can reduce problems of the developing environment.

### Docs Contribution

#### Structure and Repo

The documentation for automq-operator includes:

- [README.md](https://github.com/cuisongliu/automq-operator/blob/main/README.md)
- [CONTRIBUTING.md](https://github.com/cuisongliu/automq-operator/blob/main/CONTRIBUTING.md)

#### Formatting

Please obey the following rules to better format the docs, which would greatly improve the reading experience.

1. Please do not use Chinese punctuations in English docs, and vice versa.
1. Please use upper case letters where applicable, like the first letter of sentences / headings, etc.
1. Please specify a language for each Markdown code blocks, unless there's no associated languages.
1. Please insert a whitespace between Chinese and English words.
1. Please use the correct case for technical terms, such as using HTTP instead of http, MySQL rather than mysql, Kubernetes instead of kubernetes, etc.
1. Please check if there's any typos in the docs before submitting PRs.

You can also check out the [Docusaurus docs](https://docusaurus.io/docs/markdown-features) to write docs with richer feature.

## Engage to help anything

We choose GitHub as the primary place for automq-operator to collaborate. So the latest updates of automq-operator are always here. Although contributions via PR is an explicit way to help, we still call for any other ways.

- reply to other's issues if you could;
- help solve other user's problems;
- help review other's PR design;
- help review other's codes in PR;
- discuss about automq-operator to make things clearer;
- advocate automq-operator technology beyond GitHub;
- write blogs on automq-operator and so on.

In a word, **ANY HELP IS CONTRIBUTION.**
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,7 @@ e2e: fmt vet envtest ## Run tests.

bindata:
go run gen/bindata/main.go

.PHONY: set-image
set-image:
@sed -i '/#replace_by_makefile/!b;n;c\image: ${IMG}' deploy/charts/automq-operator/values.yaml
74 changes: 66 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,77 @@ This [Kubernetes Operator](https://kubernetes.io/docs/concepts/extend-kubernetes

Goals:

- [ ] Automatically deploy and manage a AutoMQ cluster
- [ ] Ability to be managed by other Operators
- [ ] Auto rolling upgrade and restart
- [x] Automatically deploy and manage a AutoMQ cluster
- [x] Ability to be managed by other Operators
- [x] Auto rolling upgrade and restart
- [ ] Grafana dashboard
- [ ] Pod Affinity and Anti-Affinity

## Description
// TODO(user): An in-depth paragraph about your project and overview of use

AutoMQ is a message queue system that is designed to be easy to use and deploy. It is built on top of the [automq](https://www.automq.com) messaging system and provides a simple API for sending and receiving messages.

This operator is designed to make it easy to deploy AutoMQ onto your Kubernetes cluster. It will automatically deploy and manage a AutoMQ cluster, and can be managed by other Operators.

## Prerequisites

- Kubernetes 1.21+
- Helm 3.x.x
- StorageClass
- S3 storage ( minio, aws s3, etc )
- Cert-Manager


## Getting Started
// TODO(user): How to get started with using your project

## Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project
### Install sealos binary

```shell
```


### Installation Kubernetes

```shell
````

### Installation dependencies

```shell
```

### Installation Operator

1. Using sealos images install operator

```shell
```

2. Using helm chart install operator

```shell
git clone https://github.com/cuisongliu/automq-operator.git
cd automq-operator
IMG=ghcr.io/cuisongliu/automq-operator:latest make set-image
cd deploy
bash install.sh
```
### Install AutoMQ

```shell
```


### Uninstall Operator

```shell
```

## 👩‍💻 Contributing & Development

Have a look through [existing Issues](https://github.com/cuisongliu/automq-operator/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) and [Pull Requests](https://github.com/cuisongliu/automq-operator/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) that you could help with. If you'd like to request a feature or report a bug, please [create a GitHub Issue](https://github.com/cuisongliu/automq-operator/issues/new/choose) using one of the templates provided.
📖 [See contribution guide →](./CONTRIBUTING.md)
### How it works
This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).
Expand All @@ -43,7 +101,7 @@ make run
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
```sh
make manifests
make generate && make manifests
```
**NOTE:** Run `make --help` for more information on all potential `make` targets
Expand Down

0 comments on commit ddbe323

Please sign in to comment.