apiVersion: apps/v1
kind: Deployment
metadata:
  name: museum
spec:
  replicas: 2
  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: default-cluster-pguser-ente
                key: host
          - name: ENTE_DB_NAME
            valueFrom:
              secretKeyRef:
                name: default-cluster-pguser-ente
                key: dbname
          - name: ENTE_DB_USER
            valueFrom:
              secretKeyRef:
                name: default-cluster-pguser-ente
                key: user
          - name: ENTE_DB_PASSWORD
            valueFrom:
              secretKeyRef:
                name: default-cluster-pguser-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