-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
145 additions
and
0 deletions.
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,38 @@ | ||
# Contributing guidelines | ||
|
||
First off, thanks for taking the time to contribute! | ||
|
||
The following is a set of guidelines for contributing to this project, which are hosted in the FOSSIL Organization on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. | ||
|
||
## How to become a contributor | ||
|
||
### Feature Request | ||
|
||
If you have an idea to improve the feature of this project, feel free to open a [new feature issue](https://github.com/fossildev/ghost-operator/issues/new?assignees=&labels=&template=feature_request.md&title=) | ||
|
||
### Contributing A Code | ||
|
||
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests: | ||
|
||
1. Fork the repo and create your branch from `master`. | ||
2. If you've added code that should be tested, add tests. | ||
3. If you've changed APIs, update the documentation. | ||
4. Ensure the test suite passes. | ||
5. Make sure your code lints. | ||
6. Submit that pull request! | ||
|
||
#### Any contributions you make will be under the Apache License 2.0 | ||
|
||
In short, when you submit code changes, your submissions are understood to be under the same [Apache License 2.0](LICENSE) that covers the project. | ||
|
||
#### Code style | ||
|
||
The coding style suggested by the Golang community is used in this project. See the [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for details. | ||
|
||
### Reporting Bugs | ||
|
||
If you think you found a bug, please open a [new bug issue](https://github.com/fossildev/ghost-operator/issues/new?assignees=&labels=&template=bug_report.md&title=) | ||
|
||
## Development Guide | ||
|
||
For detail of development guide please refer to [docs/devel.md](docs/devel.md) |
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
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
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,93 @@ | ||
# Ghost Operator Development Guide | ||
|
||
## Getting Started | ||
|
||
This project is a regular [Kubernetes Operator](https://coreos.com/operators/) built using the Operator SDK. Refer to the Operator SDK documentation to understand the basic architecture of this operator. | ||
|
||
### Installing the Operator SDK command line tool | ||
|
||
Follow the installation guidelines from [Operator SDK GitHub page](https://github.com/operator-framework/operator-sdk) or run `make install-sdk`. | ||
|
||
### Developing | ||
|
||
The first step is to get a local Kubernetes instance up and running. You can use any tools as you want eg: [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/), [docker-for-desktop](https://docs.docker.com/docker-for-mac/install/) or [kind](https://github.com/kubernetes-sigs/kind#installation-and-usage). | ||
|
||
Most of development processes can be done with the `make` command. See available `make` command by executing | ||
|
||
``` | ||
make help | ||
``` | ||
|
||
Once local kubernetes has finished starting, apply the CustomResourceDefinitions: | ||
|
||
``` | ||
kubectl apply -f deploy/crds/ghost.fossil.or.id_ghostapps_crd.yaml | ||
``` | ||
|
||
Then you can get the Operator running: | ||
|
||
``` | ||
make run | ||
``` | ||
|
||
At this point, a GhostApp instance can be installed: | ||
|
||
``` | ||
kubectl apply -f deploy/example/ghost.fossil.or.id_v1alpha1_ghostapp_cr.yaml | ||
kubectl get ghostapp | ||
``` | ||
|
||
Example GhostApp status: | ||
|
||
``` | ||
NAME REPLICAS PHASE AGE | ||
example-ghostapp 1 Running 12s | ||
``` | ||
|
||
To remove the instance: | ||
|
||
``` | ||
kubectl delete -f deploy/example/ghost.fossil.or.id_v1alpha1_ghostapp_cr.yaml | ||
``` | ||
|
||
### Testing | ||
|
||
Tests should be simple unit tests and/or end-to-end tests. For small changes, unit tests should be sufficient, but every new feature should be accompanied with end-to-end tests as well. Tests can be executed with: | ||
|
||
``` | ||
make test | ||
``` | ||
|
||
The whole set of end-to-end tests can be executed via: | ||
|
||
``` | ||
make test-e2e | ||
``` | ||
|
||
> NOTE: the command above requires you to build the Docker image and push to container registry. You can see instruction to build Docker image bellow. | ||
Instead that, you can also run end-to-end tests locally with: | ||
|
||
``` | ||
make test-e2e-local | ||
``` | ||
|
||
### Build | ||
|
||
To build Docker image of this operator can be executed with: | ||
|
||
``` | ||
make build | ||
``` | ||
|
||
> NOTE: by default, command above will build Docker image with tag `fossildev/ghost-operator:latest`. You can adjust the Docker image tag by overriding the variable `IMAGE_TAG`, like: | ||
``` | ||
IMAGE_TAG=docker.io/yourusername/ghost-operator:latest make build | ||
``` | ||
|
||
Then you can push the Docker image as usually | ||
|
||
``` | ||
docker push docker.io/yourusername/ghost-operator:latest | ||
``` |