-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add Redis Cluster mode support (GCP Memorystore, AWS ElastiCache) #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,11 +152,15 @@ app.kubernetes.io/component: tool-call-server | |
| {{- end }} | ||
|
|
||
| {{/* | ||
| Redis host - either from subchart or external | ||
| Redis host - either from subchart or external. | ||
| In cluster mode this renders the comma-separated node list from redis.cluster.nodes | ||
| (falling back to redis.external.host for single-node external deployments). | ||
| */}} | ||
| {{- define "codeapi.redis.host" -}} | ||
| {{- if .Values.redis.enabled }} | ||
| {{- printf "%s-redis-master" .Release.Name }} | ||
| {{- else if and .Values.redis.cluster.enabled .Values.redis.cluster.nodes }} | ||
| {{- .Values.redis.cluster.nodes }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With the documented Helm setting Useful? React with πΒ / π. |
||
| {{- else }} | ||
| {{- .Values.redis.external.host }} | ||
| {{- end }} | ||
|
|
@@ -173,6 +177,70 @@ Redis port | |
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| USE_REDIS_CLUSTER value β "true" when redis.cluster.enabled or when | ||
| redis.cluster.nodes contains a comma (auto-detect multiple nodes). | ||
| */}} | ||
| {{- define "codeapi.redis.clusterEnabled" -}} | ||
| {{- if .Values.redis.cluster.enabled }} | ||
| {{- "true" }} | ||
| {{- else if and .Values.redis.cluster.nodes (contains "," .Values.redis.cluster.nodes) }} | ||
| {{- "true" }} | ||
| {{- else }} | ||
| {{- "false" }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Emit the Redis TLS + CA environment variables and volume mount for each | ||
| component that needs it. Renders nothing when redis.tls.enabled is false. | ||
| Usage: {{ include "codeapi.redis.tlsEnv" . }} | ||
| */}} | ||
| {{- define "codeapi.redis.tlsEnv" -}} | ||
| {{- if .Values.redis.tls.enabled }} | ||
| - name: REDIS_TLS | ||
| value: "true" | ||
|
Comment on lines
+200
to
+202
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new values block says Redis TLS is for external managed Redis and is ignored when the bundled Redis is enabled, but this helper emits Useful? React with πΒ / π. |
||
| {{- if .Values.redis.tls.caSecretName }} | ||
| - name: REDIS_CA | ||
| value: {{ .Values.redis.tls.caMountPath | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.redis.useAlternativeDnsLookup }} | ||
| - name: REDIS_USE_ALTERNATIVE_DNS_LOOKUP | ||
| value: "true" | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Volume definition for the Redis CA certificate secret. | ||
| Renders nothing when redis.tls.caSecretName is empty. | ||
| Usage: {{ include "codeapi.redis.caVolume" . }} | ||
| */}} | ||
| {{- define "codeapi.redis.caVolume" -}} | ||
| {{- if and .Values.redis.tls.enabled .Values.redis.tls.caSecretName }} | ||
| - name: redis-ca | ||
| secret: | ||
| secretName: {{ .Values.redis.tls.caSecretName }} | ||
| items: | ||
| - key: {{ .Values.redis.tls.caKey }} | ||
| path: ca.crt | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| VolumeMount for the Redis CA certificate inside a container. | ||
| Renders nothing when redis.tls.caSecretName is empty. | ||
| Usage: {{ include "codeapi.redis.caVolumeMount" . }} | ||
| */}} | ||
| {{- define "codeapi.redis.caVolumeMount" -}} | ||
| {{- if and .Values.redis.tls.enabled .Values.redis.tls.caSecretName }} | ||
| - name: redis-ca | ||
| mountPath: {{ .Values.redis.tls.caMountPath | quote }} | ||
| subPath: ca.crt | ||
| readOnly: true | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Redis NetworkPolicy egress. Kubernetes NetworkPolicy cannot match DNS names, | ||
| so external Redis can be scoped with CIDRs when available; otherwise the chart | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following this new cluster-mode README snippet with the chart defaults leaves
redis.enabledastrue;codeapi.redis.hostthen gives precedence to the bundled standalone Redis service whileUSE_REDIS_CLUSTER=true, so the pods instantiate an ioredis Cluster client against<release>-redis-masterand ignore the provided startup nodes. Includeredis.enabled=falsein the example or make the helper/validation reject this conflicting configuration.Useful? React with πΒ / π.