124 lines
4.1 KiB
Django/Jinja
Executable File
124 lines
4.1 KiB
Django/Jinja
Executable File
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ discourse_name }}
|
|
namespace: {{ discourse_namespace }}
|
|
spec:
|
|
replicas: {{ discourse_replicas }}
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: {{ discourse_name }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: {{ discourse_name }}
|
|
spec:
|
|
automountServiceAccountToken: false
|
|
securityContext:
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
imagePullSecrets:
|
|
{% if discourse_image_pull_secrets | length > 0 %}
|
|
{% for secret_name in discourse_image_pull_secrets %}
|
|
- name: {{ secret_name }}
|
|
{% endfor %}
|
|
{% else %}
|
|
[]
|
|
{% endif %}
|
|
nodeSelector: {{ discourse_node_selector | to_json }}
|
|
tolerations: {{ discourse_tolerations | to_json }}
|
|
containers:
|
|
- name: discourse
|
|
image: {{ discourse_image | to_json }}
|
|
imagePullPolicy: {{ discourse_image_pull_policy }}
|
|
ports:
|
|
- name: http
|
|
containerPort: 80
|
|
env:
|
|
- name: DISCOURSE_HOSTNAME
|
|
value: {{ discourse_hostname | to_json }}
|
|
- name: DISCOURSE_DEVELOPER_EMAILS
|
|
value: {{ discourse_developer_emails | join(',') | to_json }}
|
|
- name: DISCOURSE_DB_SOCKET
|
|
value: ""
|
|
- name: DISCOURSE_DB_HOST
|
|
value: {{ (discourse_name ~ '-postgres') | to_json }}
|
|
- name: DISCOURSE_DB_NAME
|
|
value: {{ discourse_database_name | to_json }}
|
|
- name: DISCOURSE_DB_USERNAME
|
|
value: {{ discourse_database_user | to_json }}
|
|
- name: DISCOURSE_DB_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ discourse_name }}-app
|
|
key: db-password
|
|
- name: DISCOURSE_REDIS_HOST
|
|
value: {{ (discourse_name ~ '-redis') | to_json }}
|
|
- name: DISCOURSE_REDIS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ discourse_name }}-app
|
|
key: redis-password
|
|
{% if discourse_smtp_address | length > 0 %}
|
|
- name: DISCOURSE_SMTP_ADDRESS
|
|
value: {{ discourse_smtp_address | to_json }}
|
|
- name: DISCOURSE_SMTP_PORT
|
|
value: {{ discourse_smtp_port | string | to_json }}
|
|
{% endif %}
|
|
{% if discourse_smtp_username | length > 0 %}
|
|
- name: DISCOURSE_SMTP_USER_NAME
|
|
value: {{ discourse_smtp_username | to_json }}
|
|
- name: DISCOURSE_SMTP_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ discourse_name }}-app
|
|
key: smtp-password
|
|
{% endif %}
|
|
{% if discourse_notification_email | length > 0 %}
|
|
- name: DISCOURSE_NOTIFICATION_EMAIL
|
|
value: {{ discourse_notification_email | to_json }}
|
|
{% endif %}
|
|
{% for key, value in discourse_extra_environment.items() %}
|
|
- name: {{ key }}
|
|
value: {{ value | string | to_json }}
|
|
{% endfor %}
|
|
volumeMounts:
|
|
- name: shared
|
|
mountPath: /shared
|
|
- name: logs
|
|
mountPath: /var/log
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /srv/status
|
|
port: http
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
startupProbe:
|
|
httpGet:
|
|
path: /srv/status
|
|
port: http
|
|
failureThreshold: 60
|
|
periodSeconds: 10
|
|
resources: {{ discourse_resources | to_json }}
|
|
securityContext:
|
|
runAsUser: 0
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop: [ALL]
|
|
add:
|
|
- CHOWN
|
|
- DAC_OVERRIDE
|
|
- FOWNER
|
|
- KILL
|
|
- NET_BIND_SERVICE
|
|
- SETGID
|
|
- SETUID
|
|
volumes:
|
|
- name: shared
|
|
persistentVolumeClaim:
|
|
claimName: {{ discourse_name }}-shared
|
|
- name: logs
|
|
emptyDir: {}
|