apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "mautic.fullname" . }}
  labels:
    {{- include "mautic.labels" . | nindent 4 }}
spec:
  selector:
    matchLabels:
      {{- include "mautic.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "mautic.selectorLabels" . | nindent 8 }}
    spec:
      containers:
        - name: mautic
          image: {{ include "mautic.effectiveImage" . | quote }}
          imagePullPolicy: {{ include "mautic.effectiveImagePullPolicy" . }}
          ports:
            - containerPort: 80
          env:
            - name: MAUTIC_DB_HOST
              value: {{ .Values.database.host }}
            - name: MAUTIC_DB_USER
              value: {{ .Values.database.user }}
            - name: MAUTIC_DB_PASSWORD              
              valueFrom:
                secretKeyRef:
                  name: mautic-infra-secrets
                  key: mariadb-password
            - name: MAUTIC_DB_NAME
              value: {{ .Values.database.name }}
            - name: MAUTIC_DB_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mautic-infra-secrets
                  key: mariadb-root-password

