diff --git a/docs/src/guide/README.md b/docs/src/guide/README.md index 0d128ab63e80ad2363abbaffb785d5e5f8702684..c170bfc5e5c70724ef1fa861d4f7ffb7a7ac0ef5 100755 --- a/docs/src/guide/README.md +++ b/docs/src/guide/README.md @@ -29,6 +29,7 @@ Here the features which are supported by this operator:- - Tolerations - SecurityContext - Storage + - ServiceAccount ## Architecture diff --git a/docs/src/guide/changelog.md b/docs/src/guide/changelog.md index 84f01dadf63e275f31cedb1322a3d64a4c0d388e..52ecb7660ffc1eecd0d5f5c4ddd87046b3e4e630 100644 --- a/docs/src/guide/changelog.md +++ b/docs/src/guide/changelog.md @@ -1,3 +1,33 @@ +### v0.12.0 +##### October 12, 2022 + +**:beetle: Bug Fixes** + +- PDB (Pod disruption budget) creation issue +- Fixed cluster recovery logic +- Fixed IP check and conversion logic +- Persistence issue fix + +**:tada: Features** + +- Added pvc, pv clusterrole fix +- Support for defining serviceAccount +- Closing of redis client connection +- Added finalizer for statefulset +- Added Prometheus service annotation +- Added support for Redis 7 with DNS hostname + +### v0.11.0 +**July 5, 2022** + +**:beetle: Bug Fixes** + +- Fix Redis cluster and Redis CRD +- Fixed TLS authentication between redis cluster +- Fixed RBAC policy for PDB +- Redis exporter exception handled +- External service fix + ### v0.10.0 **January 26, 2022** diff --git a/docs/src/guide/failover.md b/docs/src/guide/failover.md index 0d84b73c92cd71c83393f68191e6eef63cbac2ef..d3c5b2d164ad6ae0f3bbca72d98f9def63ff2973 100644 --- a/docs/src/guide/failover.md +++ b/docs/src/guide/failover.md @@ -3,11 +3,11 @@ Before failover testing, we have to write some dummy data inside the Redis cluster, we can write the dummy data using the `redis-cli`. ```shell -$ kubectl exec -it redis-leader-0 -n redis-operator \ +$ kubectl exec -it redis-leader-0 -n ot-operators \ -- redis-cli -a Opstree@1234 -c set tony stark ... Defaulting container name to redis-leader. -Use 'kubectl describe pod/redis-leader-0 -n redis-operator' to see all of the containers in this pod. +Use 'kubectl describe pod/redis-leader-0 -n ot-operatorsr' to see all of the containers in this pod. Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. OK ``` @@ -15,10 +15,10 @@ OK Verify the key has been inserted properly by fetching its value. ```shell -$ kubectl exec -it redis-leader-0 -n redis-operator \ +$ kubectl exec -it redis-leader-0 -n ot-operators \ -- redis-cli -a Opstree@1234 -c get tony ... -Use 'kubectl describe pod/redis-leader-0 -n redis-operator' to see all of the containers in this pod. +Use 'kubectl describe pod/redis-leader-0 -n ot-operators' to see all of the containers in this pod. Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. "stark" ``` @@ -26,7 +26,7 @@ Warning: Using a password with '-a' or '-u' option on the command line interface Let’s restart the pod name `redis-leader-0` and see the redis node behavior. ```shell -$ kubectl delete pod redis-leader-0 -n redis-operator +$ kubectl delete pod redis-leader-0 -n ot-operators ... pod "redis-leader-0" deleted ``` @@ -34,11 +34,11 @@ pod "redis-leader-0" deleted Now we can again try to list redis cluster nodes from `redis-leader-0` pod and from some other pod as well like:- `redis-follower-2` ```shell -$ kubectl exec -it redis-leader-0 -n redis-operator \ +$ kubectl exec -it redis-leader-0 -n ot-operators \ -- redis-cli -a Opstree@1234 cluster nodes ... Defaulting container name to redis-leader. -Use 'kubectl describe pod/redis-leader-0 -n redis-operator' to see all of the containers in this pod. +Use 'kubectl describe pod/redis-leader-0 -n ot-operators' to see all of the containers in this pod. Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. eef84b7dada737051c32d592bd66652b9af0cb35 10.42.2.184:6379@16379 slave 0a36dc5064b0a61afa8bd850e93ff0a1c2267704 0 1619958171517 3 connected a7c424b5ec0e696aa7be15a691846c8820e48cd1 10.42.1.181:6379@16379 master - 0 1619958172520 4 connected 0-5460 @@ -50,14 +50,14 @@ a7c424b5ec0e696aa7be15a691846c8820e48cd1 10.42.1.181:6379@16379 master - 0 16199 So if you notice the output of cluster nodes command, the node IP is updated and it’s connected as a leader. -Let's try to get value of key from some other pod +Let's try to get value of key from some other pods ```shell -$ kubectl exec -it redis-follower-1 -n redis-operator \ +$ kubectl exec -it redis-follower-1 -n ot-operators \ -- redis-cli -a Opstree@1234 -c get tony ... Defaulting container name to redis-follower. -Use 'kubectl describe pod/redis-follower-1 -n redis-operator' to see all of the containers in this pod. +Use 'kubectl describe pod/redis-follower-1 -n ot-operators' to see all of the containers in this pod. Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. "stark" ``` diff --git a/docs/src/guide/installation.md b/docs/src/guide/installation.md index 440f552237b448c503878b3e65c409e71ef51248..2737af0d11425432b5f948d1bbfb38352c60e3d6 100644 --- a/docs/src/guide/installation.md +++ b/docs/src/guide/installation.md @@ -13,12 +13,12 @@ The easiest way to install a redis operator is using Helm chart. The operator he ```shell $ helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/ $ helm upgrade redis-operator ot-helm/redis-operator \ - --install --namespace redis-operator + --install --namespace ot-operators ... Release "redis-operator" does not exist. Installing it now. NAME: redis-operator LAST DEPLOYED: Sun May 2 14:42:23 2021 -NAMESPACE: redis-operator +NAMESPACE: ot-operators STATUS: deployed REVISION: 1 TEST SUITE: None @@ -27,7 +27,7 @@ TEST SUITE: None Check the state of the pod is running or not. ```shell -$ kubectl get pods -n redis-operator +$ kubectl get pods -n ot-operators ... NAME READY STATUS RESTARTS AGE redis-operator-74b6cbf5c5-td8t7 1/1 Running 0 2m11s diff --git a/docs/src/guide/redis-cluster-config.md b/docs/src/guide/redis-cluster-config.md index e0a197e4bb4514c4b48004ed5f2d01795996cb72..6ad0c33c5ca55ee90cb2b0aa2c81e194d16690b3 100644 --- a/docs/src/guide/redis-cluster-config.md +++ b/docs/src/guide/redis-cluster-config.md @@ -13,36 +13,38 @@ In this configuration section, we have these configuration parameters:- ## Helm Parameters -|**Name**|**Default Value**|**Description**| -|--------|-----------------|---------------| -|`imagePullSecrets` | [] | List of image pull secrets, in case redis image is getting pull from private registry | -|`redisCluster.clusterSize` | 3 | Size of the redis cluster leader and follower nodes | -|`redisCluster.secretName` | redis-secret | Name of the existing secret in Kubernetes | -|`redisCluster.secretKey` | password | Name of the existing secret key in Kubernetes | -|`redisCluster.image` | quay.io/opstree/redis | Name of the redis image | -|`redisCluster.tag` | v6.2 | Tag of the redis image | -|`redisCluster.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis image | -|`redisCluster.leader.affinity` | {} | Affinity for node and pods for redis leader statefulset | -|`redisCluster.follower.affinity` | {} | Affinity for node and pods for redis follower statefulset | -|`externalService.enabled`| false | If redis service needs to be exposed using LoadBalancer or NodePort | -|`externalService.annotations`| {} | Kubernetes service related annotations | -|`externalService.serviceType` | NodePort | Kubernetes service type for exposing service, values - ClusterIP, NodePort, and LoadBalancer | -|`externalService.port` | 6379 | Port number on which redis external service should be exposed | -|`serviceMonitor.enabled` | false | Servicemonitor to monitor redis with Prometheus | -|`serviceMonitor.interval` | 30s | Interval at which metrics should be scraped. | -|`serviceMonitor.scrapeTimeout` | 10s | Timeout after which the scrape is ended | -|`serviceMonitor.namespace` | monitoring | Namespace in which Prometheus operator is running | -|`redisExporter.enabled` | true | Redis exporter should be deployed or not | -|`redisExporter.image` | quay.io/opstree/redis-exporter | Name of the redis exporter image | -|`redisExporter.tag` | v6.2 | Tag of the redis exporter image | -|`redisExporter.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis exporter image | -|`redisExporter.env` | [] | Extra environment variables which needs to be added in redis exporter| -|`nodeSelector` | {} | NodeSelector for redis statefulset | -|`priorityClassName`| "" | Priority class name for the redis statefulset | -|`storageSpec` | {} | Storage configuration for redis setup | -|`securityContext` | {} | Security Context for redis pods for changing system or kernel level parameters | -|`tolerations` | [] | Tolerations for redis statefulset | -|`sidecars` | [] | Sidecar for redis pods +| **Name** | **Default Value** | **Description** | +|------------------------------------|--------------------------------|-----------------------------------------------------------------------------------------------| +| `imagePullSecrets` | [] | List of image pull secrets, in case redis image is getting pull from private registry | +| `redisCluster.clusterSize` | 3 | Size of the redis cluster leader and follower nodes | +| `redisCluster.clusterVersion` | v7 | Major version of Redis setup, values can be v6 or v7 | +| `redisCluster.persistenceEnabled` | true | Persistence should be enabled or not in the Redis cluster setup | +| `redisCluster.secretName` | redis-secret | Name of the existing secret in Kubernetes | +| `redisCluster.secretKey` | password | Name of the existing secret key in Kubernetes | +| `redisCluster.image` | quay.io/opstree/redis | Name of the redis image | +| `redisCluster.tag` | v6.2 | Tag of the redis image | +| `redisCluster.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis image | +| `redisCluster.leader.affinity` | {} | Affinity for node and pods for redis leader statefulset | +| `redisCluster.follower.affinity` | {} | Affinity for node and pods for redis follower statefulset | +| `externalService.enabled` | false | If redis service needs to be exposed using LoadBalancer or NodePort | +| `externalService.annotations` | {} | Kubernetes service related annotations | +| `externalService.serviceType` | NodePort | Kubernetes service type for exposing service, values - ClusterIP, NodePort, and LoadBalancer | +| `externalService.port` | 6379 | Port number on which redis external service should be exposed | +| `serviceMonitor.enabled` | false | Servicemonitor to monitor redis with Prometheus | +| `serviceMonitor.interval` | 30s | Interval at which metrics should be scraped. | +| `serviceMonitor.scrapeTimeout` | 10s | Timeout after which the scrape is ended | +| `serviceMonitor.namespace` | monitoring | Namespace in which Prometheus operator is running | +| `redisExporter.enabled` | true | Redis exporter should be deployed or not | +| `redisExporter.image` | quay.io/opstree/redis-exporter | Name of the redis exporter image | +| `redisExporter.tag` | v6.2 | Tag of the redis exporter image | +| `redisExporter.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis exporter image | +| `redisExporter.env` | [] | Extra environment variables which needs to be added in redis exporter | +| `nodeSelector` | {} | NodeSelector for redis statefulset | +| `priorityClassName` | "" | Priority class name for the redis statefulset | +| `storageSpec` | {} | Storage configuration for redis setup | +| `securityContext` | {} | Security Context for redis pods for changing system or kernel level parameters | +| `tolerations` | [] | Tolerations for redis statefulset | +| `sidecars` | [] | Sidecar for redis pods | # CRD Parameters @@ -53,14 +55,40 @@ These are the CRD Parameters which is currently supported by Redis Exporter for `clusterSize` is size of the Redis leader and follower nodes. ```yaml +spec: clusterSize: 3 ``` +**clusterVersion** + +`clusterVersion` is a paramter through which we can control Redis major values. The possible values are:- + +- v6 +- v7 + +```yaml +spec: + clusterVersion: v7 +``` + +**persistenceEnabled** + +`persistenceEnabled` is a configuration parameter to enable the persistence storage in redis cluster. The possible values are:- + +- true +- false + +```yaml +spec: + persistenceEnabled: true +``` + **redisLeader** `redisLeader` is the field for Redis leader related configurations. ```yaml +spec: redisLeader: redisConfig: additionalRedisConfig: redis-external-config @@ -80,6 +108,7 @@ These are the CRD Parameters which is currently supported by Redis Exporter for `redisFollower` is the field for Redis follower related configurations. ```yaml +spec: redisFollower: redisConfig: additionalRedisConfig: redis-external-config @@ -99,6 +128,7 @@ These are the CRD Parameters which is currently supported by Redis Exporter for In the `kubernetesConfig` section, we define configuration related to Kubernetes. ```yaml +spec: kubernetesConfig: image: quay.io/opstree/redis:v6.2 imagePullPolicy: IfNotPresent @@ -122,6 +152,7 @@ In the `kubernetesConfig` section, we define configuration related to Kubernetes `redisExporter` configuration which enable the metrics for Redis Database to get monitored by Prometheus. ```yaml +spec: redisExporter: enabled: true image: quay.io/opstree/redis-exporter:1.0 @@ -153,6 +184,7 @@ In the `kubernetesConfig` section, we define configuration related to Kubernetes `storage` configuration for Redis Statefulset pods. ```yaml +spec: storage: volumeClaimTemplate: spec: @@ -168,7 +200,8 @@ In the `kubernetesConfig` section, we define configuration related to Kubernetes Name of the Kubernetes priority class which you want to associate with redis setup. ```yaml -priorityClassName: priority-100 +spec: + priorityClassName: priority-100 ``` **nodeSelector** @@ -176,6 +209,7 @@ priorityClassName: priority-100 Map of the labels which you want to use as nodeSelector. ```yaml +spec: nodeSelector: kubernetes.io/hostname: minikube ``` @@ -185,8 +219,10 @@ Map of the labels which you want to use as nodeSelector. Kubernetes security context for redis pods. ```yaml +spec: securityContext: runAsUser: 1000 + fsGroup: 1000 ``` **tolerations** @@ -194,6 +230,7 @@ Kubernetes security context for redis pods. Tolerations for nodes and pods in Kubernetes. ```yaml +spec: tolerations: - key: "key1" operator: "Equal" @@ -206,6 +243,7 @@ Tolerations for nodes and pods in Kubernetes. Sidecars for redis pods ```yaml +spec: sidecars: - name: "sidecar1" image: "image:1.0" @@ -227,6 +265,7 @@ Sidecars for redis pods PodDisruptionBugets for redis cluster pods ```yaml +spec: pdb: enabled: true maxUnavailable: 1 @@ -240,21 +279,14 @@ Probes for redis leader and follower pods ```yaml # redisFollower: # redisLeader: +spec: readinessProbe: - exec: - command: - - bash - - /usr/bin/healthcheck.sh failureThreshold: 5 initialDelaySeconds: 15 periodSeconds: 15 successThreshold: 1 timeoutSeconds: 5 livenessProbe: - exec: - command: - - bash - - /usr/bin/healthcheck.sh failureThreshold: 5 initialDelaySeconds: 15 periodSeconds: 15 @@ -267,10 +299,11 @@ Probes for redis leader and follower pods TLS configuration for redis cluster ```yaml +spec: TLS: ca: ca.key cert: tls.crt key: tls.key secret: secretName: sample-cert -``` \ No newline at end of file +``` diff --git a/docs/src/guide/redis-config.md b/docs/src/guide/redis-config.md index 41c25cc338d111b53cec20c6e7387bc56b5233a6..bcd57c4b7018864bd11497090335af7e780e3a8f 100644 --- a/docs/src/guide/redis-config.md +++ b/docs/src/guide/redis-config.md @@ -13,35 +13,35 @@ In this configuration section, we have these configuration parameters:- # Helm Parameters -|**Name**|**Value**|**Description**| -|--------|-----------------|-------| -|`imagePullSecrets` | [] | List of image pull secrets, in case redis image is getting pull from private registry | -|`redisStandalone.secretName` | redis-secret | Name of the existing secret in Kubernetes | -|`redisStandalone.secretKey` | password | Name of the existing secret key in Kubernetes | -|`redisStandalone.image` | quay.io/opstree/redis | Name of the redis image | -|`redisStandalone.tag` | v6.2 | Tag of the redis image | -|`redisStandalone.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis image | -|`redisStandalone.resources` | {} | Request and limits for redis statefulset | -|`externalService.enabled`| false | If redis service needs to be exposed using LoadBalancer or NodePort | -|`externalService.annotations`| {} | Kubernetes service related annotations | -|`externalService.serviceType` | NodePort | Kubernetes service type for exposing service, values - ClusterIP, NodePort, and LoadBalancer | -|`externalService.port` | 6379 | Port number on which redis external service should be exposed | -|`serviceMonitor.enabled` | false | Servicemonitor to monitor redis with Prometheus | -|`serviceMonitor.interval` | 30s | Interval at which metrics should be scraped. | -|`serviceMonitor.scrapeTimeout` | 10s | Timeout after which the scrape is ended | -|`serviceMonitor.namespace` | monitoring | Namespace in which Prometheus operator is running | -|`redisExporter.enabled` | true | Redis exporter should be deployed or not | -|`redisExporter.image` | quay.io/opstree/redis-exporter | Name of the redis exporter image | -|`redisExporter.tag` | v6.2 | Tag of the redis exporter image | -|`redisExporter.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis exporter image | -|`redisExporter.env` | [] | Extra environment variables which needs to be added in redis exporter| -|`nodeSelector` | {} | NodeSelector for redis statefulset | -|`priorityClassName`| "" | Priority class name for the redis statefulset | -|`storageSpec` | {} | Storage configuration for redis setup | -|`securityContext` | {} | Security Context for redis pods for changing system or kernel level parameters | -|`affinity` | {} | Affinity for node and pod for redis statefulset | -|`tolerations` | [] | Tolerations for redis statefulset | -|`sidecars` | [] | Sidecar for redis pods +| **Name** | **Value** | **Description** | +|-----------------------------------|--------------------------------|----------------------------------------------------------------------------------------------| +| `imagePullSecrets` | [] | List of image pull secrets, in case redis image is getting pull from private registry | +| `redisStandalone.secretName` | redis-secret | Name of the existing secret in Kubernetes | +| `redisStandalone.secretKey` | password | Name of the existing secret key in Kubernetes | +| `redisStandalone.image` | quay.io/opstree/redis | Name of the redis image | +| `redisStandalone.tag` | v6.2 | Tag of the redis image | +| `redisStandalone.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis image | +| `redisStandalone.resources` | {} | Request and limits for redis statefulset | +| `externalService.enabled` | false | If redis service needs to be exposed using LoadBalancer or NodePort | +| `externalService.annotations` | {} | Kubernetes service related annotations | +| `externalService.serviceType` | NodePort | Kubernetes service type for exposing service, values - ClusterIP, NodePort, and LoadBalancer | +| `externalService.port` | 6379 | Port number on which redis external service should be exposed | +| `serviceMonitor.enabled` | false | Servicemonitor to monitor redis with Prometheus | +| `serviceMonitor.interval` | 30s | Interval at which metrics should be scraped. | +| `serviceMonitor.scrapeTimeout` | 10s | Timeout after which the scrape is ended | +| `serviceMonitor.namespace` | monitoring | Namespace in which Prometheus operator is running | +| `redisExporter.enabled` | true | Redis exporter should be deployed or not | +| `redisExporter.image` | quay.io/opstree/redis-exporter | Name of the redis exporter image | +| `redisExporter.tag` | v6.2 | Tag of the redis exporter image | +| `redisExporter.imagePullPolicy` | IfNotPresent | Image Pull Policy of the redis exporter image | +| `redisExporter.env` | [] | Extra environment variables which needs to be added in redis exporter | +| `nodeSelector` | {} | NodeSelector for redis statefulset | +| `priorityClassName` | "" | Priority class name for the redis statefulset | +| `storageSpec` | {} | Storage configuration for redis setup | +| `securityContext` | {} | Security Context for redis pods for changing system or kernel level parameters | +| `affinity` | {} | Affinity for node and pod for redis statefulset | +| `tolerations` | [] | Tolerations for redis statefulset | +| `sidecars` | [] | Sidecar for redis pods | # CRD Parameters @@ -52,6 +52,7 @@ These are the CRD Parameters which is currently supported by Redis Exporter for In the `kubernetesConfig` section, we define configuration related to Kubernetes. ```yaml +spec: kubernetesConfig: image: quay.io/opstree/redis:v6.2 imagePullPolicy: IfNotPresent @@ -75,6 +76,7 @@ In the `kubernetesConfig` section, we define configuration related to Kubernetes `redisExporter` configuration which enable the metrics for Redis Database to get monitored by Prometheus. ```yaml +spec: redisExporter: enabled: true image: quay.io/opstree/redis-exporter:1.0 @@ -106,6 +108,7 @@ In the `kubernetesConfig` section, we define configuration related to Kubernetes `storage` configuration for Redis Statefulset pods. ```yaml +spec: storage: volumeClaimTemplate: spec: @@ -121,7 +124,8 @@ In the `kubernetesConfig` section, we define configuration related to Kubernetes Name of the Kubernetes priority class which you want to associate with redis setup. ```yaml -priorityClassName: priority-100 +spec: + priorityClassName: priority-100 ``` **nodeSelector** @@ -129,6 +133,7 @@ priorityClassName: priority-100 Map of the labels which you want to use as nodeSelector. ```yaml +spec: nodeSelector: kubernetes.io/hostname: minikube ``` @@ -138,6 +143,7 @@ Map of the labels which you want to use as nodeSelector. Kubernetes security context for redis pods. ```yaml +spec: securityContext: runAsUser: 1000 ``` @@ -147,6 +153,7 @@ Kubernetes security context for redis pods. Affinity for node and pod for redis setup. ```yaml +spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: @@ -163,6 +170,7 @@ Affinity for node and pod for redis setup. Tolerations for nodes and pods in Kubernetes. ```yaml +spec: tolerations: - key: "key1" operator: "Equal" @@ -175,6 +183,7 @@ Tolerations for nodes and pods in Kubernetes. Sidecars for redis pods ```yaml +spec: sidecars: - name: "sidecar1" image: "image:1.0" @@ -196,6 +205,7 @@ Sidecars for redis pods PodDisruptionBugets for redis standalone pods ```yaml +spec: pdb: enabled: true maxUnavailable: 1 @@ -207,21 +217,14 @@ PodDisruptionBugets for redis standalone pods Probes for redis standalone pods ```yaml +spec: readinessProbe: - exec: - command: - - bash - - /usr/bin/healthcheck.sh failureThreshold: 5 initialDelaySeconds: 15 periodSeconds: 15 successThreshold: 1 timeoutSeconds: 5 livenessProbe: - exec: - command: - - bash - - /usr/bin/healthcheck.sh failureThreshold: 5 initialDelaySeconds: 15 periodSeconds: 15 @@ -234,10 +237,11 @@ Probes for redis standalone pods TLS configuration for redis standalone ```yaml +spec: TLS: ca: ca.key cert: tls.crt key: tls.key secret: secretName: sample-cert -``` \ No newline at end of file +```