Skip to content

Commit 1de4e98

Browse files
authored
chore(chart-deps): update oauth2-proxy to version 8.5.1 (#2735)
1 parent 19e8ea9 commit 1de4e98

File tree

9 files changed

+105
-39
lines changed

9 files changed

+105
-39
lines changed

chart/chart-index/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ dependencies:
8181
version: 5.4.0
8282
repository: https://charts.min.io/
8383
- name: oauth2-proxy
84-
version: 8.5.0
84+
version: 8.5.1
8585
repository: https://oauth2-proxy.github.io/manifests
8686
- name: opentelemetry-operator
8787
alias: otel-operator

charts/oauth2-proxy/Chart.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dependencies:
22
- name: redis-ha
33
repository: https://dandydeveloper.github.io/charts
4-
version: 4.35.0
5-
digest: sha256:14e77cba3fb7726c9fbd6336876cd9bba23b4ea49e900d3a4608b94e7fa7b26f
6-
generated: "2025-10-08T16:53:26.172668+02:00"
4+
version: 4.35.3
5+
digest: sha256:0894a58551d9b6efee6d37abc6f00f16414427488257e250a7c9e2c6fc7ca48f
6+
generated: "2025-11-19T11:30:04.154809464Z"

charts/oauth2-proxy/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
condition: redis.enabled
1313
name: redis-ha
1414
repository: https://dandydeveloper.github.io/charts
15-
version: 4.35.0
15+
version: 4.35.3
1616
description: A reverse proxy that provides authentication with Google, Github or other
1717
providers
1818
home: https://oauth2-proxy.github.io/oauth2-proxy/
@@ -36,4 +36,4 @@ name: oauth2-proxy
3636
sources:
3737
- https://github.com/oauth2-proxy/oauth2-proxy
3838
- https://github.com/oauth2-proxy/manifests
39-
version: 8.5.0
39+
version: 8.5.1

charts/oauth2-proxy/charts/redis-ha/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ sources:
1616
- https://redis.io/download
1717
- https://github.com/DandyDeveloper/charts/blob/master/charts/redis-ha
1818
- https://github.com/oliver006/redis_exporter
19-
version: 4.35.0
19+
version: 4.35.3

charts/oauth2-proxy/charts/redis-ha/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ The following table lists the configurable parameters of the Redis chart and the
216216
| `sentinel.livenessProbe.successThreshold` | Success threshold for liveness probe | int | `1` |
217217
| `sentinel.livenessProbe.timeoutSeconds` | Timeout seconds for liveness probe | int | `15` |
218218
| `sentinel.password` | A password that configures a `requirepass` in the conf parameters (Requires `sentinel.auth: enabled`) | string | `nil` |
219+
| `sentinel.resolveHostnames` | Configures sentinel with resolve-hostnames parameter, if true sets "resolve-hostnames yes" in sentinel.conf | bool | `nil` |
220+
| `sentinel.announceHostnames` | Configures sentinel with announce-hostnames parameter, if true sets "announce-hostnames yes" in sentinel.conf | bool | `nil` |
219221
| `sentinel.port` | Port to access the sentinel service | int | `26379` |
220222
| `sentinel.quorum` | Minimum number of nodes expected to be live. | int | `2` |
221223
| `sentinel.readinessProbe.enabled` | | bool | `true` |

charts/oauth2-proxy/charts/redis-ha/templates/_configs.tpl

Lines changed: 77 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@
6868
{{- end }}
6969
{{- range $key, $value := .Values.sentinel.config }}
7070
{{- if eq "maxclients" $key }}
71-
{{ $key }} {{ $value }}
71+
{{ $key }} {{ $value }}
7272
{{- else }}
73-
sentinel {{ $key }} {{ template "redis-ha.masterGroupName" $ }} {{ $value }}
73+
sentinel {{ $key }} {{ template "redis-ha.masterGroupName" $ }} {{ $value }}
7474
{{- end }}
7575
{{- end }}
7676
{{- if .Values.auth }}
@@ -79,18 +79,34 @@
7979
{{- if .Values.sentinel.auth }}
8080
requirepass replace-default-sentinel-auth
8181
{{- end }}
82+
{{- if .Values.sentinel.resolveHostnames }}
83+
sentinel resolve-hostnames yes
84+
{{- end }}
85+
{{- if .Values.sentinel.announceHostnames }}
86+
sentinel announce-hostnames yes
87+
{{- end }}
8288
{{- end }}
8389
{{- end }}
8490

8591
{{- define "lib.sh" }}
8692
sentinel_get_master() {
8793
set +e
8894
if [ "$SENTINEL_PORT" -eq 0 ]; then
89-
redis-cli -h "${SERVICE}" -p "${SENTINEL_TLS_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} --tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} {{ if ne (default "yes" .Values.sentinel.authClients) "no"}} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}{{ end }} sentinel get-master-addr-by-name "${MASTER_GROUP}" |\
90-
grep -E '((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?s*$))'
95+
if [ "$RESOLVE_HOSTNAMES" = true ]; then
96+
redis-cli -h "${SERVICE}" -p "${SENTINEL_TLS_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} --tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} {{ if ne (default "yes" .Values.sentinel.authClients) "no"}} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}{{ end }} sentinel get-master-addr-by-name "${MASTER_GROUP}" |\
97+
head -n 1 | grep -E '^\s*[a-zA-Z0-9.-]+\s*$'
98+
else
99+
redis-cli -h "${SERVICE}" -p "${SENTINEL_TLS_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} --tls --cacert /tls-certs/{{ .Values.tls.caCertFile }} {{ if ne (default "yes" .Values.sentinel.authClients) "no"}} --cert /tls-certs/{{ .Values.tls.certFile }} --key /tls-certs/{{ .Values.tls.keyFile }}{{ end }} sentinel get-master-addr-by-name "${MASTER_GROUP}" |\
100+
head -n 1 | grep -E '((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?s*$))'
101+
fi
91102
else
92-
redis-cli -h "${SERVICE}" -p "${SENTINEL_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} sentinel get-master-addr-by-name "${MASTER_GROUP}" |\
93-
grep -E '((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?s*$))'
103+
if [ "$RESOLVE_HOSTNAMES" = true ]; then
104+
redis-cli -h "${SERVICE}" -p "${SENTINEL_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} sentinel get-master-addr-by-name "${MASTER_GROUP}" |\
105+
head -n 1 | grep -E '^\s*[a-zA-Z0-9.-]+\s*$'
106+
else
107+
redis-cli -h "${SERVICE}" -p "${SENTINEL_PORT}" {{ if .Values.sentinel.auth }} -a "${SENTINELAUTH}" --no-auth-warning{{ end }} sentinel get-master-addr-by-name "${MASTER_GROUP}" |\
108+
head -n 1 | grep -E '((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?s*$))'
109+
fi
94110
fi
95111
set -e
96112
}
@@ -177,16 +193,23 @@
177193
echo " make sure ${ANNOUNCE_IP} is not a slave (slaveof no one)"
178194
sed -i "s/^.*slaveof.*//" "${REDIS_CONF}"
179195
else
180-
echo "Getting redis master ip.."
181-
echo " blindly assuming (${SERVICE}-announce-0) or (${SERVICE}-server-0) are master"
182-
DEFAULT_MASTER="$(getent_hosts 0 | awk '{ print $1 }')"
183-
if [ -z "${DEFAULT_MASTER}" ]; then
184-
echo "Error: Unable to resolve redis master (getent hosts)."
185-
exit 1
196+
if [ "$RESOLVE_HOSTNAMES" = true ]; then
197+
echo "Getting redis master hostname.."
198+
echo " blindly assuming (${SERVICE}-announce-0.${NAMESPACE}.svc) is master"
199+
DEFAULT_MASTER="${SERVICE}-announce-0.${NAMESPACE}.svc"
200+
echo " identified redis (may be redis master) hostname (${DEFAULT_MASTER})"
201+
else
202+
echo "Getting redis master ip.."
203+
echo " blindly assuming (${SERVICE}-announce-0) or (${SERVICE}-server-0) are master"
204+
DEFAULT_MASTER="$(getent_hosts 0 | awk '{ print $1 }')"
205+
if [ -z "${DEFAULT_MASTER}" ]; then
206+
echo "Error: Unable to resolve redis master (getent hosts)."
207+
exit 1
208+
fi
209+
echo " identified redis (may be redis master) ip (${DEFAULT_MASTER})"
186210
fi
187-
echo " identified redis (may be redis master) ip (${DEFAULT_MASTER})"
188211
echo "Setting default slave config for redis and sentinel.."
189-
echo " using master ip (${DEFAULT_MASTER})"
212+
echo " using master address (${DEFAULT_MASTER})"
190213
redis_update "${DEFAULT_MASTER}"
191214
sentinel_update "${DEFAULT_MASTER}"
192215
fi
@@ -281,14 +304,24 @@
281304
getent_hosts() {
282305
index=${1:-${INDEX}}
283306
service="${SERVICE}-announce-${index}"
284-
host=$(getent hosts "${service}")
285-
echo "${host}"
307+
if [ "$RESOLVE_HOSTNAMES" = true ]; then
308+
echo "${service}.${NAMESPACE}.svc"
309+
else
310+
host=$(getent hosts "${service}")
311+
echo "${host}"
312+
fi
286313
}
287314

288315
identify_announce_ip() {
289-
echo "Identify announce ip for this pod.."
290-
echo " using (${SERVICE}-announce-${INDEX}) or (${SERVICE}-server-${INDEX})"
291-
ANNOUNCE_IP=$(getent_hosts | awk '{ print $1 }')
316+
if [ "$ANNOUNCE_HOSTNAMES" = true ]; then
317+
echo "Identify announce hostname for this pod.."
318+
echo " using (${SERVICE}-announce-${INDEX}.${NAMESPACE}.svc)"
319+
ANNOUNCE_IP="${SERVICE}-announce-${INDEX}.${NAMESPACE}.svc"
320+
else
321+
echo "Identify announce ip for this pod.."
322+
echo " using (${SERVICE}-announce-${INDEX}) or (${SERVICE}-server-${INDEX})"
323+
ANNOUNCE_IP=$(getent_hosts | awk '{ print $1 }')
324+
fi
292325
echo " identified announce (${ANNOUNCE_IP})"
293326
}
294327
{{- end }}
@@ -310,8 +343,11 @@
310343
SENTINEL_CONF=/data/conf/sentinel.conf
311344
SENTINEL_TLS_PORT={{ .Values.sentinel.tlsPort }}
312345
SERVICE={{ template "redis-ha.fullname" . }}
346+
NAMESPACE="{{ .Release.Namespace }}"
313347
SENTINEL_TLS_REPLICATION_ENABLED={{ default false .Values.sentinel.tlsReplication }}
314348
REDIS_TLS_REPLICATION_ENABLED={{ default false .Values.redis.tlsReplication }}
349+
RESOLVE_HOSTNAMES={{ default false .Values.sentinel.resolveHostnames }}
350+
ANNOUNCE_HOSTNAMES={{ default false .Values.sentinel.announceHostnames }}
315351
{{- end }}
316352

317353
{{- define "config-init.sh" }}
@@ -333,7 +369,7 @@
333369
identify_announce_ip
334370

335371
if [ -z "${ANNOUNCE_IP}" ]; then
336-
"Error: Could not resolve the announce ip for this pod"
372+
echo "Error: Could not resolve the announce address for this pod"
337373
exit 1
338374
elif [ "${MASTER}" ]; then
339375
find_master
@@ -460,7 +496,7 @@
460496
identify_announce_ip
461497

462498
while [ -z "${ANNOUNCE_IP}" ]; do
463-
echo "Error: Could not resolve the announce ip for this pod."
499+
echo "Error: Could not resolve the announce address for this pod."
464500
sleep 30
465501
identify_announce_ip
466502
done
@@ -540,8 +576,12 @@
540576
tcp-check expect string REPLACE_ANNOUNCE{{ $i }}
541577
tcp-check send QUIT\r\n
542578
{{- range $i := until $replicas }}
579+
{{- if $.Values.sentinel.resolveHostnames }}
580+
server R{{ $i }} {{ $fullName }}-announce-{{ $i }}.{{ $.Release.Namespace }}.svc:26379 check inter {{ $root.Values.haproxy.checkInterval }}
581+
{{- else }}
543582
server R{{ $i }} {{ $fullName }}-announce-{{ $i }}:26379 check inter {{ $root.Values.haproxy.checkInterval }}
544583
{{- end }}
584+
{{- end }}
545585
{{- end }}
546586

547587
# decide redis backend to use
@@ -580,8 +620,12 @@
580620
tcp-check expect string +OK
581621
{{- range $i := until $replicas }}
582622
use-server R{{ $i }} if { srv_is_up(R{{ $i }}) } { nbsrv(check_if_redis_is_master_{{ $i }}) ge 2 }
623+
{{- if $.Values.sentinel.resolveHostnames }}
624+
server R{{ $i }} {{ $fullName }}-announce-{{ $i }}.{{ $.Release.Namespace }}.svc:{{ $root.Values.redis.port }} check inter {{ $root.Values.haproxy.checkInterval }} fall {{ $root.Values.haproxy.checkFall }} rise 1
625+
{{- else }}
583626
server R{{ $i }} {{ $fullName }}-announce-{{ $i }}:{{ $root.Values.redis.port }} check inter {{ $root.Values.haproxy.checkInterval }} fall {{ $root.Values.haproxy.checkFall }} rise 1
584627
{{- end }}
628+
{{- end }}
585629
{{- if .Values.haproxy.readOnly.enabled }}
586630
backend bk_redis_slave
587631
{{- if .Values.haproxy.stickyBalancing }}
@@ -602,8 +646,12 @@
602646
tcp-check send QUIT\r\n
603647
tcp-check expect string +OK
604648
{{- range $i := until $replicas }}
649+
{{- if $.Values.sentinel.resolveHostnames }}
650+
server R{{ $i }} {{ $fullName }}-announce-{{ $i }}.{{ $.Release.Namespace }}.svc:{{ $root.Values.redis.port }} check inter {{ $root.Values.haproxy.checkInterval }} fall {{ $root.Values.haproxy.checkFall }} rise 1
651+
{{- else }}
605652
server R{{ $i }} {{ $fullName }}-announce-{{ $i }}:{{ $root.Values.redis.port }} check inter {{ $root.Values.haproxy.checkInterval }} fall {{ $root.Values.haproxy.checkFall }} rise 1
606653
{{- end }}
654+
{{- end }}
607655
{{- end }}
608656
{{- if .Values.haproxy.metrics.enabled }}
609657
frontend stats
@@ -627,16 +675,23 @@
627675
cp /readonly/haproxy.cfg "$HAPROXY_CONF"
628676
{{- $fullName := include "redis-ha.fullname" . }}
629677
{{- $replicas := int (toString .Values.replicas) }}
678+
{{- $resolveHostnames := .Values.sentinel.resolveHostnames }}
679+
{{- $namespace := .Release.Namespace }}
630680
{{- range $i := until $replicas }}
681+
{{- if $resolveHostnames }}
682+
ANNOUNCE_IP{{ $i }}="{{ $fullName }}-announce-{{ $i }}.{{ $namespace }}.svc"
683+
echo "Using hostname for {{ $fullName }}-announce-{{ $i }}.{{ $namespace }}.svc: $ANNOUNCE_IP{{ $i }}"
684+
{{- else }}
631685
for loop in $(seq 1 10); do
632686
getent hosts {{ $fullName }}-announce-{{ $i }} && break
633687
echo "Waiting for service {{ $fullName }}-announce-{{ $i }} to be ready ($loop) ..." && sleep 1
634688
done
635689
ANNOUNCE_IP{{ $i }}=$(getent hosts "{{ $fullName }}-announce-{{ $i }}" | awk '{ print $1 }')
636690
if [ -z "$ANNOUNCE_IP{{ $i }}" ]; then
637-
echo "Could not resolve the announce ip for {{ $fullName }}-announce-{{ $i }}"
691+
echo "Could not resolve the announce address for {{ $fullName }}-announce-{{ $i }}"
638692
exit 1
639693
fi
694+
{{- end }}
640695
sed -i "s/REPLACE_ANNOUNCE{{ $i }}/$ANNOUNCE_IP{{ $i }}/" "$HAPROXY_CONF"
641696

642697
{{- end }}

charts/oauth2-proxy/charts/redis-ha/templates/redis-ha-serviceaccount.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ metadata:
1919
{{- if or .Values.auth .Values.sentinel.auth }}
2020
secrets:
2121
{{- end }}
22+
{{- if and (and (.Values.auth) (.Values.sentinel.auth)) (eq (.Values.existingSecret) (.Values.sentinel.existingSecret)) }}
23+
- name: {{ default (include "redis-ha.fullname" .) (tpl (.Values.existingSecret | default "" ) . ) }}
24+
{{- else }}
2225
{{- if .Values.auth }}
2326
- name: {{ default (include "redis-ha.fullname" .) (tpl (.Values.existingSecret | default "" ) . ) }}
2427
{{- end }}
2528
{{- if .Values.sentinel.auth }}
2629
- name: {{ default (printf "%s-sentinel" (include "redis-ha.fullname" .)) (tpl (.Values.sentinel.existingSecret | default "" ) . ) }}
2730
{{- end }}
31+
{{- end }}
2832
{{- if .Values.imagePullSecrets }}
2933
imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 0 }}
3034
{{- end }}

0 commit comments

Comments
 (0)