apiVersion: apps/v1
kind: Deployment
metadata:
  name: 'library'
  namespace: "thelibrary2"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: library
  template:
    metadata:
      labels:
        app: library
    spec:
      containers:
      - name: library
        image: quay.io/dyego_maas/the-library
        resources:
          limits:
            cpu: 200m
            memory: 256Mi
          requests:
            cpu: 100m
            memory: 128Mi
        ports:
        - name: http
          containerPort: 3000
        livenessProbe:
          httpGet:
            path: /healthcheck
            port: http
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /healthcheck
            port: http
          initialDelaySeconds: 30
          periodSeconds: 10
        env:
        - name: "LIBRARY_SECRET"
          valueFrom:
            secretKeyRef:
              key:  library-secret
              name: library-auth
        - name: "MONGO_USER"
          valueFrom:
            secretKeyRef:
              key:  mongo-user
              name: library-auth
        - name: "MONGO_PASSWORD"
          valueFrom:
            secretKeyRef:
              key:  mongo-password
              name: library-auth
        - name: "MONGO_DATABASE"
          valueFrom:
            secretKeyRef:
              key:  mongo-database
              name: library-auth
        - name: "MONGO_ADMIN_DATABASE"
          valueFrom:
            secretKeyRef:
              key:  mongo-admin-database
              name: library-auth
        - name: "MONGO_SERVER"
          value: "mongodb"
        - name: "APP_PORT"
          value: "3000"
