Skip to content

feat(helm): add memcached port support to Service#6608

Closed
badal773 wants to merge 8 commits intodragonflydb:mainfrom
badal773:main
Closed

feat(helm): add memcached port support to Service#6608
badal773 wants to merge 8 commits intodragonflydb:mainfrom
badal773:main

Conversation

@badal773
Copy link
Copy Markdown

Fixes #6567

Summary

Add memcached support to the Helm chart. When memcached.enabled=true, the chart automatically configures everything needed.

Changes

  • Add memcached.enabled and memcached.port values
  • Auto-add --memcached_port arg when memcached is enabled
  • Expose memcached as named container port
  • Add memcached port to Service alongside Redis port
  • Add service.targetPort for custom routing

Usage

memcached:
  enabled: true
  port: 11211

Copilot AI review requested due to automatic review settings February 12, 2026 06:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive memcached protocol support to the Dragonfly Helm chart, addressing issue #6567 where users could not properly expose the Memcached port (11211) via Kubernetes Services. The implementation provides a clean, declarative way to enable memcached support through values.yaml configuration.

Changes:

  • Added memcached.enabled and memcached.port configuration options with sensible defaults
  • Added service.targetPort configuration to allow custom port routing
  • Automatic configuration when memcached is enabled: container port exposure, Service port mapping, and --memcached_port argument injection
  • Comprehensive test coverage with golden test files
  • Updated documentation in README.md
  • Chart version bump from v1.36.0 to v1.36.1

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
contrib/charts/dragonfly/values.yaml Added memcached configuration section and service.targetPort parameter
contrib/charts/dragonfly/templates/service.yaml Added conditional memcached port to Service and templated targetPort
contrib/charts/dragonfly/templates/_pod.tpl Added conditional memcached container port and automatic --memcached_port argument
contrib/charts/dragonfly/ci/memcached-values.yaml Test configuration for memcached feature
contrib/charts/dragonfly/ci/memcached-values.golden.yaml Expected golden output for memcached test
contrib/charts/dragonfly/ci/tls-values.golden.yaml Updated checksum due to template changes
contrib/charts/dragonfly/README.md Added documentation for new memcached parameters
contrib/charts/dragonfly/Chart.yaml Bumped chart version to v1.36.1

Comment thread contrib/charts/dragonfly/values.yaml Outdated
badal773 and others added 2 commits February 12, 2026 12:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Badal Kumar  <130441461+badal773@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 12, 2026 07:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread contrib/charts/dragonfly/values.yaml
Comment thread contrib/charts/dragonfly/README.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Badal Kumar  <130441461+badal773@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 12, 2026 07:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread contrib/charts/dragonfly/templates/service.yaml
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Comment thread contrib/charts/dragonfly/templates/_helpers.tpl Outdated
Comment on lines +91 to 96
{{- if and .Values.memcached .Values.memcached.enabled }}
- "--memcached_port={{ .Values.memcached.port }}"
{{- end }}
{{- with .Values.extraArgs }}
{{- toYaml . | trim | nindent 6 }}
{{- end }}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --memcached_port argument is placed before extraArgs (line 92), while TLS arguments are placed after extraArgs (lines 97-100). This inconsistency in argument ordering could lead to confusion. More critically, placing memcached args before extraArgs allows users to override them, potentially creating a mismatch between memcached.port and the actual --memcached_port flag. Consider moving the memcached args to after extraArgs for consistency with TLS configuration and to prevent accidental overrides.

Suggested change
{{- if and .Values.memcached .Values.memcached.enabled }}
- "--memcached_port={{ .Values.memcached.port }}"
{{- end }}
{{- with .Values.extraArgs }}
{{- toYaml . | trim | nindent 6 }}
{{- end }}
{{- with .Values.extraArgs }}
{{- toYaml . | trim | nindent 6 }}
{{- end }}
{{- if and .Values.memcached .Values.memcached.enabled }}
- "--memcached_port={{ .Values.memcached.port }}"
{{- end }}

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +85
{{- end }}
{{- end }}
{{- end }}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation only checks if memcached.port equals service.port, but it doesn't check if memcached.port equals 6379 (the hardcoded Redis port). If a user sets memcached.port to 6379, Dragonfly will fail to start because both protocols would try to bind to the same port. The validation should also check: if eq (int .Values.memcached.port) 6379

Suggested change
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if eq (int .Values.memcached.port) 6379 }}
{{- fail "memcached.port must not be 6379 (Redis/Dragonfly default port). Please use a different port for memcached." }}
{{- end }}
{{- end }}
{{- end }}

Copilot uses AI. Check for mistakes.
@@ -1,3 +1,4 @@
{{- include "dragonfly.validateMemcached" . }}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation is only called from service.yaml, which means if someone renders deployment.yaml or statefulset.yaml in isolation (e.g., helm template with --show-only), they won't get the validation error. Consider also adding the validation to deployment.yaml and statefulset.yaml to ensure it always runs when memcached is enabled.

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +66
# -- Dragonfly target port on the pod. Can be a port number or a named port (dragonfly or memcached)
targetPort: dragonfly
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no validation to ensure that service.targetPort is a valid value. If a user sets service.targetPort to an arbitrary number or name that doesn't match any containerPort, the Service will be created but traffic won't route correctly. Consider adding validation to ensure targetPort is either "dragonfly", "memcached", 6379, or (when memcached is enabled) the memcached.port value.

Suggested change
# -- Dragonfly target port on the pod. Can be a port number or a named port (dragonfly or memcached)
targetPort: dragonfly
# -- Dragonfly target port on the pod. Must match a containerPort and should be one of:
# -- 6379, "dragonfly", "memcached", or (when memcached is enabled) the configured memcached.port.
targetPort: 6379

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Badal Kumar  <130441461+badal773@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 12, 2026 07:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment on lines +81 to +82
{{- if eq (int .Values.memcached.port) (int .Values.service.port) }}
{{- fail "memcached.port must not be the same as service.port (default 6379). Please use a different port for memcached." }}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation logic checks if memcached.port equals service.port, but this is incorrect. According to the issue description and Dragonfly's behavior, memcached.port must not equal 6379 (the fixed Redis/Dragonfly container port), not service.port. The service.port is just the Service's external port and can be changed independently. The validation should be: if eq (int .Values.memcached.port) 6379, fail with error message "memcached.port must not be 6379 (the Redis/Dragonfly port). Please use a different port for memcached."

Suggested change
{{- if eq (int .Values.memcached.port) (int .Values.service.port) }}
{{- fail "memcached.port must not be the same as service.port (default 6379). Please use a different port for memcached." }}
{{- if eq (int .Values.memcached.port) 6379 }}
{{- fail "memcached.port must not be 6379 (the Redis/Dragonfly port). Please use a different port for memcached." }}

Copilot uses AI. Check for mistakes.
@romange
Copy link
Copy Markdown
Collaborator

romange commented Feb 12, 2026

@Abhra303 can you PTAL?

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
@vyavdoshenko
Copy link
Copy Markdown
Contributor

Stale PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants