ungleich-k8s/apps/zammad/templates/deployment.yaml

418 lines
12 KiB
YAML
Raw Normal View History

2021-10-09 10:53:13 +00:00
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-postgres
spec:
selector:
matchLabels:
2021-10-11 01:46:24 +00:00
instance: {{ .Release.Name }}-postgres
2021-10-09 10:53:13 +00:00
replicas: 1
template:
metadata:
labels:
2021-10-11 01:46:24 +00:00
app: postgres
instance: {{ .Release.Name }}-postgres
2021-10-09 10:53:13 +00:00
spec:
containers:
- name: postgres
2021-10-09 13:46:36 +00:00
image: postgres:14
2021-10-09 10:53:13 +00:00
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: {{ tpl .Values.identifier . }}-postgres-config
volumeMounts:
- name: postgres-data
mountPath: "/var/lib/postgresql/data"
subPath: postgres
2021-10-10 07:58:45 +00:00
resources:
requests:
memory: "64Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "400m"
2021-10-09 10:53:13 +00:00
volumes:
- name: postgres-data
persistentVolumeClaim:
claimName: {{ tpl .Values.identifier . }}-postgres-data
---
2021-10-09 15:11:39 +00:00
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-elasticsearch
spec:
selector:
matchLabels:
2021-10-11 01:46:24 +00:00
instance: {{ .Release.Name }}-elasticsearch
2021-10-09 15:11:39 +00:00
replicas: 1
template:
metadata:
labels:
2021-10-11 01:46:24 +00:00
app: elasticsearch
instance: {{ .Release.Name }}-elasticsearch
2021-10-09 15:11:39 +00:00
spec:
containers:
- name: elasticsearch
image: zammad/zammad-docker-compose:zammad-elasticsearch-{{ .Chart.AppVersion }}
env:
- name: discovery.type
value: "single-node"
securityContext:
capabilities:
2021-10-10 07:58:45 +00:00
add: ["SYS_CHROOT"] # Required, because elasticsearch is using chroot()
2021-10-09 15:11:39 +00:00
ports:
- containerPort: 9200
2021-10-10 07:58:45 +00:00
resources:
requests:
memory: "1.2Gi"
cpu: "400m"
limits:
memory: "3Gi"
cpu: "2000m"
2021-10-09 15:11:39 +00:00
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-elasticsearch
labels:
2021-10-11 01:46:24 +00:00
app: elasticsearch
instance: {{ .Release.Name }}-elasticsearch
2021-10-09 15:11:39 +00:00
spec:
type: ClusterIP
ports:
- port: 9200
name: elasticsearch
selector:
2021-10-11 01:46:24 +00:00
instance: {{ .Release.Name }}-elasticsearch
2021-10-09 15:11:39 +00:00
---
2021-10-09 10:53:13 +00:00
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-postgres
labels:
2021-10-11 01:46:24 +00:00
instance: {{ .Release.Name }}-postgres
app: postgres
2021-10-09 10:53:13 +00:00
spec:
type: ClusterIP
ports:
- port: 5432
name: postgres
selector:
2021-10-11 01:46:24 +00:00
instance: {{ .Release.Name }}-postgres
---
apiVersion: v1
kind: Service
metadata:
name: {{ tpl .Values.identifier . }}
labels:
app: zammad
instance: {{ tpl .Values.identifier . }}
spec:
type: ClusterIP
ports:
- port: 80
name: http
- port: 443
name: https
selector:
instance: {{ .Release.Name }}-zammad
2021-10-09 10:53:13 +00:00
---
apiVersion: apps/v1
kind: Deployment
metadata:
2021-10-09 12:34:16 +00:00
name: {{ .Release.Name }}-zammad
2021-10-09 10:53:13 +00:00
spec:
selector:
matchLabels:
2021-10-11 01:46:24 +00:00
instance: {{ .Release.Name }}-zammad
2021-10-09 10:53:13 +00:00
replicas: 1
template:
metadata:
labels:
2021-10-11 01:46:24 +00:00
app: zammad
instance: {{ .Release.Name }}-zammad
2021-10-09 15:33:43 +00:00
annotations:
checksum/config: {{ include (print $.Template.BasePath "/nginxconf.yaml") . | sha256sum }}
2021-10-09 10:53:13 +00:00
spec:
initContainers:
2021-10-09 13:46:36 +00:00
- name: change-permissions
image: busybox
command:
- sh
- -c
- chown 1000:0000 /opt/zammad
volumeMounts:
- name: zammad-data
mountPath: "/opt/zammad"
- name: zammad-init
image: zammad/zammad-docker-compose:zammad-{{ .Chart.AppVersion }}
command:
- /docker-entrypoint.sh
- zammad-init
env:
- name: POSTGRESQL_HOST
value: {{ .Release.Name }}-postgres
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
key: POSTGRES_USER
2021-10-09 15:11:39 +00:00
- name: POSTGRESQL_PASS
2021-10-09 13:46:36 +00:00
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
key: POSTGRES_PASSWORD
- name: POSTGRESQL_DB
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
key: POSTGRES_DB
2021-10-09 15:11:39 +00:00
- name: ELASTICSEARCH_HOST
value: "{{ .Release.Name }}-elasticsearch"
2021-10-09 13:46:36 +00:00
volumeMounts:
- name: zammad-data
mountPath: "/opt/zammad"
2021-10-09 10:53:13 +00:00
containers:
- name: nginx
image: ungleich/ungleich-certbot:0.2.0
2021-10-09 10:53:13 +00:00
ports:
- containerPort: 443
name: https
- containerPort: 80
name: http
env:
- name: DOMAIN
value: "{{ tpl .Values.fqdn . }}"
- name: EMAIL
value: "{{ .Values.email }}"
- name: NGINX
value: "yes"
{{ if eq .Values.letsencryptStaging "no" }}
- name: STAGING
value: "no"
{{ end }}
2021-10-09 10:53:13 +00:00
volumeMounts:
- name: nginx-config
mountPath: "/etc/nginx/conf.d/"
- name: etcletsencrypt
mountPath: "/etc/letsencrypt"
2021-10-09 12:34:16 +00:00
- name: zammad-data
2021-10-09 15:11:39 +00:00
mountPath: "/opt/zammad"
2021-10-09 12:34:16 +00:00
- name: memcached
image: memcached:1.6.12-alpine
resources:
requests:
memory: "64Mi"
cpu: "100m"
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 11211
- name: redis
image: redis:6.2.6-alpine
2021-10-11 01:46:24 +00:00
resources:
requests:
memory: "32Mi"
cpu: "100m"
limits:
memory: "64Mi"
cpu: "200m"
2021-10-09 12:34:16 +00:00
ports:
- containerPort: 6379
2021-10-09 15:11:39 +00:00
- name: zammad-railsserver
2021-10-09 13:46:36 +00:00
image: zammad/zammad-docker-compose:zammad-{{ .Chart.AppVersion }}
2021-10-09 15:11:39 +00:00
command:
- /docker-entrypoint.sh
- zammad-railsserver
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
2021-10-09 10:53:13 +00:00
ports:
2021-10-09 15:11:39 +00:00
- containerPort: 3000
2021-10-09 12:34:16 +00:00
name: rails
2021-10-09 10:53:13 +00:00
env:
2021-10-09 13:46:36 +00:00
- name: POSTGRESQL_HOST
value: {{ .Release.Name }}-postgres
- name: POSTGRESQL_USER
2021-10-09 10:53:13 +00:00
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
2021-10-09 13:46:36 +00:00
key: POSTGRES_USER
2021-10-09 15:11:39 +00:00
- name: POSTGRESQL_PASS
2021-10-09 10:53:13 +00:00
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
2021-10-09 13:46:36 +00:00
key: POSTGRES_PASSWORD
- name: POSTGRESQL_DB
2021-10-09 10:53:13 +00:00
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
2021-10-09 13:46:36 +00:00
key: POSTGRES_DB
2021-10-09 12:34:16 +00:00
- name: REDIS_URL
value: "redis://localhost:6379"
- name: MEMCACHE_SERVERS
value: "localhost:11211"
2021-10-09 13:46:36 +00:00
- name: ELASTICSEARCH_HOST
2021-10-09 15:11:39 +00:00
value: "{{ .Release.Name }}-elasticsearch"
2021-10-09 10:53:13 +00:00
volumeMounts:
2021-10-09 12:34:16 +00:00
- name: zammad-data
mountPath: "/opt/zammad"
2021-10-09 15:11:39 +00:00
- name: zammad-scheduler
image: zammad/zammad-docker-compose:zammad-{{ .Chart.AppVersion }}
command:
- /docker-entrypoint.sh
- zammad-scheduler
env:
- name: POSTGRESQL_HOST
value: {{ .Release.Name }}-postgres
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
key: POSTGRES_USER
- name: POSTGRESQL_PASS
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
key: POSTGRES_PASSWORD
- name: POSTGRESQL_DB
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
key: POSTGRES_DB
- name: REDIS_URL
value: "redis://localhost:6379"
- name: MEMCACHE_SERVERS
value: "localhost:11211"
- name: ELASTICSEARCH_HOST
value: "{{ .Release.Name }}-elasticsearch"
volumeMounts:
- name: zammad-data
mountPath: "/opt/zammad"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
2021-10-09 15:11:39 +00:00
- name: zammad-websocket
image: zammad/zammad-docker-compose:zammad-{{ .Chart.AppVersion }}
command:
- sh
- -c
- "cd /opt/zammad && bundle exec script/websocket-server.rb -b :: -p 6042 start"
env:
- name: POSTGRESQL_HOST
value: {{ .Release.Name }}-postgres
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
key: POSTGRES_USER
- name: POSTGRESQL_PASS
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
key: POSTGRES_PASSWORD
- name: POSTGRESQL_DB
valueFrom:
secretKeyRef:
name: {{ tpl .Values.identifier . }}-postgres-config
key: POSTGRES_DB
- name: REDIS_URL
value: "redis://localhost:6379"
- name: MEMCACHE_SERVERS
value: "localhost:11211"
- name: ELASTICSEARCH_HOST
value: "{{ .Release.Name }}-elasticsearch"
volumeMounts:
- name: zammad-data
mountPath: "/opt/zammad"
ports:
- containerPort: 6042
name: websocket
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
2021-10-09 10:53:13 +00:00
volumes:
- name: etcletsencrypt
persistentVolumeClaim:
claimName: {{ tpl .Values.identifier . }}-letsencrypt-certs
2021-10-09 12:34:16 +00:00
- name: zammad-data
2021-10-09 10:53:13 +00:00
persistentVolumeClaim:
claimName: {{ tpl .Values.identifier . }}-data
- name: postgres-data
persistentVolumeClaim:
claimName: {{ tpl .Values.identifier . }}-postgres-data
- name: nginx-config
configMap:
name: {{ tpl .Values.identifier . }}-nginx-config
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ tpl .Values.identifier . }}-letsencrypt-certs
spec:
accessModes:
2021-10-11 01:46:24 +00:00
- ReadWriteOnce
2021-10-09 10:53:13 +00:00
resources:
requests:
storage: 50Mi
2021-10-11 01:46:24 +00:00
storageClassName: rook-ceph-block
2021-10-09 10:53:13 +00:00
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ tpl .Values.identifier . }}-data
spec:
accessModes:
2021-10-09 12:34:16 +00:00
- ReadWriteOnce
2021-10-09 10:53:13 +00:00
resources:
requests:
storage: {{ .Values.datasizeingb }}Gi
2021-10-09 12:34:16 +00:00
storageClassName: rook-ceph-block
2021-10-09 10:53:13 +00:00
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ tpl .Values.identifier . }}-postgres-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.dbsizeingb }}Gi
storageClassName: rook-ceph-block
2021-10-09 10:53:13 +00:00
---
apiVersion: v1
kind: Secret
metadata:
name: {{ tpl .Values.identifier . }}-postgres-config
annotations:
secret-generator.v1.mittwald.de/autogenerate: POSTGRES_PASSWORD
stringData:
POSTGRES_USER: "postgres"
2021-10-09 12:34:16 +00:00
POSTGRES_DB: "zammad"
2021-10-09 10:53:13 +00:00
---
apiVersion: v1
kind: Secret
metadata:
2021-10-09 12:34:16 +00:00
name: {{ tpl .Values.identifier . }}-zammad
2021-10-09 10:53:13 +00:00
annotations:
secret-generator.v1.mittwald.de/autogenerate: PASSWORD
stringData:
2021-10-09 12:34:16 +00:00
USERNAME: "zammad"