apiVersion: apps/v1
kind: Deployment
metadata:
  name: museum
spec:
  replicas: 2
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: museum
      app.kubernetes.io/part-of: ente
  template:
    metadata:
      labels:
        app.kubernetes.io/name: museum
        app.kubernetes.io/part-of: ente
    spec:
      containers:
        - name: museum
          image: museum
          env:
            - name: ENTE_CREDENTIALS_FILE
              value: /credentials.yaml
            - name: ENTE_DB_HOST
              valueFrom:
                secretKeyRef:
                  name: ente-db-credentials-ente-ente
                  key: HOST
            - name: ENTE_DB_NAME
              valueFrom:
                secretKeyRef:
                  name: ente-db-credentials-ente-ente
                  key: DATABASE_NAME
            - name: ENTE_DB_USER
              valueFrom:
                secretKeyRef:
                  name: ente-db-credentials-ente-ente
                  key: LOGIN
            - name: ENTE_DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: ente-db-credentials-ente-ente
                  key: PASSWORD
            - name: ENTE_DB_SSLMODE
              value: require
          resources:
            requests:
              memory: "64Mi"
              cpu: "50m"
            limits:
              memory: "128Mi"
              cpu: "250m"
          ports:
            - name: api
              containerPort: 8080
            - name: metrics
              containerPort: 2112
          readinessProbe:
            httpGet:
              path: /ping
              port: 8080
          livenessProbe:
            httpGet:
              path: /ping
              port: 8080
          volumeMounts:
            - name: logs
              mountPath: /var/log/ente
            - name: config
              mountPath: /museum.yaml
              subPath: museum.yaml
            - name: credentials
              mountPath: /credentials.yaml
              subPath: credentials.yaml
      volumes:
        - name: logs
          emptyDir: {}
        - name: config
          configMap:
            name: museum-config
            items:
              - key: museum.yaml
                path: museum.yaml
        - name: credentials
          secret:
            secretName: museum-credentials
            items:
              - key: credentials.yaml
                path: credentials.yaml
      nodeSelector:
        kubernetes.io/arch: arm64