* refactor to use shared role-based service shared across pods: - 'crawler' service for all crawler screencasting, scales 0 .. N with crawler-<ID>-N.crawl - 'redis' service for all redis access, redis-<ID>-0.redis - 'browser' service for all browser access (profile browsers), browser-<ID>-0.browser - don't create a new service per crawl/profile at all - enable 'publishNotReadyAddresses' for potentially faster resolving, esp for redis - remove service as type managed by operator as no longer creating services dynamically - remove frontend var CRAWLER_SVC_SUFFIX, suffix always '.crawler' to match crawler service name
118 lines
2.6 KiB
YAML
118 lines
2.6 KiB
YAML
# --------
|
|
# REDIS
|
|
# --------
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: redis-{{ id }}
|
|
namespace: {{ namespace }}
|
|
labels:
|
|
crawl: {{ id }}
|
|
role: redis
|
|
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
crawl: {{ id }}
|
|
role: redis
|
|
|
|
serviceName: redis
|
|
replicas: {{ redis_scale }}
|
|
podManagementPolicy: Parallel
|
|
|
|
# not yet supported
|
|
#persistentVolumeClaimRetentionPolicy:
|
|
# whenDeleted: Delete
|
|
# whenScaled: Delete
|
|
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: redis-data
|
|
labels:
|
|
crawl: {{ id }}
|
|
role: redis
|
|
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
|
|
resources:
|
|
requests:
|
|
storage: 1Gi
|
|
|
|
{% if volume_storage_class %}
|
|
storageClassName: {{ volume_storage_class }}
|
|
{% endif %}
|
|
|
|
template:
|
|
metadata:
|
|
labels:
|
|
crawl: {{ id }}
|
|
role: redis
|
|
|
|
spec:
|
|
terminationGracePeriodSeconds: 10
|
|
#nodeSelector: {{ crawl_node_selector }}
|
|
volumes:
|
|
- name: shared-redis-conf
|
|
configMap:
|
|
name: shared-redis-conf
|
|
items:
|
|
- key: redis.conf
|
|
path: redis.conf
|
|
|
|
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:
|
|
job-name: job-{{ id }}
|
|
crawl: {{ id }}
|
|
|
|
tolerations:
|
|
- key: "nodeType"
|
|
operator: "Equal"
|
|
value: "crawling"
|
|
effect: "NoSchedule"
|
|
|
|
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: {{ redis_memory }}
|
|
|
|
requests:
|
|
cpu: {{ redis_cpu }}
|
|
memory: {{ redis_memory }}
|
|
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- redis-cli
|
|
- ping
|