{{- if .Values.discourse.enabled }} {{- $edemoUrl := .Values.edemocracia.hostname -}} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "edemocracia.fullname" . }}-discourse labels: {{- include "edemocracia.labels" . | nindent 4 }} io.kompose.service: {{ include "edemocracia.fullname" . }}-discourse spec: selector: matchLabels: {{- include "edemocracia.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: discourse io.kompose.service: {{ include "edemocracia.fullname" . }}-discourse strategy: type: Recreate template: metadata: labels: {{- include "edemocracia.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: discourse io.kompose.service: {{ include "edemocracia.fullname" . }}-discourse spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} initContainers: - image: "{{ .Values.discourse.image.repository }}:{{ .Values.discourse.image.tag }}" name: {{ include "edemocracia.fullname" . }}-discourse-cpimgs command: - "cp" - "-au" - "/var/www/discourse/public/images/." - "/publicimgs/" volumeMounts: - mountPath: /publicimgs/ subPath: images name: {{ include "edemocracia.fullname" . }}-discourse containers: - args: - ./start-web.sh env: - name: ADMIN_EMAIL value: {{ .Values.edemocracia.admin.email | quote }} - name: ADMIN_PASSWORD value: {{ .Values.edemocracia.admin.password | quote }} - name: ADMIN_USERNAME value: admin - name: DISCOURSE_CONTACT_EMAIL value: {{ .Values.edemocracia.admin.email | quote }} - name: DISCOURSE_CONTACT_URL value: {{ $edemoUrl }} - name: DISCOURSE_DB_HOST value: {{ (include "postgresql.fullname" .) }} - name: DISCOURSE_DB_NAME value: discourse - name: DISCOURSE_DB_PASSWORD value: {{ .Values.postgresql.postgresqlPassword | quote }} - name: DISCOURSE_DB_PORT value: "5432" - name: DISCOURSE_DB_USERNAME value: {{ .Values.postgresql.postgresqlUsername | quote}} - name: DISCOURSE_DEVELOPER_EMAILS - name: DISCOURSE_FORCE_HOSTNAME value: {{ $edemoUrl }}\/expressao - name: DISCOURSE_HOSTNAME value: {{ $edemoUrl }}\/expressao - name: DISCOURSE_NOTIFICATION_EMAIL value: {{ .Values.edemocracia.admin.email }} - name: DISCOURSE_REDIS_HOST value: {{ (include "redis.fullname" .) }}-master - name: DISCOURSE_REDIS_PORT value: "6379" - name: DISCOURSE_RELATIVE_URL_ROOT value: /expressao - name: DISCOURSE_SMTP_ADDRESS value: {{ .Values.smtp.host | quote }} - name: DISCOURSE_SMTP_PASSWORD value: {{ .Values.smtp.password | quote }} - name: DISCOURSE_SMTP_PORT value: {{ .Values.smtp.port | quote }} - name: DISCOURSE_SMTP_USER_NAME value: {{ .Values.smtp.username | quote }} - name: DISCOURSE_SSO_SECRET value: {{ .Values.discourse.sso.secret | quote }} - name: DISCOURSE_SSO_URL value: "https://{{ $edemoUrl }}" - name: RAILS_ENV value: production image: {{.Values.discourse.image.repository}}:{{ .Values.discourse.image.tag }} imagePullPolicy: {{ .Values.discourse.image.pullPolicy }} name: {{ include "edemocracia.fullname" . }}-discourse ports: - containerPort: 8080 resources: {{- toYaml .Values.discourse.resources | nindent 12 }} volumeMounts: - mountPath: /var/www/discourse/public/assets/ name: {{ include "edemocracia.fullname" . }}-discourse subPath: assets - mountPath: /var/www/discourse/public/javascripts/ name: {{ include "edemocracia.fullname" . }}-discourse subPath: javascripts - mountPath: /var/www/discourse/public/images/ name: {{ include "edemocracia.fullname" . }}-discourse subPath: images - mountPath: /var/www/discourse/tmp/stylesheet-cache/ name: {{ include "edemocracia.fullname" . }}-discourse subPath: stylesheet-cache restartPolicy: Always serviceAccountName: "" volumes: - name: {{ include "edemocracia.fullname" . }}-discourse persistentVolumeClaim: claimName: {{ include "edemocracia.fullname" . }}-discourse {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app.kubernetes.io/name operator: In values: - {{ include "edemocracia.name" . }} - key: app.kubernetes.io/instance operator: In values: - {{ .Release.Name }} - key: app.kubernetes.io/component operator: In values: - edemocracia topologyKey: kubernetes.io/hostname {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}