poc-reports/sds/base/valkey.yaml

192 lines
4.9 KiB
YAML

---
# Source: valkey/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: valkey
labels:
helm.sh/chart: valkey-0.9.3
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: valkey
app.kubernetes.io/version: "9.0.1"
app.kubernetes.io/managed-by: Helm
automountServiceAccountToken: false
---
# Source: valkey/templates/init_config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: valkey-init-scripts
labels:
helm.sh/chart: valkey-0.9.3
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: valkey
app.kubernetes.io/version: "9.0.1"
app.kubernetes.io/managed-by: Helm
data:
init.sh: |-
#!/bin/sh
set -eu
# Default config paths
VALKEY_CONFIG=${VALKEY_CONFIG_PATH:-/data/conf/valkey.conf}
LOGFILE="/data/init.log"
DATA_DIR="/data/conf"
# Logging function (outputs to stderr and file)
log() {
echo "$(date) $1" | tee -a "$LOGFILE" >&2
}
# Clean old log if requested
if [ "${KEEP_OLD_LOGS:-false}" != "true" ]; then
rm -f "$LOGFILE"
fi
if [ -f "$LOGFILE" ]; then
log "Detected restart of this instance ($HOSTNAME)"
fi
log "Creating configuration in $DATA_DIR..."
mkdir -p "$DATA_DIR"
rm -f "$VALKEY_CONFIG"
# Base valkey.conf
log "Generating base valkey.conf"
{
echo "port 6379"
echo "protected-mode no"
echo "bind * -::*"
echo "dir /data"
} >>"$VALKEY_CONFIG"
# Append extra configs if present
if [ -f /usr/local/etc/valkey/valkey.conf ]; then
log "Appending /usr/local/etc/valkey/valkey.conf"
cat /usr/local/etc/valkey/valkey.conf >>"$VALKEY_CONFIG"
fi
if [ -d /extravalkeyconfigs ]; then
log "Appending files in /extravalkeyconfigs/"
cat /extravalkeyconfigs/* >>"$VALKEY_CONFIG"
fi
---
# Source: valkey/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: valkey
labels:
helm.sh/chart: valkey-0.9.3
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: valkey
app.kubernetes.io/version: "9.0.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: primary
spec:
type: ClusterIP
ports:
- port: 6379
targetPort: tcp
protocol: TCP
name: tcp
selector:
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: valkey
---
# Source: valkey/templates/deploy_valkey.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: valkey
labels:
helm.sh/chart: valkey-0.9.3
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: valkey
app.kubernetes.io/version: "9.0.1"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
strategy:
type: RollingUpdate
selector:
matchLabels:
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: valkey
template:
metadata:
labels:
app.kubernetes.io/name: valkey
app.kubernetes.io/instance: valkey
annotations:
checksum/initconfig: 085c7380f8b46ec02c949176200b2290
spec:
automountServiceAccountToken: false
serviceAccountName: valkey
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsUser: 1000
initContainers:
- name: valkey-init
image: docker.io/valkey/valkey:9.0.1
imagePullPolicy: IfNotPresent
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
command: [ "/scripts/init.sh" ]
volumeMounts:
- name: valkey-data
mountPath: /data
- name: scripts
mountPath: /scripts
containers:
- name: valkey
image: docker.io/valkey/valkey:9.0.1
imagePullPolicy: IfNotPresent
command: [ "valkey-server" ]
args: [ "/data/conf/valkey.conf" ]
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
env:
- name: VALKEY_LOGLEVEL
value: "notice"
ports:
- name: tcp
containerPort: 6379
protocol: TCP
startupProbe:
exec:
command: [ "sh", "-c", "valkey-cli ping" ]
livenessProbe:
exec:
command: [ "sh", "-c", "valkey-cli ping" ]
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 100m
memory: 128Mi
volumeMounts:
- name: valkey-data
mountPath: /data
volumes:
- name: scripts
configMap:
name: valkey-init-scripts
defaultMode: 0555
- name: valkey-data
emptyDir: {}