apiVersion: apps/v1
kind: Deployment
metadata:
  name: iam
  labels:
    app: iam
spec:
  replicas: 1
  selector:
    matchLabels:
      app: iam
  template:
    metadata:
      labels:
        app: iam
    spec:
      containers:
        - name: iam
          image: netologygroup/iam
          ports:
            - containerPort: 8080
          env:
            - name: DATABASE_URL
              valueFrom:
                secretKeyRef:
                  name: postgresql-iam-credentials
                  key: database_url
            - name: RUST_LOG
              valueFrom:
                configMapKeyRef:
                  name: iam-env-configmap
                  key: RUST_LOG
          volumeMounts:
            - name: config
              mountPath: /app/Settings.toml
              subPath: Settings.toml
            - name: auth-keys
              mountPath: /app/keys/
          resources:
            requests:
              cpu: 100m
              memory: 200Mi
            limits:
              cpu: 500m
              memory: 1Gi
      volumes:
        - name: config
          configMap:
            name: iam-settings-configmap
        - name: auth-keys
          secret:
            secretName: iam-credentials
