This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stable/redis-ha] Added HAProxy to support exposed Redis environments. (
#15305) * Added HAProxy Templating / Support for LB Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Updated some nodeSelector values Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Added better message to config-init script Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Cleanup / Added to README and reverted defaultS Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Bump chart version Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Added HAProxy Templating / Support for LB Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Updated some nodeSelector values Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Added better message to config-init script Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Cleanup / Added to README and reverted defaultS Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Bump chart version Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Removed previous attempt at separate chart Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Removed trailing spaces Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Fixed selectors. Working perfectly! Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Fixed deployment spec Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Fixing review comments. Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Adding all AUTH in HAProxy conf. Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Added tcp-check expect to auth check. Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Updating scope within range. Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Changed var to in range Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Added Helm Test/CI Tests, updated existing test Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Fixing linting issues Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Fixing review comments Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Adding livenessprobe. Removing bad test. Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Merging with master Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Upgraded HAProxy version. Fix Segfaulting Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Upgrading chart version Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Adding myself to redis-ha reviewers/approvers Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Removed myself from reviews. Need to be part of helm org. Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com> * Removing myself from contrib list until helm approved Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com>
- Loading branch information
1 parent
903abdf
commit c6d7f8b
Showing
11 changed files
with
309 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
approvers: | ||
- ssalaues | ||
reviewers: | ||
- ssalaues | ||
- ssalaues |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
## Enable HAProxy to manage Load Balancing | ||
haproxy: | ||
enabled: true | ||
serviceAccount: | ||
create: true | ||
exporter: | ||
enabled: false |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{{- if .Values.haproxy.enabled }} | ||
kind: Deployment | ||
apiVersion: extensions/v1beta1 | ||
metadata: | ||
name: {{ template "redis-ha.fullname" . }}-haproxy | ||
labels: | ||
{{ include "labels.standard" . | indent 4 }} | ||
spec: | ||
strategy: | ||
type: RollingUpdate | ||
revisionHistoryLimit: 1 | ||
replicas: {{ .Values.haproxy.replicas }} | ||
selector: | ||
matchLabels: | ||
app: {{ template "redis-ha.name" . }}-haproxy | ||
release: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
name: {{ template "redis-ha.fullname" . }}-haproxy | ||
labels: | ||
app: {{ template "redis-ha.name" . }}-haproxy | ||
release: {{ .Release.Name }} | ||
annotations: | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "9101" | ||
prometheus.io/scrape: "true" | ||
checksum/config: {{ include (print $.Template.BasePath "/redis-ha-configmap.yaml") . | sha256sum }} | ||
{{- if .Values.haproxy.annotations }} | ||
{{ toYaml .Values.haproxy.annotations . | indent 8 }} | ||
{{- end }} | ||
spec: | ||
# Needed when using unmodified rbac-setup.yml | ||
serviceAccountName: {{ template "redis-ha.serviceAccountName" . }}-haproxy | ||
nodeSelector: | ||
{{ toYaml .Values.nodeSelector | indent 8 }} | ||
initContainers: | ||
- name: config-init | ||
image: {{ .Values.haproxy.image.repository }}:{{ .Values.haproxy.image.tag }} | ||
imagePullPolicy: {{ .Values.haproxy.image.pullPolicy }} | ||
resources: | ||
{{ toYaml .Values.haproxy.init.resources | indent 10 }} | ||
command: | ||
- sh | ||
args: | ||
- /readonly/haproxy_init.sh | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /readonly | ||
readOnly: true | ||
- name: data | ||
mountPath: /data | ||
containers: | ||
{{- if .Values.haproxy.exporter.enabled }} | ||
- name: prometheus-exporter | ||
image: {{ .Values.haproxy.exporter.image.repository }}:{{ .Values.haproxy.exporter.image.tag }} | ||
imagePullPolicy: {{ .Values.haproxy.pullPolicy }} | ||
ports: | ||
- name: exporter-port | ||
containerPort: {{ default "9101" .Values.haproxy.exporter.port }} | ||
command: ["haproxy_exporter", | ||
"--haproxy.scrape-uri=unix:/run/haproxy/admin.sock"] | ||
volumeMounts: | ||
- name: shared-socket | ||
mountPath: /run/haproxy | ||
{{- end }} | ||
- name: haproxy | ||
image: {{ .Values.haproxy.image.repository }}:{{ .Values.haproxy.image.tag }} | ||
imagePullPolicy: {{ .Values.haproxy.image.pullPolicy }} | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 8888 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 3 | ||
ports: | ||
- name: redis | ||
containerPort: {{ default "6379" .Values.redis.port }} | ||
hostPort: 6379 | ||
resources: | ||
{{ toYaml .Values.haproxy.resources | indent 10 }} | ||
volumeMounts: | ||
- name: data | ||
mountPath: /usr/local/etc/haproxy | ||
- name: shared-socket | ||
mountPath: /run/haproxy | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: {{ template "redis-ha.fullname" . }}-configmap | ||
- name: shared-socket | ||
emptyDir: {} | ||
- name: data | ||
emptyDir: {} | ||
{{- end }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{{- if .Values.haproxy.enabled }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "redis-ha.fullname" . }}-haproxy | ||
labels: | ||
{{ include "labels.standard" . | indent 4 }} | ||
annotations: | ||
{{- if .Values.haproxy.service.annotations }} | ||
{{ toYaml .Values.haproxy.service.annotations | indent 4 }} | ||
{{- end }} | ||
spec: | ||
type: {{ default "ClusterIP" .Values.haproxy.service.type }} | ||
ports: | ||
- name: haproxy | ||
port: {{ .Values.redis.port }} | ||
protocol: TCP | ||
targetPort: redis | ||
{{- if .Values.exporter.enabled }} | ||
- name: exporter-port | ||
port: {{ .Values.haproxy.exporter.port }} | ||
protocol: TCP | ||
targetPort: exporter-port | ||
{{- end }} | ||
selector: | ||
release: {{ .Release.Name }} | ||
app: {{ template "redis-ha.name" . }}-haproxy | ||
{{- end }} |
11 changes: 11 additions & 0 deletions
11
stable/redis-ha/templates/redis-haproxy-serviceaccount.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{- if and .Values.haproxy.serviceAccount.create .Values.haproxy.enabled }} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ template "redis-ha.serviceAccountName" . }}-haproxy | ||
labels: | ||
heritage: {{ .Release.Service }} | ||
release: {{ .Release.Name }} | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version }} | ||
app: {{ template "redis-ha.fullname" . }} | ||
{{- end }} |
File renamed without changes.
This file contains 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