[bitnami/redis] Fix Redis sentinel initialization with single replica #35667
+7
−3
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.
Description
The
get_service_ip
function was called unconditionally during master initialization but only defined when external access is enabled. This caused single-replica Redis deployments to fail during startup when using the default internal-only configuration.The fix makes the initialization logic consistent with the comparison logic by using
get_full_hostname
when external access is disabled.Description of the change
This change fixes a conditional logic mismatch in the Redis chart's startup script template. The
get_service_ip()
function was being called unconditionally during master initialization (line 158) but was only defined whensentinel.externalAccess.enabled
is true. This caused Redis containers to fail during startup in single-replica deployments using the default configuration where external access is disabled.The fix adds the same conditional logic used in the comparison section to the initialization section, ensuring consistency between initialization and comparison phases.
Benefits
Possible drawbacks
None identified. The change only affects the problematic code path and maintains all existing behavior for configurations where external access is enabled.
Applicable issues
This addresses startup failures in single-replica Redis deployments where sentinel is unable to promote the replica to master due to undefined function calls.
Additional information
The issue occurs specifically when:
replica.replicaCount: 1
(single replica)sentinel.externalAccess.enabled: false
(default configuration)The fix ensures the startup script works correctly in both external access and internal-only configurations.
Checklist
Chart.yaml
according to semver. This is not necessary when the changes only affect README.md files.README.md
using readme-generator-for-helmTechnical Details
Root Cause
The bug existed in
/bitnami/redis/templates/scripts-configmap.yaml
at line 158:master_in_persisted_conf="$(get_service_ip "$SVC_NAME")"
This line called
get_service_ip()
unconditionally, but the function was only defined when:{{- if and .Values.sentinel.externalAccess.enabled .Values.sentinel.externalAccess.service.loadBalancerIP }}
Fix Applied
Changed the unconditional call to use the same conditional logic as the comparison section:
Tested Scenarios