apiVersion: apps/v1
kind: Deployment
metadata:
    name: backend-depl
spec:
    replicas: 1
    selector:
        matchLabels:
            app: backend
    template:
        metadata:
            labels:
                app: backend
        spec:
            containers:
                - name: backend
                  image: backend
                  ports:
                      - containerPort: 3000
                  envFrom:
                    - configMapRef:
                          name: backend-config
                  env:
                    - name: MYSQL_USERNAME
                      valueFrom:
                          secretKeyRef:
                              name: mysql-secrets
                              key: MYSQL_ROOT_USERNAME

                    - name: MYSQL_PASSWORD
                      valueFrom:
                          secretKeyRef:
                              name: mysql-secrets
                              key: MYSQL_ROOT_PASSWORD

                    - name: MYSQL
                      valueFrom:
                        secretKeyRef:
                          name: mysql-secrets
                          key: MYSQL_DATABASE

                    - name: JWT_SECRET
                      valueFrom:
                        secretKeyRef:
                          name: other-secrets
                          key: jwt-secret

                    - name: MAIL_HOST
                      valueFrom:
                        secretKeyRef:
                          name: email-secret
                          key: mail_host

                    - name: MAIL_PORT
                      valueFrom:
                        secretKeyRef:
                          name: email-secret
                          key: mail_port

                    - name: MAIL_USERNAME
                      valueFrom:
                        secretKeyRef:
                          name: email-secret
                          key: mail_username

                    - name: MAIL_PASSWORD
                      valueFrom:
                        secretKeyRef:
                          name: email-secret
                          key: mail_password

                    - name: MAIL_DEFAULT_FROM
                      valueFrom:
                        secretKeyRef:
                          name: email-secret
                          key: mail_default_from

                    - name: USER_EMAIL
                      valueFrom:
                        secretKeyRef:
                          name: default-user-secret
                          key: user_email

                    - name: USER_PASSWORD
                      valueFrom:
                        secretKeyRef:
                          name: default-user-secret
                          key: user_password

                    - name: USER_NAME
                      valueFrom:
                        secretKeyRef:
                          name: default-user-secret
                          key: user

                  resources:
                       limits:
                            memory: 1Gi
                            cpu: "1"
                       requests:
                            memory: 256Mi
                            cpu: "0.2"
