Skip to content

Commit

Permalink
Synchronize redis-cluster from 0.7-release
Browse files Browse the repository at this point in the history
  • Loading branch information
1aal committed Dec 8, 2023
1 parent 2128ede commit c89ffb6
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
27 changes: 27 additions & 0 deletions addons/redis-cluster/templates/sentinel-nodeport-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if and (eq .Values.mode "replication") (eq .Values.sentinel.service.type "NodePort") }}
{{- range $i := until (int .Values.sentinel.replicas) }}
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-redis-sentinel-%d" (include "kblib.clusterName" $) $i }}
namespace: {{ $.Release.Namespace | quote }}
labels:
app.kubernetes.io/instance: {{ include "kblib.clusterName" $ }}
apps.kubeblocks.io/component-name: {{ printf "redis-sentinel" }}
spec:
type: NodePort
ports:
- name: redis-sentinel
port: 26379
targetPort: redis-sentinel
protocol: TCP
{{- if $.Values.sentinel.service.nodePortBase }}
nodePort: {{ (add $.Values.sentinel.service.nodePortBase $i 1) }}
{{- end }}
selector:
app.kubernetes.io/instance: {{ include "kblib.clusterName" $ }}
apps.kubeblocks.io/component-name: {{ printf "redis-sentinel" }}
statefulset.kubernetes.io/pod-name: {{ printf "%s-redis-sentinel-%d" (include "kblib.clusterName" $) $i }}
---
{{- end }}
{{- end }}
86 changes: 86 additions & 0 deletions addons/redis-cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,92 @@
"default": 20,
"minimum": 1,
"maximum": 10000
},
"sentinel": {
"title": "The sentinel Schema",
"type": "object",
"properties": {
"cpu": {
"title": "sentinel component cpu cores",
"description": "sentinel component cpu cores.",
"type": "number",
"default": 0.2
},
"memory": {
"title": "sentinel component memory",
"description": "sentinel component memory size, the unit is Gi.",
"type": "number",
"default": 0.2
},
"storage": {
"title": "sentinel component storage",
"description": "sentinel component storage size, the unit is Gi.",
"type": "number",
"default": 5
},
"replicas": {
"title": "sentinel component replicas",
"description": "The number of sentinel component replicas. Default is 3",
"type": "number",
"default": 3
},
"service": {
"title": "sentinel service Schema",
"type": "object",
"properties": {
"type": {
"title": "sentinel service type",
"description": "sentinel service type",
"type": "string",
"default": "ClusterIP",
"enum": [
"ClusterIP",
"NodePort"
]
},
"nodePortBase": {
"title": "sentinel service nodePortBase",
"description": "sentinel service nodePortBase",
"type": [
"number",
"string"
],
"minimum": 30000,
"maximum": 32767
}
}
}
}
},
"twemproxy": {
"title": "The twemproxy Schema",
"type": "object",
"properties": {
"cpu": {
"title": "twemproxy proxy component cpu cores",
"description": "twemproxy proxy component cpu cores.",
"type": "number",
"default": 0.2
},
"memory": {
"title": "twemproxy proxy component memory",
"description": "twemproxy proxy component memory size, the unit is Gi.",
"type": "number",
"default": 0.2
},
"replicas": {
"title": "twemproxy proxy component replicas",
"description": "The number of twemproxy proxy component replicas. Default is 2",
"type": "number",
"default": 2
},
"twemproxyEnabled": {
"type": "boolean",
"default": false,
"title": "The twemproxyEnabled Schema",
"description": "The flag to enable the twemproxy proxy component. Default is false"
}
}
}
}
}
13 changes: 13 additions & 0 deletions addons/redis-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ sentinel:
storage: 5
replicas: 3

service:
## @param sentinel service type
## @values ClusterIP, NodePort
type: ClusterIP

## @param sentinel.service.nodePorts.sentinel Node port for Sentinel
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
## NOTE: choose port between <30000-32767>
## NOTE: By leaving these values blank, they will be generated by the system
## If you have manually set the nodePortBase, please ensure that you reserve at least sentinel.replicas + 1 consecutive ports starting from nodePortBase for the allocation of nodePorts.
##
## nodePortBase: 30000
nodePortBase: ""
## @param twemproxyEnabled if true, enable the twemproxy
## if mode is standalone, twemproxyEnabled is always false
## if mode is replication, twemproxyEnabled can be true or false
Expand Down

0 comments on commit c89ffb6

Please sign in to comment.