generated from onedr0p/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(kubernetes): archive redis cluster #198
Merged
Merged
Conversation
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
It was only used by authelia which is gone. I don't plan to use shared redis' in the future, so it can go away. Updates #192
github-actions
bot
added
the
area/kubernetes
Changes made in the kubernetes directory
label
Jan 6, 2024
--- HelmRelease: database/redis ServiceAccount: database/redis
+++ HelmRelease: database/redis ServiceAccount: database/redis
@@ -1,12 +0,0 @@
----
-apiVersion: v1
-kind: ServiceAccount
-automountServiceAccountToken: true
-metadata:
- name: redis
- namespace: database
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
-
--- HelmRelease: database/redis ConfigMap: database/redis-configuration
+++ HelmRelease: database/redis ConfigMap: database/redis-configuration
@@ -1,40 +0,0 @@
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: redis-configuration
- namespace: database
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
-data:
- redis.conf: |-
- # User-supplied common configuration:
- # Enable AOF https://redis.io/topics/persistence#append-only-file
- appendonly yes
- # Disable RDB persistence, AOF persistence already enabled.
- save ""
- # End of common configuration
- master.conf: |-
- dir /data
- # User-supplied master configuration:
- rename-command FLUSHDB ""
- rename-command FLUSHALL ""
- # End of master configuration
- replica.conf: |-
- dir /data
- # User-supplied replica configuration:
- rename-command FLUSHDB ""
- rename-command FLUSHALL ""
- # End of replica configuration
- sentinel.conf: |-
- dir "/tmp"
- port 26379
- sentinel monitor redis-master redis-node-0.redis-headless.database.svc.cluster.local 6379 2
- sentinel down-after-milliseconds redis-master 60000
- sentinel failover-timeout redis-master 180000
- sentinel parallel-syncs redis-master 1
- # User-supplied sentinel configuration:
- # End of sentinel configuration
-
--- HelmRelease: database/redis ConfigMap: database/redis-health
+++ HelmRelease: database/redis ConfigMap: database/redis-health
@@ -1,138 +0,0 @@
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: redis-health
- namespace: database
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
-data:
- ping_readiness_local.sh: |-
- #!/bin/bash
-
- [[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
- [[ -n "$REDIS_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_PASSWORD"
- response=$(
- timeout -s 15 $1 \
- redis-cli \
- -h localhost \
- -p $REDIS_PORT \
- ping
- )
- if [ "$?" -eq "124" ]; then
- echo "Timed out"
- exit 1
- fi
- if [ "$response" != "PONG" ]; then
- echo "$response"
- exit 1
- fi
- ping_liveness_local.sh: |-
- #!/bin/bash
-
- [[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
- [[ -n "$REDIS_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_PASSWORD"
- response=$(
- timeout -s 15 $1 \
- redis-cli \
- -h localhost \
- -p $REDIS_PORT \
- ping
- )
- if [ "$?" -eq "124" ]; then
- echo "Timed out"
- exit 1
- fi
- responseFirstWord=$(echo $response | head -n1 | awk '{print $1;}')
- if [ "$response" != "PONG" ] && [ "$responseFirstWord" != "LOADING" ] && [ "$responseFirstWord" != "MASTERDOWN" ]; then
- echo "$response"
- exit 1
- fi
- ping_sentinel.sh: |-
- #!/bin/bash
- response=$(
- timeout -s 15 $1 \
- redis-cli \
- -h localhost \
- -p $REDIS_SENTINEL_PORT \
- ping
- )
- if [ "$?" -eq "124" ]; then
- echo "Timed out"
- exit 1
- fi
- if [ "$response" != "PONG" ]; then
- echo "$response"
- exit 1
- fi
- parse_sentinels.awk: |-
- /ip/ {FOUND_IP=1}
- /port/ {FOUND_PORT=1}
- /runid/ {FOUND_RUNID=1}
- !/ip|port|runid/ {
- if (FOUND_IP==1) {
- IP=$1; FOUND_IP=0;
- }
- else if (FOUND_PORT==1) {
- PORT=$1;
- FOUND_PORT=0;
- } else if (FOUND_RUNID==1) {
- printf "\nsentinel known-sentinel redis-master %s %s %s", IP, PORT, $0; FOUND_RUNID=0;
- }
- }
- ping_readiness_master.sh: |-
- #!/bin/bash
-
- [[ -f $REDIS_MASTER_PASSWORD_FILE ]] && export REDIS_MASTER_PASSWORD="$(< "${REDIS_MASTER_PASSWORD_FILE}")"
- [[ -n "$REDIS_MASTER_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD"
- response=$(
- timeout -s 15 $1 \
- redis-cli \
- -h $REDIS_MASTER_HOST \
- -p $REDIS_MASTER_PORT_NUMBER \
- ping
- )
- if [ "$?" -eq "124" ]; then
- echo "Timed out"
- exit 1
- fi
- if [ "$response" != "PONG" ]; then
- echo "$response"
- exit 1
- fi
- ping_liveness_master.sh: |-
- #!/bin/bash
-
- [[ -f $REDIS_MASTER_PASSWORD_FILE ]] && export REDIS_MASTER_PASSWORD="$(< "${REDIS_MASTER_PASSWORD_FILE}")"
- [[ -n "$REDIS_MASTER_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD"
- response=$(
- timeout -s 15 $1 \
- redis-cli \
- -h $REDIS_MASTER_HOST \
- -p $REDIS_MASTER_PORT_NUMBER \
- ping
- )
- if [ "$?" -eq "124" ]; then
- echo "Timed out"
- exit 1
- fi
- responseFirstWord=$(echo $response | head -n1 | awk '{print $1;}')
- if [ "$response" != "PONG" ] && [ "$responseFirstWord" != "LOADING" ]; then
- echo "$response"
- exit 1
- fi
- ping_readiness_local_and_master.sh: |-
- script_dir="$(dirname "$0")"
- exit_status=0
- "$script_dir/ping_readiness_local.sh" $1 || exit_status=$?
- "$script_dir/ping_readiness_master.sh" $1 || exit_status=$?
- exit $exit_status
- ping_liveness_local_and_master.sh: |-
- script_dir="$(dirname "$0")"
- exit_status=0
- "$script_dir/ping_liveness_local.sh" $1 || exit_status=$?
- "$script_dir/ping_liveness_master.sh" $1 || exit_status=$?
- exit $exit_status
-
--- HelmRelease: database/redis ConfigMap: database/redis-scripts
+++ HelmRelease: database/redis ConfigMap: database/redis-scripts
@@ -1,391 +0,0 @@
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: redis-scripts
- namespace: database
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
-data:
- start-node.sh: |
- #!/bin/bash
-
- . /opt/bitnami/scripts/libos.sh
- . /opt/bitnami/scripts/liblog.sh
- . /opt/bitnami/scripts/libvalidations.sh
-
- get_port() {
- hostname="$1"
- type="$2"
-
- port_var=$(echo "${hostname^^}_SERVICE_PORT_$type" | sed "s/-/_/g")
- port=${!port_var}
-
- if [ -z "$port" ]; then
- case $type in
- "SENTINEL")
- echo 26379
- ;;
- "REDIS")
- echo 6379
- ;;
- esac
- else
- echo $port
- fi
- }
-
- get_full_hostname() {
- hostname="$1"
- full_hostname="${hostname}.${HEADLESS_SERVICE}"
- echo "${full_hostname}"
- }
-
- REDISPORT=$(get_port "$HOSTNAME" "REDIS")
-
- HEADLESS_SERVICE="redis-headless.database.svc.cluster.local"
-
- if [ -n "$REDIS_EXTERNAL_MASTER_HOST" ]; then
- REDIS_SERVICE="$REDIS_EXTERNAL_MASTER_HOST"
- else
- REDIS_SERVICE="redis.database.svc.cluster.local"
- fi
-
- SENTINEL_SERVICE_PORT=$(get_port "redis" "SENTINEL")
- validate_quorum() {
- if is_boolean_yes "$REDIS_TLS_ENABLED"; then
- quorum_info_command="redis-cli -h $REDIS_SERVICE -p $SENTINEL_SERVICE_PORT --tls --cert ${REDIS_TLS_CERT_FILE} --key ${REDIS_TLS_KEY_FILE} --cacert ${REDIS_TLS_CA_FILE} sentinel master redis-master"
- else
- quorum_info_command="redis-cli -h $REDIS_SERVICE -p $SENTINEL_SERVICE_PORT sentinel master redis-master"
- fi
- info "about to run the command: $quorum_info_command"
- eval $quorum_info_command | grep -Fq "s_down"
- }
-
- trigger_manual_failover() {
- if is_boolean_yes "$REDIS_TLS_ENABLED"; then
- failover_command="redis-cli -h $REDIS_SERVICE -p $SENTINEL_SERVICE_PORT --tls --cert ${REDIS_TLS_CERT_FILE} --key ${REDIS_TLS_KEY_FILE} --cacert ${REDIS_TLS_CA_FILE} sentinel failover redis-master"
- else
- failover_command="redis-cli -h $REDIS_SERVICE -p $SENTINEL_SERVICE_PORT sentinel failover redis-master"
- fi
-
- info "about to run the command: $failover_command"
- eval $failover_command
- }
-
- get_sentinel_master_info() {
- if is_boolean_yes "$REDIS_TLS_ENABLED"; then
- sentinel_info_command="timeout 10 redis-cli -h $REDIS_SERVICE -p $SENTINEL_SERVICE_PORT --tls --cert ${REDIS_TLS_CERT_FILE} --key ${REDIS_TLS_KEY_FILE} --cacert ${REDIS_TLS_CA_FILE} sentinel get-master-addr-by-name redis-master"
- else
- sentinel_info_command="timeout 10 redis-cli -h $REDIS_SERVICE -p $SENTINEL_SERVICE_PORT sentinel get-master-addr-by-name redis-master"
- fi
-
- info "about to run the command: $sentinel_info_command"
- retry_while "eval $sentinel_info_command" 2 5
- }
-
- [[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
- [[ -f $REDIS_MASTER_PASSWORD_FILE ]] && export REDIS_MASTER_PASSWORD="$(< "${REDIS_MASTER_PASSWORD_FILE}")"
-
- # check if there is a master
- master_in_persisted_conf="$(get_full_hostname "$HOSTNAME")"
- master_port_in_persisted_conf="$REDIS_MASTER_PORT_NUMBER"
- master_in_sentinel="$(get_sentinel_master_info)"
- redisRetVal=$?
-
- if [[ $redisRetVal -ne 0 ]]; then
- if [[ "$master_in_persisted_conf" == "$(get_full_hostname "$HOSTNAME")" ]]; then
- # Case 1: No active sentinel and in previous sentinel.conf we were the master --> MASTER
- info "Configuring the node as master"
- export REDIS_REPLICATION_MODE="master"
- else
- # Case 2: No active sentinel and in previous sentinel.conf we were not master --> REPLICA
- info "Configuring the node as replica"
- export REDIS_REPLICATION_MODE="replica"
- REDIS_MASTER_HOST=${master_in_persisted_conf}
- REDIS_MASTER_PORT_NUMBER=${master_port_in_persisted_conf}
- fi
- else
- # Fetches current master's host and port
- REDIS_SENTINEL_INFO=($(get_sentinel_master_info))
- info "Current master: REDIS_SENTINEL_INFO=(${REDIS_SENTINEL_INFO[0]},${REDIS_SENTINEL_INFO[1]})"
- REDIS_MASTER_HOST=${REDIS_SENTINEL_INFO[0]}
- REDIS_MASTER_PORT_NUMBER=${REDIS_SENTINEL_INFO[1]}
-
- if [[ "$REDIS_MASTER_HOST" == "$(get_full_hostname "$HOSTNAME")" ]]; then
- # Case 3: Active sentinel and master it is this node --> MASTER
- info "Configuring the node as master"
- export REDIS_REPLICATION_MODE="master"
- else
- # Case 4: Active sentinel and master is not this node --> REPLICA
- info "Configuring the node as replica"
- export REDIS_REPLICATION_MODE="replica"
- fi
- fi
-
- if [[ -n "$REDIS_EXTERNAL_MASTER_HOST" ]]; then
- REDIS_MASTER_HOST="$REDIS_EXTERNAL_MASTER_HOST"
- REDIS_MASTER_PORT_NUMBER="${REDIS_EXTERNAL_MASTER_PORT}"
- fi
-
- if [[ -f /opt/bitnami/redis/mounted-etc/replica.conf ]];then
- cp /opt/bitnami/redis/mounted-etc/replica.conf /opt/bitnami/redis/etc/replica.conf
- fi
-
- if [[ -f /opt/bitnami/redis/mounted-etc/redis.conf ]];then
- cp /opt/bitnami/redis/mounted-etc/redis.conf /opt/bitnami/redis/etc/redis.conf
- fi
-
- echo "" >> /opt/bitnami/redis/etc/replica.conf
- echo "replica-announce-port $REDISPORT" >> /opt/bitnami/redis/etc/replica.conf
- echo "replica-announce-ip $(get_full_hostname "$HOSTNAME")" >> /opt/bitnami/redis/etc/replica.conf
- ARGS=("--port" "${REDIS_PORT}")
-
- if [[ "$REDIS_REPLICATION_MODE" = "slave" ]] || [[ "$REDIS_REPLICATION_MODE" = "replica" ]]; then
- ARGS+=("--replicaof" "${REDIS_MASTER_HOST}" "${REDIS_MASTER_PORT_NUMBER}")
- fi
- ARGS+=("--protected-mode" "no")
- ARGS+=("--include" "/opt/bitnami/redis/etc/replica.conf")
- ARGS+=("--include" "/opt/bitnami/redis/etc/redis.conf")
- exec redis-server "${ARGS[@]}"
- start-sentinel.sh: |
- #!/bin/bash
-
- . /opt/bitnami/scripts/libos.sh
- . /opt/bitnami/scripts/libvalidations.sh
- . /opt/bitnami/scripts/libfile.sh
-
- HEADLESS_SERVICE="redis-headless.database.svc.cluster.local"
- REDIS_SERVICE="redis.database.svc.cluster.local"
-
- get_port() {
- hostname="$1"
- type="$2"
-
- port_var=$(echo "${hostname^^}_SERVICE_PORT_$type" | sed "s/-/_/g")
- port=${!port_var}
-
- if [ -z "$port" ]; then
- case $type in
- "SENTINEL")
- echo 26379
- ;;
- "REDIS")
- echo 6379
- ;;
- esac
- else
- echo $port
- fi
- }
-
- get_full_hostname() {
- hostname="$1"
- full_hostname="${hostname}.${HEADLESS_SERVICE}"
- echo "${full_hostname}"
- }
-
- SERVPORT=$(get_port "$HOSTNAME" "SENTINEL")
- REDISPORT=$(get_port "$HOSTNAME" "REDIS")
- SENTINEL_SERVICE_PORT=$(get_port "redis" "SENTINEL")
-
- sentinel_conf_set() {
- local -r key="${1:?missing key}"
- local value="${2:-}"
-
- # Sanitize inputs
- value="${value//\\/\\\\}"
- value="${value//&/\\&}"
- value="${value//\?/\\?}"
- [[ "$value" = "" ]] && value="\"$value\""
-
- replace_in_file "/opt/bitnami/redis-sentinel/etc/sentinel.conf" "^#*\s*${key} .*" "${key} ${value}" false
- }
- sentinel_conf_add() {
- echo $'\n'"$@" >> "/opt/bitnami/redis-sentinel/etc/sentinel.conf"
- }
- host_id() {
- echo "$1" | openssl sha1 | awk '{print $2}'
- }
- get_sentinel_master_info() {
- if is_boolean_yes "$REDIS_SENTINEL_TLS_ENABLED"; then
- sentinel_info_command="timeout 10 redis-cli -h $REDIS_SERVICE -p $SENTINEL_SERVICE_PORT --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel get-master-addr-by-name redis-master"
- else
- sentinel_info_command="timeout 10 redis-cli -h $REDIS_SERVICE -p $SENTINEL_SERVICE_PORT sentinel get-master-addr-by-name redis-master"
- fi
- info "about to run the command: $sentinel_info_command"
- retry_while "eval $sentinel_info_command" 2 5
- }
-
- [[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
-
- master_in_persisted_conf="$(get_full_hostname "$HOSTNAME")"
- if ! get_sentinel_master_info && [[ "$master_in_persisted_conf" == "$(get_full_hostname "$HOSTNAME")" ]]; then
- # No master found, lets create a master node
- export REDIS_REPLICATION_MODE="master"
-
- REDIS_MASTER_HOST=$(get_full_hostname "$HOSTNAME")
- REDIS_MASTER_PORT_NUMBER="$REDISPORT"
- else
- export REDIS_REPLICATION_MODE="replica"
-
- # Fetches current master's host and port
- REDIS_SENTINEL_INFO=($(get_sentinel_master_info))
- info "printing REDIS_SENTINEL_INFO=(${REDIS_SENTINEL_INFO[0]},${REDIS_SENTINEL_INFO[1]})"
- REDIS_MASTER_HOST=${REDIS_SENTINEL_INFO[0]}
- REDIS_MASTER_PORT_NUMBER=${REDIS_SENTINEL_INFO[1]}
- fi
-
- if [[ -n "$REDIS_EXTERNAL_MASTER_HOST" ]]; then
- REDIS_MASTER_HOST="$REDIS_EXTERNAL_MASTER_HOST"
- REDIS_MASTER_PORT_NUMBER="${REDIS_EXTERNAL_MASTER_PORT}"
- fi
-
- cp /opt/bitnami/redis-sentinel/mounted-etc/sentinel.conf /opt/bitnami/redis-sentinel/etc/sentinel.conf
- printf "\nsentinel myid %s" "$(host_id "$HOSTNAME")" >> /opt/bitnami/redis-sentinel/etc/sentinel.conf
-
- if [[ -z "$REDIS_MASTER_HOST" ]] || [[ -z "$REDIS_MASTER_PORT_NUMBER" ]]
- then
- # Prevent incorrect configuration to be written to sentinel.conf
[Diff truncated by flux-local]
--- HelmRelease: database/redis Service: database/redis-headless
+++ HelmRelease: database/redis Service: database/redis-headless
@@ -1,25 +0,0 @@
----
-apiVersion: v1
-kind: Service
-metadata:
- name: redis-headless
- namespace: database
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
-spec:
- type: ClusterIP
- clusterIP: None
- publishNotReadyAddresses: true
- ports:
- - name: tcp-redis
- port: 6379
- targetPort: redis
- - name: tcp-sentinel
- port: 26379
- targetPort: redis-sentinel
- selector:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/name: redis
-
--- HelmRelease: database/redis Service: database/redis-metrics
+++ HelmRelease: database/redis Service: database/redis-metrics
@@ -1,22 +0,0 @@
----
-apiVersion: v1
-kind: Service
-metadata:
- name: redis-metrics
- namespace: database
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
- app.kubernetes.io/component: metrics
-spec:
- type: ClusterIP
- ports:
- - name: http-metrics
- port: 9121
- protocol: TCP
- targetPort: metrics
- selector:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/name: redis
-
--- HelmRelease: database/redis Service: database/redis
+++ HelmRelease: database/redis Service: database/redis
@@ -1,28 +0,0 @@
----
-apiVersion: v1
-kind: Service
-metadata:
- name: redis
- namespace: database
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
- app.kubernetes.io/component: node
-spec:
- type: ClusterIP
- sessionAffinity: None
- ports:
- - name: tcp-redis
- port: 6379
- targetPort: 6379
- nodePort: null
- - name: tcp-sentinel
- port: 26379
- targetPort: 26379
- nodePort: null
- selector:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/name: redis
- app.kubernetes.io/component: node
-
--- HelmRelease: database/redis StatefulSet: database/redis-node
+++ HelmRelease: database/redis StatefulSet: database/redis-node
@@ -1,303 +0,0 @@
----
-apiVersion: apps/v1
-kind: StatefulSet
-metadata:
- name: redis-node
- namespace: database
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
- app.kubernetes.io/component: node
-spec:
- replicas: 3
- selector:
- matchLabels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/name: redis
- app.kubernetes.io/component: node
- serviceName: redis-headless
- updateStrategy:
- type: RollingUpdate
- template:
- metadata:
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
- app.kubernetes.io/component: node
- annotations:
- checksum/configmap: 44827545caa1794c0c6696c4406beb71e64dd804ef278fe070efe561c4bc71b7
- checksum/health: 07a9e9f1ff08347b0d2cd65e962feb94d6390f5b64a77ed1346867af2559df4a
- checksum/scripts: 04c034490f9758104676b11f6819c4f159bb0e4956d61091bf6dd68a76b327aa
- checksum/secret: 44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
- prometheus.io/port: '9121'
- prometheus.io/scrape: 'true'
- spec:
- securityContext:
- fsGroup: 1001
- automountServiceAccountToken: true
- serviceAccountName: redis
- affinity:
- podAffinity: null
- podAntiAffinity:
- preferredDuringSchedulingIgnoredDuringExecution:
- - podAffinityTerm:
- labelSelector:
- matchLabels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/name: redis
- app.kubernetes.io/component: node
- topologyKey: kubernetes.io/hostname
- weight: 1
- nodeAffinity: null
- enableServiceLinks: true
- terminationGracePeriodSeconds: 30
- containers:
- - name: redis
- image: docker.io/bitnami/redis:7.2.3-debian-11-r2
- imagePullPolicy: IfNotPresent
- lifecycle:
- preStop:
- exec:
- command:
- - /bin/bash
- - -c
- - /opt/bitnami/scripts/start-scripts/prestop-redis.sh
- securityContext:
- allowPrivilegeEscalation: false
- capabilities:
- drop:
- - ALL
- runAsGroup: 0
- runAsNonRoot: true
- runAsUser: 1001
- seccompProfile:
- type: RuntimeDefault
- command:
- - /bin/bash
- args:
- - -c
- - /opt/bitnami/scripts/start-scripts/start-node.sh
- env:
- - name: BITNAMI_DEBUG
- value: 'false'
- - name: REDIS_MASTER_PORT_NUMBER
- value: '6379'
- - name: ALLOW_EMPTY_PASSWORD
- value: 'yes'
- - name: REDIS_TLS_ENABLED
- value: 'no'
- - name: REDIS_PORT
- value: '6379'
- - name: REDIS_SENTINEL_TLS_ENABLED
- value: 'no'
- - name: REDIS_SENTINEL_PORT
- value: '26379'
- - name: REDIS_DATA_DIR
- value: /data
- ports:
- - name: redis
- containerPort: 6379
- startupProbe:
- failureThreshold: 22
- initialDelaySeconds: 10
- periodSeconds: 10
- successThreshold: 1
- timeoutSeconds: 5
- exec:
- command:
- - sh
- - -c
- - /health/ping_liveness_local.sh 5
- livenessProbe:
- initialDelaySeconds: 20
- periodSeconds: 5
- timeoutSeconds: 5
- successThreshold: 1
- failureThreshold: 5
- exec:
- command:
- - sh
- - -c
- - /health/ping_liveness_local.sh 5
- readinessProbe:
- initialDelaySeconds: 20
- periodSeconds: 5
- timeoutSeconds: 1
- successThreshold: 1
- failureThreshold: 5
- exec:
- command:
- - sh
- - -c
- - /health/ping_readiness_local.sh 1
- resources:
- limits: {}
- requests: {}
- volumeMounts:
- - name: start-scripts
- mountPath: /opt/bitnami/scripts/start-scripts
- - name: health
- mountPath: /health
- - name: redis-data
- mountPath: /data
- - name: config
- mountPath: /opt/bitnami/redis/mounted-etc
- - name: redis-tmp-conf
- mountPath: /opt/bitnami/redis/etc
- - name: tmp
- mountPath: /tmp
- - name: sentinel
- image: docker.io/bitnami/redis-sentinel:7.2.3-debian-11-r2
- imagePullPolicy: IfNotPresent
- lifecycle:
- preStop:
- exec:
- command:
- - /bin/bash
- - -c
- - /opt/bitnami/scripts/start-scripts/prestop-sentinel.sh
- securityContext:
- allowPrivilegeEscalation: false
- capabilities:
- drop:
- - ALL
- runAsGroup: 0
- runAsNonRoot: true
- runAsUser: 1001
- seccompProfile:
- type: RuntimeDefault
- command:
- - /bin/bash
- args:
- - -c
- - /opt/bitnami/scripts/start-scripts/start-sentinel.sh
- env:
- - name: BITNAMI_DEBUG
- value: 'false'
- - name: ALLOW_EMPTY_PASSWORD
- value: 'yes'
- - name: REDIS_SENTINEL_TLS_ENABLED
- value: 'no'
- - name: REDIS_SENTINEL_PORT
- value: '26379'
- ports:
- - name: redis-sentinel
- containerPort: 26379
- startupProbe:
- failureThreshold: 2
- initialDelaySeconds: 10
- periodSeconds: 10
- successThreshold: 1
- timeoutSeconds: 5
- exec:
- command:
- - sh
- - -c
- - /health/ping_sentinel.sh 5
- livenessProbe:
- initialDelaySeconds: 20
- periodSeconds: 10
- timeoutSeconds: 5
- successThreshold: 1
- failureThreshold: 6
- exec:
- command:
- - sh
- - -c
- - /health/ping_sentinel.sh 5
- readinessProbe:
- initialDelaySeconds: 20
- periodSeconds: 5
- timeoutSeconds: 1
- successThreshold: 1
- failureThreshold: 6
- exec:
- command:
- - sh
- - -c
- - /health/ping_sentinel.sh 1
- resources:
- limits: {}
- requests: {}
- volumeMounts:
- - name: start-scripts
- mountPath: /opt/bitnami/scripts/start-scripts
- - name: health
- mountPath: /health
- - name: sentinel-data
- mountPath: /opt/bitnami/redis-sentinel/etc
- - name: redis-data
- mountPath: /data
- - name: config
- mountPath: /opt/bitnami/redis-sentinel/mounted-etc
- - name: metrics
- image: docker.io/bitnami/redis-exporter:1.55.0-debian-11-r3
- imagePullPolicy: IfNotPresent
- securityContext:
- allowPrivilegeEscalation: false
- capabilities:
- drop:
- - ALL
- runAsGroup: 0
- runAsNonRoot: true
- runAsUser: 1001
- seccompProfile:
- type: RuntimeDefault
- command:
- - /bin/bash
- - -c
- - |
- if [[ -f '/secrets/redis-password' ]]; then
- export REDIS_PASSWORD=$(cat /secrets/redis-password)
- fi
- redis_exporter
- env:
- - name: REDIS_ALIAS
- value: redis
- ports:
- - name: metrics
- containerPort: 9121
- livenessProbe:
- failureThreshold: 5
- initialDelaySeconds: 10
- periodSeconds: 10
- successThreshold: 1
- timeoutSeconds: 5
- tcpSocket:
- port: metrics
- readinessProbe:
- failureThreshold: 3
- initialDelaySeconds: 5
- periodSeconds: 10
- successThreshold: 1
- timeoutSeconds: 1
- httpGet:
- path: /
- port: metrics
- resources:
- limits: {}
- requests: {}
- volumeMounts: null
- volumes:
- - name: start-scripts
- configMap:
- name: redis-scripts
- defaultMode: 493
- - name: health
- configMap:
- name: redis-health
- defaultMode: 493
- - name: config
- configMap:
- name: redis-configuration
- - name: sentinel-data
- emptyDir: {}
- - name: redis-tmp-conf
- emptyDir: {}
- - name: tmp
- emptyDir: {}
- - name: redis-data
- emptyDir: {}
-
--- HelmRelease: database/redis ServiceMonitor: database/redis
+++ HelmRelease: database/redis ServiceMonitor: database/redis
@@ -1,23 +0,0 @@
----
-apiVersion: monitoring.coreos.com/v1
-kind: ServiceMonitor
-metadata:
- name: redis
- namespace: database
- labels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/managed-by: Helm
- app.kubernetes.io/name: redis
-spec:
- endpoints:
- - port: http-metrics
- interval: 1m
- namespaceSelector:
- matchNames:
- - database
- selector:
- matchLabels:
- app.kubernetes.io/instance: redis
- app.kubernetes.io/name: redis
- app.kubernetes.io/component: metrics
- |
--- kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/redis
+++ kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/redis
@@ -1,34 +0,0 @@
----
-apiVersion: kustomize.toolkit.fluxcd.io/v1
-kind: Kustomization
-metadata:
- labels:
- kustomize.toolkit.fluxcd.io/name: cluster-apps
- kustomize.toolkit.fluxcd.io/namespace: flux-system
- name: redis
- namespace: flux-system
-spec:
- commonMetadata:
- labels:
- app.kubernetes.io/name: redis
- decryption:
- provider: sops
- secretRef:
- name: sops-age
- interval: 30m
- path: ./kubernetes/apps/database/redis/app
- postBuild:
- substituteFrom:
- - kind: ConfigMap
- name: cluster-settings
- - kind: Secret
- name: cluster-secrets
- prune: true
- retryInterval: 1m
- sourceRef:
- kind: GitRepository
- name: home-kubernetes
- targetNamespace: database
- timeout: 15m
- wait: false
-
--- kubernetes/apps/database/redis/app Kustomization: flux-system/redis HelmRelease: database/redis
+++ kubernetes/apps/database/redis/app Kustomization: flux-system/redis HelmRelease: database/redis
@@ -1,54 +0,0 @@
----
-apiVersion: helm.toolkit.fluxcd.io/v2beta2
-kind: HelmRelease
-metadata:
- labels:
- app.kubernetes.io/name: redis
- kustomize.toolkit.fluxcd.io/name: redis
- kustomize.toolkit.fluxcd.io/namespace: flux-system
- name: redis
- namespace: database
-spec:
- chart:
- spec:
- chart: redis
- sourceRef:
- kind: HelmRepository
- name: bitnami
- namespace: flux-system
- version: 18.6.2
- install:
- remediation:
- retries: 3
- interval: 30m
- timeout: 15m
- uninstall:
- keepHistory: false
- upgrade:
- cleanupOnFail: true
- remediation:
- retries: 3
- values:
- auth:
- enabled: false
- sentinel: false
- master:
- persistence:
- enabled: false
- metrics:
- enabled: true
- serviceMonitor:
- enabled: true
- interval: 1m
- replica:
- persistence:
- enabled: false
- sentinel:
- enabled: true
- getMasterTimeout: 10
- masterSet: redis-master
- persistence:
- enabled: false
- startupProbe:
- failureThreshold: 2
- |
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.
It was only used by authelia which is gone. I don't plan to use shared redis' in the future, so it can go away.
Updates #192