Files
ansible-role-wikideck/templates/deployment.yml.j2
T
2026-11-01 17:11:07 -05:00

126 lines
4.3 KiB
Django/Jinja

# SPDX-License-Identifier: MIT-0
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ wikideck_name | to_json }}
namespace: {{ wikideck_namespace | to_json }}
labels:
app.kubernetes.io/name: wikideck
app.kubernetes.io/instance: {{ wikideck_name | to_json }}
app.kubernetes.io/managed-by: ansible
spec:
# One validator per ledger/PVC. Other validators need separate role instances.
replicas: 1
strategy:
type: Recreate
revisionHistoryLimit: 2
selector:
matchLabels:
app.kubernetes.io/name: wikideck
app.kubernetes.io/instance: {{ wikideck_name | to_json }}
template:
metadata:
annotations: {{ wikideck_pod_annotations | to_json }}
labels:
app.kubernetes.io/name: wikideck
app.kubernetes.io/instance: {{ wikideck_name | to_json }}
spec:
serviceAccountName: {{ wikideck_name | to_json }}
automountServiceAccountToken: false
enableServiceLinks: false
terminationGracePeriodSeconds: 30
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: OnRootMismatch
seccompProfile:
type: RuntimeDefault
{% if wikideck_image_pull_secrets | length > 0 %}
imagePullSecrets:
{% for secret in wikideck_image_pull_secrets %}
- name: {{ secret | to_json }}
{% endfor %}
{% endif %}
nodeSelector: {{ wikideck_node_selector | to_json }}
tolerations: {{ wikideck_tolerations | to_json }}
affinity: {{ wikideck_affinity | to_json }}
containers:
- name: wikideck
image: {{ wikideck_image | to_json }}
imagePullPolicy: {{ wikideck_image_pull_policy | to_json }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
ports:
- name: http
containerPort: 3001
protocol: TCP
env:
- name: NODE_ENV
value: production
- name: HOST
value: "0.0.0.0"
- name: PORT
value: "3001"
- name: WIKIDECK_DATA_DIR
value: /app/data
- name: WIKIDECK_PEERS
value: {{ (wikideck_peers | join(',')) | to_json }}
- name: WIKIDECK_ALLOW_PRIVATE_PEERS
value: {{ ('1' if wikideck_allow_private_peers else '0') | to_json }}
- name: WIKIDECK_MAINNET_LAUNCH
value: {{ wikideck_mainnet_launch | to_json }}
- name: WIKIDECK_MAINNET_RISK_ACK
value: {{ wikideck_mainnet_risk_ack | to_json }}
{% if wikideck_trusted_proxies | length > 0 %}
- name: WIKIDECK_TRUSTED_PROXIES
value: {{ (wikideck_trusted_proxies | join(',')) | to_json }}
{% endif %}
{% if wikideck_ops_port | string | length > 0 %}
- name: WIKIDECK_OPS_PORT
value: {{ (wikideck_ops_port | string) | to_json }}
{% endif %}
{% if wikideck_public_origin | length > 0 %}
- name: PUBLIC_ORIGIN
value: {{ wikideck_public_origin | to_json }}
{% endif %}
resources: {{ wikideck_resources | to_json }}
startupProbe:
httpGet:
path: /healthz
port: http
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: {{ wikideck_startup_probe_failure_threshold | int }}
readinessProbe:
httpGet:
path: /healthz
port: http
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: 3
livenessProbe:
httpGet:
path: /healthz
port: http
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
volumeMounts:
- name: data
mountPath: /app/data
- name: tmp
mountPath: /tmp
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ (wikideck_existing_claim if wikideck_existing_claim | length > 0 else wikideck_name ~ '-data') | to_json }}
- name: tmp
emptyDir:
medium: Memory
sizeLimit: 32Mi