|
| 1 | +apiVersion: apps/v1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + name: {{ include "osticket.fullname" . }} |
| 5 | + labels: |
| 6 | + {{- include "osticket.labels" . | nindent 4 }} |
| 7 | +spec: |
| 8 | + {{- if not .Values.autoscaling.enabled }} |
| 9 | + replicas: {{ .Values.replicaCount }} |
| 10 | + {{- end }} |
| 11 | + selector: |
| 12 | + matchLabels: |
| 13 | + {{- include "osticket.selectorLabels" . | nindent 6 }} |
| 14 | + template: |
| 15 | + metadata: |
| 16 | + {{- with .Values.podAnnotations }} |
| 17 | + annotations: |
| 18 | + {{- toYaml . | nindent 8 }} |
| 19 | + {{- end }} |
| 20 | + labels: |
| 21 | + {{- include "osticket.labels" . | nindent 8 }} |
| 22 | + {{- with .Values.podLabels }} |
| 23 | + {{- toYaml . | nindent 8 }} |
| 24 | + {{- end }} |
| 25 | + spec: |
| 26 | + {{- with .Values.imagePullSecrets }} |
| 27 | + imagePullSecrets: |
| 28 | + {{- toYaml . | nindent 8 }} |
| 29 | + {{- end }} |
| 30 | + serviceAccountName: {{ include "osticket.serviceAccountName" . }} |
| 31 | + securityContext: |
| 32 | + {{- toYaml .Values.podSecurityContext | nindent 8 }} |
| 33 | + initContainers: |
| 34 | + - name: init-osticket |
| 35 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 36 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 37 | + command: ["/bin/sh", "-c"] |
| 38 | + args: |
| 39 | + - | |
| 40 | + if [ ! -f /data/var/www/html/include/ost-config.php ]; then |
| 41 | + echo "Initializing osTicket configuration..."; |
| 42 | + php /usr/local/bin/install.php; |
| 43 | + chmod 644 /var/www/html/include/ost-config.php; |
| 44 | + cp -R /var/www/html/* /data/var/www/html/; |
| 45 | + fi |
| 46 | + env: |
| 47 | + - name: MYSQL_HOST |
| 48 | + value: "{{ include "osticket.name" . }}-mariadb" |
| 49 | + - name: MYSQL_ROOT_PASSWORD |
| 50 | + valueFrom: |
| 51 | + secretKeyRef: |
| 52 | + name: {{ include "osticket.fullname" . }}-mariadb |
| 53 | + key: mariadb-root-password |
| 54 | + - name: MQSQL_DATABASE |
| 55 | + value: {{ .Values.mariadb.auth.database }} |
| 56 | + - name: MYSQL_USER |
| 57 | + value: {{ .Values.mariadb.auth.username }} |
| 58 | + - name: MYSQL_PASSWORD |
| 59 | + valueFrom: |
| 60 | + secretKeyRef: |
| 61 | + name: {{ include "osticket.fullname" . }}-mariadb |
| 62 | + key: mariadb-password |
| 63 | + volumeMounts: |
| 64 | + - name: osticket-volume |
| 65 | + mountPath: /data/var/www/html |
| 66 | + |
| 67 | + containers: |
| 68 | + - name: nginx |
| 69 | + image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag | default .Chart.AppVersion }}" |
| 70 | + imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} |
| 71 | + ports: |
| 72 | + - name: http |
| 73 | + containerPort: {{ .Values.service.port }} |
| 74 | + protocol: TCP |
| 75 | + env: |
| 76 | + - name: FPM_PORT |
| 77 | + value: {{ .Values.fpmPort | quote }} |
| 78 | + livenessProbe: |
| 79 | + {{- toYaml .Values.nginx.livenessProbe | nindent 12 }} |
| 80 | + readinessProbe: |
| 81 | + {{- toYaml .Values.nginx.readinessProbe | nindent 12 }} |
| 82 | + resources: |
| 83 | + {{- toYaml .Values.nginx.resources | nindent 12 }} |
| 84 | + {{- with .Values.nginx.volumeMounts }} |
| 85 | + volumeMounts: |
| 86 | + {{- toYaml . | nindent 12 }} |
| 87 | + {{- end }} |
| 88 | + |
| 89 | + - name: {{ .Chart.Name }} |
| 90 | + securityContext: |
| 91 | + {{- toYaml .Values.securityContext | nindent 12 }} |
| 92 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 93 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 94 | + ports: |
| 95 | + - name: php-fpm |
| 96 | + containerPort: {{ .Values.fpmPort }} |
| 97 | + protocol: TCP |
| 98 | + env: |
| 99 | + - name: MYSQL_HOST |
| 100 | + value: "{{ include "osticket.name" . }}-mariadb" |
| 101 | + - name: MYSQL_ROOT_PASSWORD |
| 102 | + valueFrom: |
| 103 | + secretKeyRef: |
| 104 | + name: {{ include "osticket.fullname" . }}-mariadb |
| 105 | + key: mariadb-root-password |
| 106 | + - name: MQSQL_DATABASE |
| 107 | + value: {{ .Values.mariadb.auth.database }} |
| 108 | + - name: MYSQL_USER |
| 109 | + value: {{ .Values.mariadb.auth.username }} |
| 110 | + - name: MYSQL_PASSWORD |
| 111 | + valueFrom: |
| 112 | + secretKeyRef: |
| 113 | + name: {{ include "osticket.fullname" . }}-mariadb |
| 114 | + key: mariadb-password |
| 115 | + livenessProbe: |
| 116 | + {{- toYaml .Values.livenessProbe | nindent 12 }} |
| 117 | + readinessProbe: |
| 118 | + {{- toYaml .Values.readinessProbe | nindent 12 }} |
| 119 | + resources: |
| 120 | + {{- toYaml .Values.resources | nindent 12 }} |
| 121 | + {{- with .Values.volumeMounts }} |
| 122 | + volumeMounts: |
| 123 | + {{- toYaml . | nindent 12 }} |
| 124 | + {{- end }} |
| 125 | + volumes: |
| 126 | + - name: nginx-config |
| 127 | + configMap: |
| 128 | + name: {{ include "osticket.fullname" . }}-nginx-config |
| 129 | + {{- with .Values.volumes }} |
| 130 | + {{- toYaml . | nindent 8 }} |
| 131 | + {{- end }} |
| 132 | + {{- with .Values.nodeSelector }} |
| 133 | + nodeSelector: |
| 134 | + {{- toYaml . | nindent 8 }} |
| 135 | + {{- end }} |
| 136 | + {{- with .Values.affinity }} |
| 137 | + affinity: |
| 138 | + {{- toYaml . | nindent 8 }} |
| 139 | + {{- end }} |
| 140 | + {{- with .Values.tolerations }} |
| 141 | + tolerations: |
| 142 | + {{- toYaml . | nindent 8 }} |
| 143 | + {{- end }} |
0 commit comments