[stable/redis-ha] Add optional encrypted communication between HAProxy and Redis/Sentinel#391
Open
meteozond wants to merge 1 commit intoDandyDeveloper:masterfrom
Open
Conversation
ffec1e8 to
ca3ae48
Compare
…y and Redis/Sentinel Signed-off-by: Alexander Klimenko <alex@erix.ru>
ca3ae48 to
2ff178d
Compare
Owner
|
I'll try to jump on this during the week. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Problem: HAProxy ignores TLS settings and always connects to Redis/Sentinel backends via plaintext. Even when TLS is enabled (
redis.tlsPort,sentinel.tlsPort), traffic between HAProxy and backends remains unencrypted. If plaintext ports are disabled (redis.port: 0,sentinel.port: 0), HAProxy breaks entirely as it has no TLS fallback. Specifically:26379—sentinel.port/sentinel.tlsPortvalues are ignoredcheck_if_redis_is_master_*) have no TLS support — nossl, noca-fileoptionsbk_redis_master,bk_redis_slave) always useredis.port, ignoringredis.tlsPorthaproxy.tls.enabled) replaces plaintext oncontainerPort— there is no option to serve both plaintext and TLS simultaneously on separate portsSolution:
26379withsentinel.tlsPort(when set) orsentinel.port. Addssl verify required ca-fileandcrt(client certificate) toserverlines whensentinel.tlsPortis set.redis.tlsPort(when set) instead ofredis.port. Addssl verify required ca-fileandcrt(client certificate) toserverlines whenredis.tlsPortis set.tls-auth-clientsis enabled on Redis). The init container generates a combined PEM (backend-tls.pem) fromtls.certFile+tls.keyFile.tcp-check connect defaultis used for all backends, which inherits SSL settings from theserverline (includingca-fileandcrt). This replaces the previous plaintcp-check connect.haproxy.tlsPort. When set together withhaproxy.tls.enabled, plaintext stays oncontainerPortand TLS binds totlsPort. When not set, current behavior is preserved (TLS replaces plaintext oncontainerPort).tls.secretNamesecret is mounted into the HAProxy pod at/tls-certs/(both init and main containers).All changes are fully backward compatible — new behavior requires explicit
opt-in via
tlsPortvalues that default to nil.Special notes for your reviewer:
Backward compatibility verified:
helm templateoutput is identical for all existing CI value files (haproxy-enabled-values.yaml,multi-value-configs-values.yaml) and default render (no values) before andafter changes.
New values summary:
haproxy.tlsPort~(nil)haproxy.tls.enabled, serves plaintext oncontainerPortand TLS ontlsPortExisting values that now affect HAProxy backend behavior:
sentinel.tlsPortredis.tlsPorttls.secretNametls.caCertFilessl ca-filedirectivetls.certFilebackend-tls.pemtls.keyFilebackend-tls.pemTesting
ci/tls-enabled-values.yaml— CI test values covering the full TLS scenario: HAProxy with backend TLS to Redis (6479) and Sentinel (26479), frontend TLS on dedicated port (6381), and plaintext on default port (6379).github/workflows/test.yaml:openssl req -x509) before teststls.pem) and CA cert (ca.crt) from the same certtest-tls-secretin a fixedct-testnamespace with all cert filesct install --namespace ct-testso all test releases can access the secretct lintandct install:haproxy-enabled-values.yaml,multi-value-configs-values.yaml,tls-enabled-values.yamlValues changes
haproxy.tlsPort(default~) — dedicated TLS frontend porthaproxy.tls.keyNamedefault from empty totls.pemtls.secretNamefrom commented-out to explicit empty string""haproxy.affinityandaffinityfrom multiline|to""serviceAnnotations,podAnnotationsto top-level valuessecurityContext.sysctls,containerSecurityContext.runAsUser,capabilities.add,redis.lifecycle.postStartexporter.sslEnabledfrom commented-out to explicitfalseAdditional changes
values.schema.jsonwith JSON Schema validation forhaproxy,redis,sentinel, andtlssections4.35.10to4.36.0Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated
fields.]
signed
[stable/mychartname])