Skip to content

Commit

Permalink
feat: add master/replica service to redis replication (#1124)
Browse files Browse the repository at this point in the history
* refactor

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* feat: add master/replica service to redis replication

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix docs

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix docs

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
  • Loading branch information
drivebyer authored Nov 11, 2024
1 parent efb9624 commit 147d706
Show file tree
Hide file tree
Showing 10 changed files with 351 additions and 150 deletions.
14 changes: 14 additions & 0 deletions api/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ type KubernetesConfig struct {
MinReadySeconds *int32 `json:"minReadySeconds,omitempty"`
}

func (in *KubernetesConfig) GetServiceType() string {
if in.Service == nil {
return "ClusterIP"
}
return in.Service.ServiceType
}

func (in *KubernetesConfig) GetServiceAnnotations() map[string]string {
if in.Service == nil {
return nil
}
return in.Service.ServiceAnnotations
}

// ServiceConfig define the type of service to be created and its annotations
// +k8s:deepcopy-gen=true
type ServiceConfig struct {
Expand Down
91 changes: 61 additions & 30 deletions docs/content/en/docs/Configuration/Redis/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,67 @@ description: >
Configurations and parameters for Redis standalone
---

Redis standalone configuration can be customized by [values.yaml](https://github.com/OT-CONTAINER-KIT/helm-charts/blob/main/charts/redis/values.yaml). The recommended way of managing the setup is using `helm` but if the setup is not maintained by it, `YAML` CRD parameters can be modified in the manifest.
Redis standalone configuration can be customized by [values.yaml](https://github.com/OT-CONTAINER-KIT/redis-operator/blob/master/charts/redis/values.yaml). The recommended way of managing the setup is using `helm` but if the setup is not maintained by it, `YAML` CRD parameters can be modified in the manifest.

## Helm Configuration 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` | v7.0.15 | 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` | v1.44.0 | 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 containers to run alongside Redis pods |
| Key | Type | Default | Description |
|-----------------------------------------------------------------|--------|--------------------------------------------------------------------------|-------------|
| TLS.ca | string | `"ca.key"` | |
| TLS.cert | string | `"tls.crt"` | |
| TLS.key | string | `"tls.key"` | |
| TLS.secret.secretName | string | `""` | |
| acl.secret.secretName | string | `""` | |
| affinity | object | `{}` | |
| env | list | `[]` | |
| externalConfig.data | string | `"tcp-keepalive 400\nslowlog-max-len 158\nstream-node-max-bytes 2048\n"` | |
| externalConfig.enabled | bool | `false` | |
| externalService.enabled | bool | `false` | |
| externalService.port | int | `6379` | |
| externalService.serviceType | string | `"NodePort"` | |
| initContainer.args | list | `[]` | |
| initContainer.command | list | `[]` | |
| initContainer.enabled | bool | `false` | |
| initContainer.env | list | `[]` | |
| initContainer.image | string | `""` | |
| initContainer.imagePullPolicy | string | `"IfNotPresent"` | |
| initContainer.resources | object | `{}` | |
| labels | object | `{}` | |
| nodeSelector | object | `{}` | |
| podSecurityContext.fsGroup | int | `1000` | |
| podSecurityContext.runAsUser | int | `1000` | |
| priorityClassName | string | `""` | |
| redisExporter.enabled | bool | `false` | |
| redisExporter.env | list | `[]` | |
| redisExporter.image | string | `"quay.io/opstree/redis-exporter"` | |
| redisExporter.imagePullPolicy | string | `"IfNotPresent"` | |
| redisExporter.resources | object | `{}` | |
| redisExporter.tag | string | `"v1.44.0"` | |
| redisStandalone.ignoreAnnotations | list | `[]` | |
| redisStandalone.image | string | `"quay.io/opstree/redis"` | |
| redisStandalone.imagePullPolicy | string | `"IfNotPresent"` | |
| redisStandalone.imagePullSecrets | list | `[]` | |
| redisStandalone.minReadySeconds | int | `0` | |
| redisStandalone.name | string | `""` | |
| redisStandalone.redisSecret.secretKey | string | `""` | |
| redisStandalone.redisSecret.secretName | string | `""` | |
| redisStandalone.resources | object | `{}` | |
| redisStandalone.serviceType | string | `"ClusterIP"` | |
| redisStandalone.tag | string | `"v7.0.15"` | |
| securityContext | object | `{}` | |
| serviceAccountName | string | `""` | |
| serviceMonitor.enabled | bool | `false` | |
| serviceMonitor.interval | string | `"30s"` | |
| serviceMonitor.namespace | string | `"monitoring"` | |
| serviceMonitor.scrapeTimeout | string | `"10s"` | |
| sidecars.env | list | `[]` | |
| sidecars.image | string | `""` | |
| sidecars.imagePullPolicy | string | `"IfNotPresent"` | |
| sidecars.name | string | `""` | |
| sidecars.resources.limits.cpu | string | `"100m"` | |
| sidecars.resources.limits.memory | string | `"128Mi"` | |
| sidecars.resources.requests.cpu | string | `"50m"` | |
| sidecars.resources.requests.memory | string | `"64Mi"` | |
| storageSpec.volumeClaimTemplate.spec.accessModes[0] | string | `"ReadWriteOnce"` | |
| storageSpec.volumeClaimTemplate.spec.resources.requests.storage | string | `"1Gi"` | |
| tolerations | list | `[]` | |
Loading

0 comments on commit 147d706

Please sign in to comment.