Skip to content

Commit

Permalink
Revamped documentation for better knowledge base (#370)
Browse files Browse the repository at this point in the history
* Updated README with basic information

Signed-off-by: iamabhishek-dubey <abhishekbhardwaj510@gmail.com>

* Updated README with basic information

Signed-off-by: iamabhishek-dubey <abhishekbhardwaj510@gmail.com>
  • Loading branch information
iamabhishek-dubey committed Nov 2, 2022
1 parent 16a02c3 commit f3565c1
Show file tree
Hide file tree
Showing 7,475 changed files with 358,570 additions and 9,531 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .azure-pipelines/pipeline.yaml
Expand Up @@ -23,6 +23,6 @@ extends:
ApplicationName: redis-operator
QuayImageName: opstree/redis-operator
GithubImageName: ot-container-kit/redis-operator/redis-operator
BuildDocs: true
BuildDocs: false
AppVersion: "v0.13.0"
GolangVersion: "1.17"
23 changes: 0 additions & 23 deletions .github/workflows/vuepress-deploy.yml

This file was deleted.

174 changes: 174 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,174 @@
# CONTRIBUTING

## Prerequisites

- [Kubernetes Cluster](https://kubernetes.io)
- [Git](https://git-scm.com/downloads)
- [Go](https://golang.org/dl/)
- [Docker](https://docs.docker.com/install/)
- [Operator SDK](https://github.com/operator-framework/operator-sdk/releases)
- [Make](https://www.gnu.org/software/make/manual/make.html)
- [Eksctl](https://eksctl.io/)

## Local Kubernetes Cluster

For development and testing of operator on local system, we need to set up a [Minikube](https://minikube.sigs.k8s.io/docs/start/) or local Kubernetes cluster.

Minikube is a single node Kubernetes cluster that generally gets used for the development and testing on Kubernetes. For creating a Minkube cluster we need to simply run:

```shell
$ minikube start --vm-driver virtualbox
...
😄 minikube v1.0.1 on linux (amd64)
🤹 Downloading Kubernetes v1.14.1 images in the background ...
🔥 Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
📶 "minikube" IP address is 192.168.39.240
🐳 Configuring Docker as the container runtime ...
🐳 Version of container runtime is 18.06.3-ce
⌛ Waiting for image downloads to complete ...
✨ Preparing Kubernetes environment ...
🚜 Pulling images required by Kubernetes v1.14.1 ...
🚀 Launching Kubernetes v1.14.1 using kubeadm ...
⌛ Waiting for pods: apiserver proxy etcd scheduler controller dns
🔑 Configuring cluster permissions ...
🤔 Verifying component health .....
💗 kubectl is now configured to use "minikube"
🏄 Done! Thank you for using minikube!
```

## Cloud Kubernetes Cluster

For cloud based Kubernetes cluster we can use any type of platforms like [Amazon Web Service](https://aws.amazon.com/), [Azure Cloud](https://azure.microsoft.com/en-in/), or [Google Cloud Platform](https://cloud.google.com/). We have provided an [eks-cluster.yaml](./example/eks-cluster.yaml) file for creating an Elastic Kubernetes Service(EKS) using [eksctl](https://eksctl.io/).

`eksctl` is a cli tool to create a Kubernetes cluster on EKS by a single command. It supports creation of Ipv4 and Ipv6 based Kubernetes clusters for development.

```shell
$ eksctl create cluster -f example/eks-cluster.yaml
...
2022-10-30 19:47:44 [ℹ] eksctl version 0.114.0
2022-10-30 19:47:44 [ℹ] using region us-west-2
2022-10-30 19:47:45 [ℹ] setting availability zones to [us-west-2d us-west-2c us-west-2a]
2022-10-30 19:47:45 [ℹ] subnets for us-west-2d - public:192.168.0.0/19 private:192.168.96.0/19
2022-10-30 19:47:45 [ℹ] subnets for us-west-2c - public:192.168.32.0/19 private:192.168.128.0/19
2022-10-30 19:47:45 [ℹ] subnets for us-west-2a - public:192.168.64.0/19 private:192.168.160.0/19
2022-10-30 19:47:45 [ℹ] nodegroup "ng-1" will use "" [AmazonLinux2/1.22]
2022-10-30 19:47:45 [ℹ] using SSH public key "/Users/abhishekdubey/.ssh/id_rsa.pub" as "eksctl-operator-testing-nodegroup-ng-1-8b:2b:b2:fc:4c:7f:9c:0d:54:14:70:39:25:b5:6d:60"
2022-10-30 19:47:47 [ℹ] using Kubernetes version 1.22
2022-10-30 19:47:47 [ℹ] creating EKS cluster "operator-testing" in "us-west-2" region with managed nodes
2022-10-30 19:47:47 [ℹ] 1 nodegroup (ng-1) was included (based on the include/exclude rules)
2022-10-30 19:47:47 [ℹ] will create a CloudFormation stack for cluster itself and 0 nodegroup stack(s)
2022-10-30 19:47:47 [ℹ] will create a CloudFormation stack for cluster itself and 1 managed nodegroup stack(s)
2022-10-30 19:47:47 [ℹ] if you encounter any issues, check CloudFormation console or try 'eksctl utils describe-stacks --region=us-west-2 --cluster=operator-testing'
2022-10-30 19:47:47 [ℹ] Kubernetes API endpoint access will use default of {publicAccess=true, privateAccess=false} for cluster "operator-testing" in "us-west-2"
2022-10-30 19:47:47 [ℹ] CloudWatch logging will not be enabled for cluster "operator-testing" in "us-west-2"
2022-10-30 19:47:47 [ℹ] you can enable it with 'eksctl utils update-cluster-logging --enable-types={SPECIFY-YOUR-LOG-TYPES-HERE (e.g. all)} --region=us-west-2 --cluster=operator-testing'
2022-10-30 19:47:47 [ℹ]
2 sequential tasks: { create cluster control plane "operator-testing",
2 sequential sub-tasks: {
5 sequential sub-tasks: {
wait for control plane to become ready,
associate IAM OIDC provider,
no tasks,
restart daemonset "kube-system/aws-node",
1 task: { create addons },
},
create managed nodegroup "ng-1",
}
}
2022-10-30 19:47:47 [ℹ] building cluster stack "eksctl-operator-testing-cluster"
2022-10-30 19:47:50 [ℹ] deploying stack "eksctl-operator-testing-cluster"
2022-10-30 20:01:17 [ℹ] daemonset "kube-system/aws-node" restarted
2022-10-30 20:01:18 [ℹ] creating role using recommended policies
2022-10-30 20:01:20 [ℹ] deploying stack "eksctl-operator-testing-addon-vpc-cni"
2022-10-30 20:01:20 [ℹ] waiting for CloudFormation stack "eksctl-operator-testing-addon-vpc-cni"
2022-10-30 20:01:52 [ℹ] waiting for CloudFormation stack "eksctl-operator-testing-addon-vpc-cni"
2022-10-30 20:02:24 [ℹ] waiting for CloudFormation stack "eksctl-operator-testing-addon-vpc-cni"
2022-10-30 20:02:26 [ℹ] creating addon
2022-10-30 20:02:37 [ℹ] addon "vpc-cni" active
2022-10-30 20:02:39 [ℹ] building managed nodegroup stack "eksctl-operator-testing-nodegroup-ng-1"
```
For setting up the Ipv4 or Ipv6 cluster with eksctl, we need to modify this configuration in the [eks-cluster.yaml](./example/eks-cluster.yaml):
```yaml
kubernetesNetworkConfig:
ipFamily: IPv4
# ipFamily: IPv6
```
## Operator structure
The structure for Redis operator includes different module's directory. The codebase include these major directories:
```shell
redis-operator/
|-- api
| |-- v1beta1
|-- bin
|-- config
| |-- certmanager
| |-- crd
| | |-- bases
| | |-- patches
| |-- default
| |-- manager
| |-- prometheus
| |-- rbac
| |-- samples
| |-- scorecard
| |-- bases
| |-- patches
|-- controllers
|-- hack
|-- k8sutils
```
As part of the development, generally, we modify the codebase in API, controllers, and k8sutils. The API modules hold the interface and structure for CRD definition, the controllers are the watch controllers that create, update, and delete the resources. The k8sutils is a module in which all the Kubernetes resources(Statefulsets, Services, etc.) codebase is present.
### Building Operator
For building operator, we can execute make command to create binary and docker image:
```shell
$ make manager
$ make docker-build
```
For any change inside the `api` module, we need to recreate the CRD schema because of interface changes. To generate the CRD manifest and RBAC policies updated by operator:
```shell
$ make manifests
```
### Deploying Operator
The operator deployment can be done via `helm` cli, we just need to define the custom image name and tag for testing the operator functionality:
```shell
$ helm upgrade redis-operator ot-helm/redis-operator \
--install --namespace ot-operators --set redisOperator.imageName=<custom-url> \
--set redisOperator.imageTag=<customTag>
```
```shell
# For deploying standalone redis
$ helm upgrade redis ot-helm/redis --namespace ot-operators
# For deploying cluster redis
$ helm upgrade redis-cluster ot-helm/redis-cluster \n
--set redisCluster.clusterSize=3 --install --namespace ot-operators \
--set pdb.enabled=false --set redisCluster.tag=v7.0.5-beta
```
## Docker Image Development
Development of redis docker image is maintained inside a different repository - https://github.com/OT-CONTAINER-KIT/redis. To make any change or suggestion related to Redis docker image, please refer to this repository and make required changes.
In the repository, we have `Dockerfile` for [Redis](https://github.com/OT-CONTAINER-KIT/redis/blob/master/Dockerfile) and [Redis Exporter](https://github.com/OT-CONTAINER-KIT/redis/blob/master/Dockerfile.exporter)
For building the docker image for redis and redis exporter, there are simple make commands:
```shell
$ make build-redis
$ make build-redis-exporter
```
59 changes: 0 additions & 59 deletions DEVELOPMENT.md

This file was deleted.

58 changes: 28 additions & 30 deletions README.md
@@ -1,5 +1,5 @@
<p align="center">
<img src="./static/redis-operator-logo.svg" height="220" width="220">
<img src="./static/redis-operator-logo.svg" height="330" width="330">
</p>

<p align="center">
Expand All @@ -25,47 +25,45 @@

A Golang based redis operator that will make/oversee Redis standalone and cluster mode setup on top of the Kubernetes. It can create a redis cluster setup with best practices on Cloud as well as the Bare metal environment. Also, it provides an in-built monitoring capability using redis-exporter.

For documentation, please refer to https://ot-container-kit.github.io/redis-operator/
For documentation, please refer to https://ot-redis-operator.opstreelabs.in

Organizations that are using Redis Operator to manage their redis workload can be found [here](./USED_BY_ORGANIZATIONS.md). If your organization is also using Redis Operator, please free to add by creating a PR https://github.com/OT-CONTAINER-KIT/redis-operator/pulls.

This operator only supports versions of redis `=>6`.

## Architecture

<div align="center">
<img src="./static/redis-operator-architecture.png">
</div>

### Purpose
## Purpose

The purpose of creating this operator was to provide an easy and production grade setup of Redis on Kubernetes. It doesn't care if you have a plain on-prem Kubernetes or cloud-based.
There are multiple problems that people face while setting up redis setup on Kubernetes, specially cluster type setup. The purpose of creating this opperator is to provide an easy and production ready interface for redis setup that include best-practices, security controls, monitoring, and management.

### Supported Features
## Supported Features

Here the features which are supported by this operator:-

- Redis cluster and standalone mode setup
- Redis cluster failover and recovery
- Inbuilt monitoring with prometheus exporter
- Dynamic storage provisioning with pvc template
- Resources restrictions with k8s requests and limits
- Password/Password-less setup
- Node selector and affinity
- Priority class to manage setup priority
- SecurityContext to manipulate kernel parameters
- Inbuilt monitoring with redis exporter
- Password and password-less setup of redis
- TLS support for additional security layer
- Ipv4 and Ipv6 support for redis setup
- Detailed monitoring grafana dashboard

### Getting Started
## Getting Started

If you want to deploy redis-operator from scratch to a local Minikube cluster, begin with the [Getting started](https://ot-container-kit.github.io/redis-operator/#/quickstart/quickstart) document. It will guide your through the setup step-by-step.

### Example

The configuration of Redis setup should be described in Redis CRD. You will find all the examples manifests in [example](./example) folder.
The configuration of Redis setup should be described in [CRD definitions](config/crd/bases). All the examples related to redis standalone and cluster setup can be found inside [example](./example) folder.

### Prerequisites
## Prerequisites

Redis operator requires a Kubernetes cluster of version `>=1.8.0`. If you have just started with Operators, its highly recommended to use latest version of Kubernetes.
Redis operator requires a Kubernetes cluster of version `>=1.18.0`. If you have just started with Operators, it's highly recommended using the latest version of Kubernetes.

### Quickstart
## Quickstart

The setup can be done by using helm. If you want to see more example, please go through the [example](./example) folder.

Expand All @@ -78,13 +76,13 @@ $ helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/

```shell
# Deploy the redis-operator
$ helm upgrade redis-operator ot-helm/redis-operator --install --namespace redis-operator
$ helm upgrade redis-operator ot-helm/redis-operator --install --namespace ot-operators
```

After deployment, verify the installation of operator

```shell
$ helm test redis-operator --namespace redis-operator
$ helm test redis-operator --namespace ot-operators
```

Creating redis cluster or standalone setup.
Expand All @@ -93,18 +91,18 @@ Creating redis cluster or standalone setup.
# Create redis cluster setup
$ helm upgrade redis-cluster ot-helm/redis-cluster \
--set redisCluster.clusterSize=3 --install \
--namespace redis-operator
--namespace ot-operators
```

```shell
# Create redis standalone setup
$ helm upgrade redis ot-helm/redis \
--install --namespace redis-operator
--install --namespace ot-operators
```

If you want to customize the value file by yourself while initializing the helm command, the values files for reference are present [here](https://github.com/OT-CONTAINER-KIT/helm-charts/tree/main/charts/redis-setup)
If you want to customize the value file by yourself while initializing the helm command, the values files for reference are present [here](https://github.com/OT-CONTAINER-KIT/helm-charts/tree/main/charts/redis-setup).

### Monitoring with Prometheus
## Monitoring with Prometheus

To monitor redis performance we will be using prometheus. In any case, extra prometheus configuration will not be required because we will be using the Prometheus service discover pattern. For that we already have set these annotations:-

Expand All @@ -115,14 +113,14 @@ To monitor redis performance we will be using prometheus. In any case, extra pro
prometheus.io/port: "9121"
```

### Development
## Contribution

Please see our [DEVELOPMENT.md](https://ot-container-kit.github.io/redis-operator/guide/development.html) for details.
Please see our [CONTRIBUTING.md](./CONTRIBUTING.md) for details.

### Release History
## Release History

Please see our [CHANGELOG.md](./CHANGELOG.md) for details.

### Documentation
## Contact Information

Please see our [GETTING_STARTED.md](https://ot-container-kit.github.io/redis-operator/) for details.
This project is managed by [OpsTree Solutions](http://opstree.com). If you have any queries or suggestions, mail us at [opensource@opstree.com](opensource@opstree.com).

0 comments on commit f3565c1

Please sign in to comment.