apiVersion: v1
kind: Service
metadata:
  name: kanboard
  namespace: kanboard
  labels:
    app: kanboard
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30588
      targetPort: kanboard
  selector:
    app: kanboard
    tier: frontend
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: kb-pv-claim
  namespace: kanboard
  labels:
    app: kanboard
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ""
  resources:
    requests:
      storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kanboard
  namespace: kanboard
  labels:
    app: kanboard
spec:
  selector:
    matchLabels:
      app: kanboard
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: kanboard
        tier: frontend
    spec:
      containers:
      - image: docker-registry:32000/kanboard:1.0
        name: kanboard
        env:
        - name: DB_DRIVER
          value: mysql
        - name: DB_HOSTNAME
          value: kanboard-mysql
        - name: DB_USERNAME
          valueFrom:
            secretKeyRef:
              name: mysqlkb-pass
              key: db_user
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysqlkb-pass
              key: db_passwd
# Configuración del correo              
        - name: MAIL_SMTP_HOSTNAME
          value: "smtp.gmail.com"
        - name: MAIL_SMTP_PORT
          value: "465"
        - name: MAIL_SMTP_USERNAME
          value: "king.bernard.b@gmail.com"
        - name: MAIL_SMTP_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysqlkb-pass
              key: smtp_password
        - name: MAIL_SMTP_ENCRYPTION
          value: tls
        ports:
        - containerPort: 80
          name: kanboard
        volumeMounts:
        - name: kanboard-persistent-storage
          mountPath: /var/www
      imagePullSecrets:
      - name: reg-cred-secret
      volumes:
      - name: kanboard-persistent-storage
        persistentVolumeClaim:
          claimName: kb-pv-claim
