browsertrix/chart/app-templates/redis.yaml
Ilya Kreymer 5530ca92e1
Move backend app templates to be installed from configmap volume (#1331)
Instead of adding the app templates launched from the backend via
`backend/btrixcloud/templates`, add them to a configmap and mount the
configmap in the same location.

This allows these templates to be updated, like other values in
charts/... without having to rebuild any of the images, speeding up dev
and maintenance time.

Changes include:
- move backend/btrixcloud/templates -> chart/app-templates/
- add app-templates/*.yaml to app-templates configmap
- mount app-templates configmap to /app/btrixcloud/templates/ in api and op containers
2023-11-06 09:37:48 -08:00

131 lines
2.6 KiB
YAML

# -------
# PVC
# -------
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ name }}
namespace: {{ namespace }}
labels:
crawl: {{ id }}
role: redis
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ redis_storage }}
{% if volume_storage_class %}
storageClassName: {{ volume_storage_class }}
{% endif %}
# --------
# REDIS
# --------
{% if init_redis %}
---
apiVersion: v1
kind: Pod
metadata:
name: {{ name }}
namespace: {{ namespace }}
labels:
crawl: {{ id }}
role: redis
spec:
hostname: {{ name }}
subdomain: redis
terminationGracePeriodSeconds: 10
volumes:
- name: shared-redis-conf
configMap:
name: shared-redis-conf
items:
- key: redis.conf
path: redis.conf
- name: redis-data
persistentVolumeClaim:
claimName: {{ name }}
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: nodeType
operator: In
values:
- "{{ redis_node_type }}"
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 2
podAffinityTerm:
topologyKey: "failure-domain.beta.kubernetes.io/zone"
labelSelector:
matchLabels:
crawl: {{ id }}
tolerations:
- key: nodeType
operator: Equal
value: crawling
effect: NoSchedule
- key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 300
effect: NoExecute
- key: node.kubernetes.io/unreachable
operator: Exists
effect: NoExecute
tolerationSeconds: 300
containers:
- name: redis
image: {{ redis_image }}
imagePullPolicy: {{ redis_image_pull_policy }}
args: ["/redis-conf/redis.conf", "--appendonly", "yes"]
volumeMounts:
- name: redis-data
mountPath: /data
- name: shared-redis-conf
mountPath: /redis-conf
resources:
limits:
memory: {{ memory }}
requests:
cpu: {{ cpu }}
memory: {{ memory }}
readinessProbe:
initialDelaySeconds: 10
timeoutSeconds: 5
exec:
command:
- bash
- -c
- "res=$(redis-cli ping); [[ $res = 'PONG' ]]"
livenessProbe:
initialDelaySeconds: 10
timeoutSeconds: 5
exec:
command:
- bash
- -c
- "res=$(redis-cli ping); [[ $res = 'PONG' ]]"
{% endif %}