apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    component: app
  name: app
spec:
  selector:
    matchLabels:
      component: app
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        component: app
    spec:
      containers:
        - image: nextcloud:apache
          imagePullPolicy: Always
          name: app
          ports:
            - containerPort: 80
          env:
            - name: MYSQL_DATABASE
              valueFrom:
                secretKeyRef:
                  key: MYSQL_DATABASE
                  name: db-secrets
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: MYSQL_PASSWORD
                  name: db-secrets
            - name: MYSQL_USER
              valueFrom:
                secretKeyRef:
                  key: MYSQL_USER
                  name: db-secrets
          volumeMounts:
            - mountPath: /var/www/html
              name: app-persistent-storage
      restartPolicy: Always
      hostAliases:
      - ip: "192.168.165.62"
        hostnames:
        - "nc.icraft.local"
      volumes:
        - name: app-persistent-storage
          persistentVolumeClaim:
            claimName: app-pvc
