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
0 parents
commit 3afa14f
Showing
6,607 changed files
with
2,354,132 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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,35 @@ | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
*.exe | ||
*.test | ||
*.prof | ||
|
||
.DS_Store | ||
|
||
/.vscode | ||
/redis-operator | ||
/coverage.txt | ||
/bin | ||
/dist | ||
/test/e2e/e2e.test | ||
/.envrc | ||
|
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,5 @@ | ||
# CHANGELOG | ||
|
||
## Next release | ||
|
||
- redis-operator implementation with CRD |
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,73 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, gender identity and expression, level of experience, | ||
education, socio-economic status, nationality, personal appearance, race, | ||
religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team at cedric.lamoriniere@gmail.com. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct.html]( https://www.contributor-covenant.org/version/1/4/code-of-conduct.html) | ||
|
||
[homepage](https://www.contributor-covenant.org) |
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,156 @@ | ||
# Contributing | ||
|
||
By participating to this project, you agree to abide our [code of | ||
conduct](/CODE_OF_CONDUCT.md). | ||
|
||
## Setup your machine | ||
|
||
`redis-operator` is written in [Go](https://golang.org/). | ||
|
||
Prerequisites: | ||
|
||
* `make` | ||
* [Go 1.8+](https://golang.org/doc/install) | ||
* [Docker](https://www.docker.com/) | ||
* [Minikube](https://github.com/kubernetes/minikube) | ||
* [Helm](https://helm.sh) | ||
|
||
Clone `redis-operator` from source into `$GOPATH`: | ||
|
||
```console | ||
$ mkdir -p $GOPATH/src/github.com/amadeusitgroup | ||
$ cd $_ | ||
$ git clone git@github.com:amadeusitgroup/redis-operator.git | ||
Cloning into 'redis-operator'... | ||
$ cd redis-operator | ||
``` | ||
|
||
Install the build and lint dependencies: | ||
|
||
```console | ||
$ make setup | ||
# install all developement dependencies | ||
``` | ||
|
||
A good way of making sure everything is all right is running the test suite: | ||
|
||
```console | ||
$ make test | ||
./go.test.sh | ||
ok github.com/amadeusitgroup/redis-operator/pkg/controller 1.520s coverage: 0.0% of statements | ||
ok github.com/amadeusitgroup/redis-operator/pkg/controller/clustering 1.539s coverage: 26.9% of statements | ||
ok github.com/amadeusitgroup/redis-operator/pkg/process 1.031s coverage: 100.0% of statements | ||
ok github.com/amadeusitgroup/redis-operator/pkg/redis 1.570s coverage: 26.7% of statements | ||
ok github.com/amadeusitgroup/redis-operator/pkg/redis/fake 1.026s coverage: 84.7% of statements | ||
``` | ||
|
||
## Test your change | ||
|
||
You can create a branch for your changes and try to build from the source as you go: | ||
|
||
```console | ||
$ make build | ||
CGO_ENABLED=0 go build -i -installsuffix cgo -ldflags '-w' -o bin/operator ./cmd/operator | ||
CGO_ENABLED=0 go build -i -installsuffix cgo -ldflags '-w' -o bin/redisnode ./cmd/redisnode | ||
``` | ||
|
||
When you are satisfied with the changes, we suggest you run: | ||
|
||
```console | ||
$ make test | ||
$ make lint | ||
gometalinter --vendor ./... -e pkg/client -e _generated -e test --deadline 2m -D gocyclo -D errcheck -D aligncheck | ||
OK | ||
``` | ||
|
||
Which runs all the linters and unit-tests. | ||
|
||
### End-to-end test | ||
you can run some end-to-end tests. For that you need to have a running Kubernetes cluster. You can use `minikube`. The deployment is done thanks to [Helm](https://helm.sh). | ||
|
||
```console | ||
$ minikube start --extra-config=apiserver.Authorization.Mode=RBAC | ||
minikube start | ||
Starting local Kubernetes v1.9.4 cluster... | ||
Starting VM... | ||
Getting VM IP address... | ||
Moving files into cluster... | ||
Setting up certs... | ||
Connecting to cluster... | ||
Setting up kubeconfig... | ||
Starting cluster components... | ||
Kubectl is now configured to use the cluster. | ||
Loading cached images from config file. | ||
$ kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default | ||
clusterrolebinding "add-on-cluster-admin" created | ||
$ helm init --wait | ||
$HELM_HOME has been configured at /Users/clamoriniere/.helm. | ||
|
||
Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster. | ||
Happy Helming! | ||
``` | ||
|
||
Then you need to deploy the `redis-operator` on the kubernetes cluster. | ||
|
||
```console | ||
$ eval $(minikube docker-env) | ||
# this will configure your docker cli, to target the minikube docker deamon | ||
$ make TAG=latest container | ||
CGO_ENABLED=0 GOOS=linux go build -i -installsuffix cgo -ldflags '-w' -o docker/operator/operator ./cmd/operator/main.go | ||
CGO_ENABLED=0 GOOS=linux go build -i -installsuffix cgo -ldflags '-w' -o docker/redisnode/redisnode ./cmd/redisnode/main.go | ||
$ make TAG=4.0 container | ||
... | ||
$ helm install --wait --name op chart/redis-operator | ||
NAME: op | ||
LAST DEPLOYED: Tue Jan 9 23:41:13 2018 | ||
NAMESPACE: default | ||
STATUS: DEPLOYED | ||
|
||
RESOURCES: | ||
==> v1beta1/Deployment | ||
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE | ||
op-redis-operator 1 1 1 0 0s | ||
``` | ||
|
||
When the `redis-operator` pod is up and running, you can start the e2e regression. | ||
|
||
```console | ||
$ cd test/e2e && go test --kubeconfig ~/.kube/config | ||
Running Suite: RedisCluster Suite | ||
================================= | ||
Random Seed: 1515571968 | ||
Will run 1 of 1 specs | ||
|
||
Ran 1 of 1 Specs in 35.222 seconds | ||
SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped PASS | ||
ok github.com/amadeusitgroup/redis-operator/test/e2e 35.288s | ||
``` | ||
|
||
## Create a commit | ||
|
||
Commit messages should be well formatted. | ||
Start your commit message with the type. Choose one of the following: | ||
`feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `revert`, `add`, `remove`, `move`, `bump`, `update`, `release` | ||
|
||
After a colon, you should give the message a title, starting with uppercase and ending without a dot. | ||
Keep the width of the text at 72 chars. | ||
The title must be followed with a newline, then a more detailed description. | ||
|
||
Please reference any GitHub issues on the last line of the commit message (e.g. `See #123`, `Closes #123`, `Fixes #123`). | ||
|
||
An example: | ||
|
||
``` | ||
docs: Add example for --release-notes flag | ||
I added an example to the docs of the `--release-notes` flag to make | ||
the usage more clear. The example is an realistic use case and might | ||
help others to generate their own changelog. | ||
See #284 | ||
``` | ||
|
||
## Submit a pull request | ||
|
||
Push your branch to your `redis-operator` fork and open a pull request against the | ||
master branch. |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Amadeus s.a.s. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,71 @@ | ||
ARTIFACT_OPERATOR=redis-operator | ||
ARTIFACT_INITCONTAINER=init-container | ||
|
||
# 0.0 shouldn't clobber any released builds | ||
PREFIX=redisoperator/ | ||
#PREFIX = gcr.io/google_containers/ | ||
|
||
SOURCES := $(shell find $(SOURCEDIR) ! -name "*_test.go" -name '*.go') | ||
|
||
CMDBINS := operator redisnode | ||
|
||
TAG?=$(shell git tag|tail -1) | ||
COMMIT=$(shell git rev-parse HEAD) | ||
VERSION?=$(shell cat version.txt) | ||
DATE=$(shell date +%Y-%m-%d/%H:%M:%S ) | ||
BUILDINFOPKG=github.com/amadeusitgroup/redis-operator/pkg/utils | ||
LDFLAGS= -ldflags "-w -X ${BUILDINFOPKG}.TAG=${TAG} -X ${BUILDINFOPKG}.COMMIT=${COMMIT} -X ${BUILDINFOPKG}.VERSION=${VERSION} -X ${BUILDINFOPKG}.BUILDTIME=${DATE} -s" | ||
|
||
all: build | ||
|
||
plugin: build-kubectl-plugin install-plugin | ||
|
||
install-plugin: | ||
./tools/install-plugin.sh | ||
|
||
build-%: | ||
CGO_ENABLED=0 go build -i -installsuffix cgo ${LDFLAGS} -o bin/$* ./cmd/$* | ||
|
||
buildlinux-%: ${SOURCES} | ||
CGO_ENABLED=0 GOOS=linux go build -i -installsuffix cgo ${LDFLAGS} -o docker/$*/$* ./cmd/$*/main.go | ||
|
||
container-%: buildlinux-% | ||
@cd docker/$* && docker build -t $(PREFIX)$*:$(TAG) . | ||
|
||
container-redisnode: buildlinux-redisnode | ||
@cd docker/redisnode && docker build -t $(PREFIX)redisnode:$(TAG) . | ||
|
||
build: $(addprefix build-,$(CMDBINS)) | ||
|
||
buildlinux: $(addprefix buildlinux-,$(CMDBINS)) | ||
|
||
container: $(addprefix container-,$(CMDBINS)) | ||
|
||
test: | ||
./go.test.sh | ||
|
||
push: container | ||
@cd docker/${ARTIFACT_OPERATOR} && docker push $(PREFIX)$(ARTIFACT_OPERATOR):$(TAG) | ||
|
||
clean: | ||
rm -f ${ARTIFACT_OPERATOR} | ||
|
||
# Install all the build and lint dependencies | ||
setup: | ||
go get -u github.com/alecthomas/gometalinter | ||
gometalinter --install | ||
echo "make check" > .git/hooks/pre-commit | ||
chmod +x .git/hooks/pre-commit | ||
.PHONY: setup | ||
|
||
# gofmt and goimports all go files | ||
fmt: | ||
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done | ||
.PHONY: fmt | ||
|
||
# Run all the linters | ||
lint: | ||
gometalinter --vendor ./... -e pkg/client -e _generated -e test --deadline 2m -D gocyclo -D errcheck -D aligncheck | ||
.PHONY: lint | ||
|
||
.PHONY: build push clean test |
Oops, something went wrong.